.comment-link {margin-left:.6em;}

Sunday, October 30, 2005

 

Sample parameters for ffmpeg

Jay wanted sample parameters for ffmpeg to encode iPod compatible video, so here goes:

Right now, the latest thing I've encoded has the command line parameters:

ffmpeg.exe -i c:\input.avi -y -vcodec xvid -vtag mp4v -vprofile SP -4mv -b 1024 -acodec aac -ac 2 -ab 128 -f mp4 c:\test.mp4

Note that the output resolution (which is important) is NOT specified. This is because the content size I was encoding was within the ipod spec. If you want to be safe, you can scale down until the width is 320. To do this with an arbitrary size, do this:

Using our example size of 576x320.
1) Calculate the aspect ratio by dividing 576 by 320: 1.8
2) Divide 320 by 1.8: 178

OK, so to scale down to a width of 320 we'd use 320x178 for our widescreen content. note that if you get ~1.333 as your aspect ratio it is 4:3 and you can just encode at 320x240.

So how to specify size? The 's' parameter, like so:

ffmpeg.exe -i c:\input.avi -y -vcodec xvid -vtag mp4v -vprofile SP -4mv -b 1024 -acodec aac -ac 2 -ab 128 -f mp4 -s 320x178 c:\test.mp4

This will scale down the image. This video will work fine on the iPod. Keep in mind you can go out of spec a bit if you pick a resolution that has less than 230400 pixels. My video was 576x320 which actually has less pixels than that, so it worked fine to leave the resolution at that.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?