문제

I want to create thumbnails every second from a video, but for some reason mplayer skips frames. for example, on a video of 2mn 49s duration I got only 59 thumbnails instead of 169

What i've tried: mplayer -nosound -vo jpg:outdir=. -sstep 1 file.flv


mediainfo file.flv

General
Complete name                            : file.flv
Format                                   : Flash Video
File size                                : 12.6 MiB
Duration                                 : 2mn 49s
Overall bit rate                         : 626 Kbps
Tagging application                      : Yet Another Metadata Injector for FLV - Version 1.8

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : 7
Duration                                 : 2mn 48s
Bit rate                                 : 555 Kbps
Width                                    : 704 pixels
Height                                   : 396 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 30.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.066
Stream size                              : 11.2 MiB (89%)
Writing library                          : x264 core 125
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=48 / lookahead_threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=555 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
도움이 되었습니까?

해결책

You can use ffmpeg.

PNG

ffmpeg -i input -r 1 output_%03d.png

JPG

ffmpeg -i input -r 1 -qscale:v 2 output_%03d.jpg

  • -r 1 will output 1 frame per second. -r 1/5 will output 1 frame per 5 seconds.

  • This will result in numerically sequential files starting with output_001.jpg.

  • For JPG you can vary output quality with -qscale:v. Range is 2 (best quality) to 31 (worst quality).

  • You can add -frames:v if you want to limit the number of output files, such as -frames:v 10 for 10 output images.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top