But what use is a list of frame types on its own? You need to know about re-ordering. (And if it's not Blu-ray you need to know even more.)
+ Reply to Thread
Results 31 to 48 of 48
-
-
He's cutting with mkvmerge, not ffmpeg. Maybe he should try ffmpeg
v10 has some changes, might be worth a try repeating the cuts with the newer mkvmerge version
Code:mkvmerge: AVC/h.264 parser: mkvmerge will now drop all frames before the first key frame as they cannot be decoded properly anyway. See #1908.
So what did that mean exactly ? Were there "extra frames" when you cut ? What are those first few seconds referring to ?
Or, if cutting isn't the problem, maybe there is a problem with appending ? For example can you append the cut segments with solveigmm or videoredo ? If those fail then it suggests the problem was indeed with the cutting -
Thanks again guys - really appreciate all the help.
Sneaker I did think of that but unfortunately there is a small rounding error involved (best_effort_timestamp_time is not an exact multiple of 1/23.976) and after a large number of frames I don't think the resulting frame number is reliable. Jagabo, I tried that and it works a treat, thanks. I can get a rough timestamp from the film, divide by the frame duration and round to the nearest integer, and use the closest I frame with a number closest to the result.
I did end up repeating the whole splitting/re-joining process using mkv merge and using ffprobe to analyse the cuts and final product, and it showed something interesting. There are four scenes in the film I wanted to cut out and to do so I entered the start and end timecodes of these scenes in to the "splitting" section of the mkvmerge GUI. I add the 4 raw streams (2 sub, 1 audio, 1 vid) and a chapter file (through the "output" tab) and start the muxing process. This produces 9 mkv files. Parts 2,4,6 and 8 are the mkv files that contain the scenes I wish to cut out, so I delete these files. I then re-open mkvmerge, add the part 1 mkv, and append parts 3,5,7 and 9. This produces the final singular mkv file that has been giving me problems at the join points. There are four join points (part 1 to part 3, part 3 to part 5 etc)
Analysing each of the individual 9 parts as separate parts shows that each one of them starts with an I frame, and ends in a P frame regardless of how long it is. I then analysed the final singular mkv and came across two issues. Firstly, in the process of performing the frame analysis, the ffprobe cmd window returns an error stating:
[h264 @ 00000000011b8a80] co located POCs unavailable
Last message repeated 7 times
The problem seems to have been introduced when splitting with mkvmerge, and compounded upon re-joining the desired parts. Any idea what could be going on specifically? I'm just trying to figure out whether it's worth identifying exactly what mkvmerge is doing to cause the issue to see if a workaround could be done. Otherwise I may just have to give up and either find a tool that will do the job without any issues.
By the way, looking through the frame analysis files I can see many examples of a "B" frame immediately preceding an "I" frame. Is this definitive confirmation that the film uses Open GoP encoding, as there are many examples of frames in one GoP referencing the keyframe for the next one?Last edited by Odaik; 27th Mar 2017 at 21:02.
-
Apologies, looks like there were a few posts since I refreshed the page and I missed these before responding. Will try and reply in a couple of hours.
-
-
As far as I can tell, most of them are like that, yes. Quite a common pattern is two B frames consecutively, then an I frame. An example, in display order, is a B frame with coded number 149, a B frame with coded number 150, and an I frame with coded number 148. From what you've explained, I think this means it is an open GoP blu-ray.
With open GoP, is there any limit to how "far" ahead a B frame can reference information? I know it's unlikely because of the lack of re-usable elements from completely different scenes, but could a B frame technically refer to information in an I frame, say, an hour later in the movie? -
-
-
Ah, I missed the "ahead". Then it's indeed even shorter because of the 3 consecutive bframe limit. So ahead: 3 frames, back: max. 2 seconds.
-
OK, bearing that in mind I went through the list of frame types produced using the command jagabo posted. I looked up the frame numbers roughly corresponding to the timecodes for the "successful" split/join points, and found that at those particular points the I frame is preceded by a P frame, not a B frame. The vast majority of times an I frame appears, the preceding frames are (...BBPBBPBBPBBI). Very occasionally, I find (...BBPBBPBBPBBPI) instead. For every point where a split/re-join hasn't introduced problems, the latter pattern is what I find at the corresponding timecode in the frame analysis.
Therefore, I thought that I could solve the issue by simply going to the frames that corresponded to the timecodes for the split points I am having trouble with, and looking for a few seconds (about 100 frames worth) in either direction to see if I could see the same pattern of frames as above (with a P instead of a B before the I frame). I would then take the frame number of that new keyframe (by looking at the line number in notepad), converting to a timecode, and using that instead in mkvmerge. I found examples within about 4 seconds off of my original cut point, which isn't bad.
My thought was that this particular pattern of frames probably preceded a proper IDR type keyframe, as in the first two out of the four cuts (which were fine) this was the pattern I saw in the text file. Unfortunately I'm still running into issues. I no longer get the video freezing, but there is some "blockiness" for two frames after the split point. I guess managing to cut at a real IDR frame the first couple of times was just a coincidence that I can't replicate for the remaining cut points.
Is there any way to definitively identify IDR type I frames from the text files ffprobe produces? Is there some command I can add to the .bat file? Alternatively, I could just use another program that searches for and recognises IDR frames to cut the video. I did try mkvmerge v10 by the way, but it did not solve the issue. I am trying to using ffmpeg, but can't get my head around the required code for the CLI yet. -
-
On Blu-ray H.264 IDR frame should be if coded picture number matches display number. As you found out and was already said earlier: the re-ordering is important. Just looking at the pattern without thinking about the frame numbers to find out re-ordering you can't be sure e.g. BBPIBB is IDR.
-
From what I can tell, all the I type frames in the log are flagged as key_frame = 1. Is this just a bug or is it simply the case that ffprobe always classes both IDR and non-IDR "i" frames as key frames?
Do you have any suggestions for a commercial stream parser that I could use?
Originally Posted by sneaker
Could it be then that, given the above points, these are actually genuine IDR frames, and there is something wrong with the way mkvmerge is cutting everything for some reason? I know the problem starts at the splitting process, as the analysis of the split mkv files reveals the issue with faulty time codes and coded picture numbers starting at 4 etc.
I'm still trying to wrap my head around using ffmpeg. Unfortunately Avanti GUI doesn't seem to be that intuitive either. Does anyone know what command I have to run to simply split a given mkv file (inc video, audio, and 2 sub streams) at given points, without re-encoding? -
If you were shying away from solveigmm video splitter or videoredo because of the price, you definitely don't want to go this route
Similar Threads
-
MKVToolnix does not SPLIT m4A files by CHAPTERS (srt)
By RedSkyRoad in forum EditingReplies: 6Last Post: 31st Jan 2016, 11:08 -
Split multiple MKV files
By SpartanAlt in forum EditingReplies: 3Last Post: 15th Jul 2015, 18:02 -
Problem with joining 2 mkv files
By lascetic in forum EditingReplies: 7Last Post: 30th Jun 2014, 06:13 -
MKVtoolNix adds audio default duration to MKV files that don't have it
By cal_tony in forum Video ConversionReplies: 6Last Post: 20th May 2013, 21:26 -
What is the best way to split mkv files?
By Han Solo1 in forum Newbie / General discussionsReplies: 13Last Post: 24th Oct 2012, 22:01