Using ffmpeg, and assuming it's doable, how can I transform input video from one format to another (e.g. MPEG-2 to MPEG-4) and generate thumbnails every n seconds at the same time?
Regards, Matt
This command will take in.flv and transcode to .webm and .mp4 while simultaneously generating a single thumbnail.
ffmpeg -y -threads '1' -i 'in.flv' \
-map '0:v' -map '0:a' -c:v 'libx264' -c:a 'libvo_aacenc' out.mp4 \
-map '0:v' -map '0:a' -c:v 'libvpx' -c:a 'libvorbis' out.webm \
-map '0:v' -r '1' -t '1' 'out.png'
To generate a thumbnail every n seconds, change -r (the frame-rate) to the inverse of n and remove -t (so that thumbnails are taken until the end of the video). For example, to generate a thumbnail every 4 seconds, you want a framerate of 1/4.
ffmpeg -y -threads '1' -i 'in.flv' \
-map '0:v' -map '0:a' -c:v 'libx264' -c:a 'libvo_aacenc' out.mp4 \
-map '0:v' -map '0:a' -c:v 'libvpx' -c:a 'libvorbis' out.webm \
-map '0:v' -r '1/4' 'out-%d.png'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With