Main Menu

"Dead" keyframes in mp4 cut

Started by harrym, April 10, 2016, 11:22:02 AM

Previous topic - Next topic


I am using Avidemux for postprocesing cuts at ffmpeg mp4 videos. But i have problem, that some keyframes are unusable for cutting. If I cut video at this dead keyframe, video is freezing (audio is going on) at least to the first usable(?) keyframe. it is very irreteable. I must forcely recut the video on another keyframe. :'(

Jan Gruuthuse

You're saying plenty and not providing info at all?
Provide (upload)  a small sample of video, give time index of this dead key frame. (10 seconds video duration would probably do)
- used avidemux? version, 32 or 64 bit, if nightly: revision (ryymmdd)?
- what should we understand with "ffmpeg mp4 videos"?
- ...

ps:- Use a free dropbox account, mega or similar webservice (free public access, without registration to download your uploaded video) thank you.[/quote]


Are you putting h.264 in MP4?

In H.264, the frame can be segmented into sequences of macroblocks called slices.
These slice sequences can be independently processed (multi threading!).

I wonder if these I/Idr frames are actually B frames with an Intra slice?


I also have encountered a problem which may be related. When cutting mp4 in copy mode to I frames, the video between the first I frame and second I frame appears as black video. It doesn't happen with every video (I may just have been lucky in selecting the position of a first cut) but it does happen repeatedly, if the same cut is repeated at the same place. If a different I frame is chosen, for the first cut, in the same video, the black frames may or may not be present. If I move the edit forward to the next I frame (were the video starts after the black frames) and make the first cut, no black frames occur.
The same thing often occurs when editing DVB-T in MKV mode.
v2.6.12 64bit is the first version this has occurred in my case, I didn't try v2.6.11.
The same edits using Machete are fine. I have tried playing the edited video in various players and the black video is present in all the players.


you have to cut first between I frames to create a smaller file , may be something of 5 mns from a 60 minutes one .
then you reuse this part and select the frames you want , then you recompile the video and you will be able to append it to others files you made like that : the files being recompiled again to create a movie .
beware of the audio ac3 codec . i have good result to recompile it in aac and some bugs with the ac3 .
the best is to compile in aac and at end to create an ac3 if you have some hardware decoding it , like a creative labs card


I have been doing something similar. Because I have Machete (I don't like using it because it is unresponsive) If my first cut gives the black frames, I simply move to the next I frame and start there. I then cut the short start section with Machete and append on to the main file with Avidemux.
Strange thing is, the problem only seems to happen on the first cut and not every I frame but I think, alternate I frames, depending on which is chosen as the first cut. Every other cut in the file is fine.
It is interesting that you seem to suspect the audio may be causing a problem, I have be using copy for audio as I usually do. I will try re encoding the audio to see if that has an effect.


I have gone back to v2.6.10, the last version I've used and the problem is gone.


If you had a reproducible test case, that would help
(including files)


The files are nothing unusual, just some mp4 files and DVB-T HD files of the type I have been editing in copy mode for quite a few years. I have just started noticing the problem after installing v2.6.12. I didn't try v2.6.11. It may well be at my end if no one else is seeing the problem.
Thanks for the great work on this software by the way, I have got a lot of use out of it over the years.


After a few weeks using v2.6.10, I decided to give v2.6.12 another try. When I un installed v2.6.10 I noticed that the v2.6.10 files were still in the Avidemux folder so I deleted them before installing v2.612. After about 2 weeks there has been no problem with black frames at the start of edited video files.

EDIT. False alarm, I am still seeing the black frames issue at the start of some edits.


Is this problem solved? It is very frustrating... :(



Quote from: mean on July 23, 2016, 08:57:13 AM
Did you provide a test case ?

00:01:02.920 - good I-frame
00:01:03.960 - dead I-frame
00:01:11.400 - dead I-frame

The test case was created on Windows 10 64bit by-
ffmpeg.exe -i "%%a" -vf "scale=0:400" -sws_flags lanczos -c:v libx264 -aspect "16:9" -preset slower -crf 23 -c:a aac -b:a 64k -ss "01:00" "%%~na.mp4"

ffmpeg version N-81118-gfb91850 gcc 5.4.0


does not seem to be easy to reproduce, might have been fixed
Can you try with a nightly ?


Quote from: mean on July 30, 2016, 07:50:33 PM
does not seem to be easy to reproduce, might have been fixed
Can you try with a nightly ?

It seems that the problem is solved