Programmatically transcode MPEG-2 videos

牧云@^-^@ 提交于 2019-12-01 00:53:09

Ffmpeg is the best and easiest. To output/convert video:

ffmpeg -i {input}.ext -r {target_frame_rate} -ar {target_audio_rate} -b {target_bitrate} -s {width}x{height} {target}.ext

And your screenshot:

ffmpeg -i {input}.ext -r 1 -ss 00:00:04:005 -t 00:00:01 -an -s {width}x{height} {target_name}%d.jpg

15 fps is standard for flv and audio sample rate should be 44100 for flv. Options to use: -r specifies a frame rate of 1 fps (one frame used as the screenshot), -ss seeks to the position you want hh:mm:ss:fff, -t is the duration (one second to match your one fps), -an tells ffmpeg to ignore audio, and -s is the size of the screenshot. The %d is necessary as it will be the digit incremented on how many screenshots you use. With the above, %d will always be the number 1 (one frame, one screenshot). Good luck.

An interesting web service from encoding.com will transcode files for you.

You can also use Xuggler directly from Java, which provides much better codec and encoding support than JMF.

The popular transcoding applications for Linux are ffmpeg, transcode and mencoder. Both transcode and mencoder use ffmpeg and all three can handle the tasks that you require, including FLV transcoding and video thumbnailing. ffmpeg is probably the most popular of the three, so you might find better online support. Also worth mentioning is that ffmpeg supports multithreaded transcoding.

I would recommend using ffmpeg.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!