Thursday, September 25, 2008

ffmpeg command line quickies.....

Here are a bunch of ffmpeg command lines that will do just about everything you need.

  1. Getting info from a video file
  2. ffmpeg -i video.avi
  3. Turn a sequence of images into video
  4. ffmpeg -f image2 -i image%d.jpg video.mpg
  5. Turn a video into a sequence of images
  6. ffmpeg -i video.mpg image%d.jpg
  7. Encode video for Ipod/IPhone
  8. ffmpeg -i source_video_file.avi -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv -trell 1 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X output_file.mp4
  9. Encode video for PSP
  10. ffmpeg -i source_video_file.avi -b 300 -s 320x240 -vcodec xvid -ab 32 -ar 24000 -acodec aac output_file.mp4OR ffmpeg -i "OriginalFile.avi" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 320x240 "OutputFile.mp4"
  11. Extract audio from a video file and save it as mp3 format
  12. ffmpeg -i source_video_file.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output_file.mp3
  13. Convert a wave file to mp3
  14. ffmpeg -i original_audio_file.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output_file.mp3
  15. Convert a avi video to mpeg
  16. ffmpeg -i original_movie.avi output_file.mpg
  17. Convert a mpeg video to avi
  18. ffmpeg -i original_movie.mpg output_file.avi
  19. Convert a avi video to uncompressed animated gif
  20. ffmpeg -i original_movie.avi output_file.gif
  21. Add audio to an existing video-only file (mix audio and video)
  22. ffmpeg -i son.wav -i original_movie.avi output_file.mpg
  23. Convert a avi video to flv (flash video)
  24. ffmpeg -i original_movie.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv output_file.flv
  25. Convert a flv video to mpeg
  26. ffmpeg -i myFile.flv -ab 56 -ar 22050 -b 500 -s 320x240 myFile.mpg
  27. Convert a avi video to dv
  28. ffmpeg -i original_movie.avi -s ntsc -r ntsc -aspect 4:3 -ar 48000 -ac 2 output_file.dvOR ffmpeg -i original_movie.avi -target ntsc-dv output_file.dv
  29. Convert a avi video to mpeg specifically for DVD creation
  30. ffmpeg -i source_video.avi -target ntsc-dvd -ps 2000000000 -aspect 16:9 finale_video.mpeg
  31. Compress a avi video to Divx
  32. ffmpeg -i original_movie.avi -s 320x240 -vcodec msmpeg4v2 output_file.avi
  33. Convert a Ogg Theora video to mpeg specifically for DVD creation
  34. ffmpeg -i original_movie.ogm -s 720x576 -vcodec mpeg2video -acodec mp3 output_file.mpg
  35. Convert a avi video to mpeg2 for SVCD creation
  36. ffmpeg -i original_movie.avi -target ntsc-svcd output_file.mpg
  37. Convert a avi video to mpeg2 for VCD creation
  38. ffmpeg -i original_movie.avi -target ntsc-vcd output_file.mpg

5 comments:

Anonymous said...

One very important thing I just learned after two hours - I cannot write a .BAT file with "ffmpeg -i video.mpg image%d.jpg" and then run the batch file. If I do, I get the message "Unable to find a suitable output format for 'imaged.jpg'. Instead, I must type that command on the actual command line prompt. At least, that's how it works for me on Windows XP. Please let other people know about this potential pitfall.

Anonymous said...

use %%d in your batchfile and it will work.

daveh said...

These are very helpful. I have a question. When creating a slideshow from jpg files, is it possible to specify the duration each image will remain displayed? What are the other options for this feature, ie. crossfading, etc.

Thank you,
David Hudach

Deal Robot said...

A big thank you from Canada!

Anonymous said...

@ first "Anonymous":

I lost four hours!!!
Thanks to you, now it working fine.