How can I detect black frames and add keyframes at the detected black frame in single FFmpeg process?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 5 of 5
Thread
-
-
Many modern codecs detect scene changes on their own if you allow them to manage GOPs freely.
-
-
Do you even know what GOP means? ... Wikipedia: Group of pictures
Modern video formats always have GOPs in any way. Even if they contain only I-frames, then the GOPs are only 1 frame long. Some commercial media formats add restraints, e.g. on a DVD Video or a Blu-ray video, GOPs must not exceed a specific length to allow fast-forward playback and other convenient functions even on a slow-seeking optical medium. But they may be shorter if a scene change is detected.
Video encoders may add a shorter GOP when a scene change is detected in the middle of one. But not all do that, some stubbornly make GOPs of a fixed length no matter which content appears. It may depend on the options how the encoder is set up. The x264 encoder, for example, by default allows the encoding of rather long GOPs, possibly several seconds continuously; if it is set up to encode with Blu-ray compatibility, it restricts GOPs to a maximum of 1 or 2 seconds, depending on some video attributes, but they may still be shorter, when a scene change is detected. This usually happens when the content of the whole video frame changes so much that hardly any similarity to the previous reference frames can be detected, so it would not be efficient to encode that frame as P or B frame (as difference to one or more previously encoded frames). -
Answer is simple - probably you can't perform such functionality in single ffmpeg process - in theory you can try to analyze video for black frames and create list of them then run your favorite codec in 2 pass mode (if your codec support 2 pass or multipass encoding) - if your codec in 2 pass mode can create list of frame types (sort of analysis log) then you may try to modify such list and add some keyframes at desired places...
This is lot of effort and mostly manual as i'm not aware of any automate capable to made this automatically.
Similar Threads
-
Video players that auto-detect black bars and crop the aspect ratio?
By Nerva in forum Software PlayingReplies: 1Last Post: 18th Apr 2023, 18:57 -
DVD Subtitles IDX/SUB Always Black Text with Black Outline in VIDEO_TS
By larrygrobertson in forum Authoring (DVD)Replies: 2Last Post: 23rd May 2022, 13:02 -
Keep Getting Black Frames During Encoding In FlowFrames
By Slam2343 in forum Video ConversionReplies: 1Last Post: 9th May 2022, 02:29 -
How to get rid of a black frame
By bigboreshooter in forum Video ConversionReplies: 3Last Post: 15th Jun 2020, 08:21 -
How to add four black bars
By ucheleuce in forum EditingReplies: 6Last Post: 29th Sep 2019, 13:00