I need to be able to programmatically transcode mpeg-2 files to .mp4, .mp3, .wmv, .rm (optional), and .flv (optional), and hopefully generate a thumbnail as well. I found the Java Media Framework, but it frankly looks pretty crappy. This will be running a Linux server, so I could shell out to ffmpeg using Commons Exec - does ffmpeg do everything I need to do? FFmpeg seems pretty daunting, which is why I'm having trouble finding this information, but it definitely seems to be a jack-of-all-trades. Any suggestions?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
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.
Ffmpeg is the best and easiest. To output/convert video:
And your screenshot:
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 wanthh: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.You can also use Xuggler directly from Java, which provides much better codec and encoding support than JMF.
An interesting web service from encoding.com will transcode files for you.