BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-11-2009, 08:01 PM   #1
Tablespoon
New Member
 
Join Date: Oct 2009
Model: 8310
PIN: N/A
Carrier: AT&T
Posts: 1
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


60W 40KHz Silvery Ultrasonic Piezoelectric Transducer High Conversion Efficiency picture

60W 40KHz Silvery Ultrasonic Piezoelectric Transducer High Conversion Efficiency

$18.99



5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water picture

5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water

$25.43



Vibralung Acoustical Percussor 9600 Patient Kit Hand-held Transducer & Adapters picture

Vibralung Acoustical Percussor 9600 Patient Kit Hand-held Transducer & Adapters

$270.00



MTS LPRHVU00701 Temposonics Transducer Linear Position LPR-HVU-00701 90014868 picture

MTS LPRHVU00701 Temposonics Transducer Linear Position LPR-HVU-00701 90014868

$238.95



Psi-Tronix Motion Transducer Mod. 20 picture

Psi-Tronix Motion Transducer Mod. 20

$150.00



AcuAMP DCT500-42-24-F DC Current Transducer, 500A range, 4-20mA output -  USA picture

AcuAMP DCT500-42-24-F DC Current Transducer, 500A range, 4-20mA output - USA

$145.00







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