BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-11-2009, 08:01 PM   #1 (permalink)
New Member
 
Join Date: Oct 2009
Model: 8310
PIN: N/A
Carrier: AT&T
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Blackberry Video Converter script - Linux

Please Login to Remove!

This is a script I made and have been using for a while. I figured I'd post it here in hopes that it will be of use to others. It converts videos to what I've found to be the best for playback on my Blackberry Curve. The quality is high enough to allow you to enjoy your videos while being modest enough not to slow down your phone during playback.

Simply put videos into ~/Videos/blackberry-video-converter/input and run the script. You'll find your converted videos in ~/Videos/blackberry-video-converter/output.

You must have ffmpeg and libfaac installed on your system.

Enjoy!

Code:
#!/bin/bash


## This script uses ffmpeg to convert video files for playback on Blackberry smartphones.
## By Todd Stein


# INITIALIZATION
rootDir="${HOME}/Videos/blackberry-video-converter"
inputDir="${rootDir}/input"
outputDir="${rootDir}/output"
workingSymbols=( "." "-" "+" "*" "*" "+" "-" )

mkdir -p ${inputDir}
mkdir -p ${outputDir}



# CONVERT FILES (simultaneously)
cd ${inputDir}
for i in *; do

	if [[ -f ${i} ]]; then

		printf "\nStarting converstion of ${i}"
		{
			rm -f "${outputDir}/${i%.*}.mp4" # remove existing output
			ffmpeg -i "${inputDir}/${i}" -vcodec mpeg4 -s qvga -r 16 -acodec libfaac -ar 22050 -ac 2 -ab 48k "${outputDir}/${i%.*}.mp4" &> /dev/null # convert the video
		} &
		children="${children}${!} " # collect PIDs of children

	else

		printf "\nNo files to convert!\n\n"
		exit 1

	fi
done



# WAIT FOR CONVERSION TO FINISH
printf "\n\nConverting, please wait...  "
allDone="0"
until [[ ${allDone} -eq 1 ]]; do

	# if the first PID in the children PID list no longer exists, remove it from the list
	if ! ps -p $(echo ${children} | cut -f1 -d" ") &> /dev/null; then
		children=$(echo ${children#$(echo ${children} | cut -f1 -d" ")})
	fi

	# bounce the working ball
	for (( i=0; ${i}<${#workingSymbols[*]}; i++ )); do
		printf "\b \b${workingSymbols[${i}]}"
		sleep .1
	done

	# if the child PID list is empty, we're done
	if [[ -z ${children} ]]; then
		allDone="1"
		printf "\bDone!\n\n"
	fi
done
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

535-PCS IC SN74LVC1G06DBVR INVERTER SINGLE 1INPUT TI 74LVC1G06 SN74LVC1G06DBV
$24.86
535-PCS IC SN74LVC1G06DBVR INVERTER SINGLE 1INPUT TI 74LVC1G06 SN74LVC1G06DBV picture10-PCS INVERTER SCHMITT TRIGGER 1-ELEMENT CMOS 5-PIN SSOP TC7S14F 7S14 TC7S14
$39.8
10-PCS INVERTER SCHMITT TRIGGER 1-ELEMENT CMOS 5-PIN SSOP TC7S14F 7S14 TC7S14 picture5-PCS IC MAX764CSA REGULATOR INVERTER -5V/ADJ 0.26A 8-PIN SOIC MAXIM 764
$16.38
5-PCS IC MAX764CSA REGULATOR INVERTER -5V/ADJ 0.26A 8-PIN SOIC MAXIM 764 picture1090-PCS IC SN74AHC1G04DBVR SINGLE INVERTER GATE TI 74 SN74AHC1G04DBVR 74AHC1G04
$24.72
1090-PCS IC SN74AHC1G04DBVR SINGLE INVERTER GATE TI 74 SN74AHC1G04DBVR 74AHC1G04 pictureNEW Mitsubishi Inverter FR-U120-0.2K-UL BNIB
$300.0
NEW Mitsubishi Inverter FR-U120-0.2K-UL  BNIB  picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.