Anyone knows the trick?
And how to install ffmpeg ? yum install mpeg
only returns this:
======================================================================================== Matched: mpeg ======================================================================================== libiec61883.i386 : Streaming library for IEEE1394 libiec61883.x86_64 : Streaming library for IEEE1394 qffmpeg-devel.i386 : Development package for qffmpeg qffmpeg-devel.x86_64 : Development package for qffmpeg qffmpeg-libs.i386 : Libraries for qffmpeg qffmpeg-libs.x86_64 : Libraries for qffmpeg
Use the FFmpeg executable with the seek option. You'll need to convert to a time first, e.g. if I want frame 150 and my video is 29.97 FPS the command will be ffmpeg -ss 00:00:05.01 -i myvideo. avi -frames:v 1 myimage.
I've cobbled up this command line from various answers that works great for me to get the absolutely first frame out from a video. I use this to save a thumbnail screenshot for the video.
ffmpeg -i inputfile.mkv -vf "select=eq(n\,0)" -q:v 3 output_image.jpg
The select filter -vf "select=eq(n\,0)"
is to select only frame #0.
-q:v
allows you to set the quality of the output jpeg between 1 and 31. Lower the number, higher the quality. 2 - 5 works good, I use 3.
Note: This will get you an image with the same size as the video. To get a thumbnail, you can use the scale filter to get a thumbnail to fit whatever width you need, like so:
ffmpeg -i inputfile.mkv -vf "select=eq(n\,0)" -vf scale=320:-2 -q:v 3 output_image.jpg
The above command will give you a thumbnail jpeg that will be scaled to match width of 320, and height will be calculated to match the aspect ratio.
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