Wednesday, May 20, 2009

FFMpeg Sample Command

Convent Video to 3gp(mobile) format

ffmpeg -i input_video.mp4 -s 176x144 -vcodec h263 -r 25 -b 12200 -ab 12200 -ac 1 -ar 8000 output_video.3gp

Add Audio to a Video File Using ffmpeg


ffmpeg -vcodec flv -qscale 9.5 -r 25 -ar 22050 -ab 32k -s 320x240 -i 1.mp3 -i Meta.ogv final.flv

Linux Command to Convert a Video to PSP’s MP4 Format


ffmpeg -i "OriginalFile.avi" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 320x240 "OutputFile.mp4"


Convert FLV file to MPEG


ffmpeg -i myFile.flv -ab 56 -ar 22050 -b 500 -s 320x240 myFile.mpg

Source:http://txt.binnyva.com/tag/ffmpeg/

sudo apt-get install ffmpeg

ffmpeg -formats (lists all available formats based on the currently installed codecs, to be used with -vcodec, -acodec, and -f)

ffmpeg -i inputfilename.ext -vcodec wmv2 -sameq -acodec wmav2 -f asf outfile.asf

ffmpeg - start ffmpeg
(-i inputfilename.ext - tells ffmpeg the file name and extension from which to convert)
(-vcodec wmv2 - use video codec wmv2)
(-sameq - use same video quality as source file)
(-acodec wmav2 - use audio codec wmav2)
(-f asf - choose output format, sometimes known as a container, in this case asf)

Bonus Batch Conversion

sudo touch convert.sh (here we use touch to create a blank file, not always necessary to do that rather than through a text editor but it is safer with permissions and such)

gksu gedit convert.sh (this is only available for gnome desktops, i.e. ubuntu and the like, so you can tell people to use whatever text editor they like)

sudo chmod 0777 convert.sh (like last time, chmod changes file or directory permissions, in this case giving access to everyone to read, write, execute the script)

./convert.sh (runs the script convert.sh on files in the /Videos directory)

ls (ls -l lists all files and directories plus permissions)


script:

for f in *.MOV

do

ffmpeg -i “$f” -vcodec wmv2 -sameq -acodec wmav2 “${f%.MOV}.asf”;

done





No comments: