M
M
maaGames2020-01-23 14:05:47
Video
maaGames, 2020-01-23 14:05:47

How to get a movie frame without artifacts?

I get frames from the video using ffmpeg (or rather, MPlayer - The Movie Player), setting a timestamp and saving the frame to a file. In principle, it works, but on some films it turns out to be a daub. At the same time, if you play the video, then everything is normal. It is clear that this is a problem with encoding (decoding) and searching for a key frame.
Can I somehow fix this problem without decoding the entire movie from the beginning to the timestamp?
To get a frame, I use the following list of commands:

L"mplayer.exe -slave \"fullpath.mkv\" -really-quiet -nosound -vo jpeg:outdir=\\\"outpath.jpg\\\" -frames 1 -ss %u"

5e297cadd402d852507803.jpeg
encoder information obtained from MediaInfo.dll

General
Unique ID: 219569894619963036230858554311364138418 (0xA52F9F9D4458C290B00900F3BA9555B2)
Complete name: ivideo\Жан Рено\2005 - Империя волков.mkv
Format: Matroska
Format version: Version 4 / Version 2
File size: 2.39 GiB
Duration: 2 h 8 min
Overall bit rate: 2 662 kb/s
Encoded date: UTC 2015-05-24 0737
Writing application: mkvmerge v7.6.0 ('Garden of Dreams') 64bit built on Feb 8 2015 1344
Writing library: libebml v1.3.1 + libmatroska v1.4.2
Video
ID: 1
Format: AVC
Format/Info: Advanced Video Codec
Format profile: [email protected]
Format settings, CABAC: Yes
Format settings, ReFrames: 5 frames
Codec ID: V_MPEG4/ISO/AVC
Duration: 2 h 8 min
Bit rate: 2 499 kb/s
Width: 1 024 pixels
Height: 432 pixels
Display aspect ratio: 2.40
Frame rate mode: Constant
Frame rate: 23.976 (24000/1001) FPS
Color space: YUV
Chroma subsampling: 4
Bit depth: 8 bits
Scan type: Progressive
Bits/(Pixel*Frame): 0.236
Stream size: 2.24 GiB (94%)
Language: English
Default: Yes
Forced: No
Audio
ID: 2
Format: AAC
Format/Info: Advanced Audio Codec
Format profile: LC
Codec ID: A_AAC
Duration: 2 h 8 min
Bit rate: 160 kb/s
Channel(s): 2 channels
Channel positions: FrontL R
Sampling rate: 48.0 kHz
Frame rate: 46.875 FPS (1024 spf)
Compression mode: Lossy
Stream size: 147 MiB (6%)
Language: Russian
Default: Yes
Forced: No

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-01-23
@trapwalker

Try to pull out not a frame, but a fragment from the video. Empirically, you can choose its length so that the keyframe is guaranteed to hit.
From the cut fragment, already saved without compression, you can get the last frame by a separate call to ffmpeg.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question