News:

--

Main Menu

log2MaxPocLsb (SPS mismatch while appending)

Started by douche, June 07, 2023, 08:37:15 PM

Previous topic - Next topic

douche

Hi there,
I'm trying to append a video file. Both input and output is .mkv (same resolution, same ref frames, same framerate, etc.).
Avidemux warns me with:
"Codec or codec settings across cut point do not match. Playback of the video saved in copy mode may stop at this point. Do you want to continue anyway?"

The log file looks like this:
[HandleAction] 19:53:57-777 ************ SAVE_VIDEO **************
[dxvaRender::draw] 19:53:58-101 D3D : Draw!
[dxvaRender::refresh] 19:53:58-101 Refresh**
[admSaver::admSaver] 19:54:02-693 [Save] Encoder index=0
[admSaver::save] 19:54:02-693 Audio starting time 00:00:00,000
[admSaver::save] 19:54:02-693 [A_Save] Saving..
[ADM_Composer::checkCutsAreOnIntra] 19:54:02-693 Checking cuts start on keyframe..
[ADM_Composer::switchToSegment] 19:54:02-693 Trying to switch to seg 1 with startTime in reference pic= 42 ms
[ADM_Composer::seektoTime] 19:54:02-693 Seeking to a keyframe at 00:00:00,042
[ADM_Composer::seektoTime] 19:54:02-693 Seeking to frame 0 at 00:00:00,042
[ADM_Composer::seektoTime] 19:54:02-693 Seek to time without decoding ok
[ADM_Composer::switchToSegment] 19:54:02-693 Switched ok to segment 1 (dontdecode=1)
[checkCodec] 19:54:02-693 Codecs identified by isH264Compatible() as matching
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-693 seg 1: ref 1, refDTS=0
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-693 seg 1: ref 1, imgDTS=0
[extractSPSInfo_mp4Header] 19:54:02-693 Parser created
[extractSPSInfo_mp4Header] 19:54:02-693 Codec created
[extractSPSInfo_mp4Header] 19:54:02-693 Context created, ticks_per_frame = 2
Used bytes 0/46 (+5)
[extractSPSInfo_mp4Header] 19:54:02-693 Width2 : 1920
[extractSPSInfo_mp4Header] 19:54:02-693 Height2: 1080
[extractSPSInfo] 19:54:02-693 width:1920
[extractSPSInfo] 19:54:02-693 height:1080
[extractSPSInfo] 19:54:02-693 fps1000:23976
[extractSPSInfo] 19:54:02-693 hasStructInfo:0
[extractSPSInfo] 19:54:02-693 hasPocInfo:1
[extractSPSInfo] 19:54:02-693 CpbDpbToSkip:0
[extractSPSInfo] 19:54:02-693 log2MaxFrameNum:4
[extractSPSInfo] 19:54:02-693 log2MaxPocLsb:5
[extractSPSInfo] 19:54:02-693 frameMbsOnlyFlag:1
[extractSPSInfo] 19:54:02-693 darNum:1
[extractSPSInfo] 19:54:02-693 darDen:1
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-693 Checking for in-band SPS...
[ADM_Composer::getOpenGopDelayForSegment] 19:54:02-693 Pts delta = 125125
[ADM_Composer::getOpenGopDelayForSegment] 19:54:02-693 Pts delta = 41708
[ADM_Composer::getOpenGopDelayForSegment] 19:54:02-693 Pts delta = 83416
[ADM_Composer::getOpenGopDelayForSegment] 19:54:02-693 Not a bframe, stopping (4)
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-693 Getting previous segment, current segment number: 1
[ADM_Composer::switchToSegment] 19:54:02-693 Trying to switch to seg 0 with startTime in reference pic= 42 ms
[ADM_Composer::seektoTime] 19:54:02-693 Seeking to a keyframe at 00:00:00,042
[ADM_Composer::seektoTime] 19:54:02-693 Seeking to frame 0 at 00:00:00,042
[ADM_Composer::seektoTime] 19:54:02-693 Seek to time without decoding ok
[ADM_Composer::switchToSegment] 19:54:02-693 Switched ok to segment 0 (dontdecode=1)
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-693 Switched to segment 0
[ADM_Composer::getFrameNumFromPtsOrBefore] 19:54:02-693 Best candidate for time 00:05:14,731 in reference is frame 7543
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-693 In-band SPS before and after the cut point does not match? Checking deeper...
[extractSPSInfo_mp4Header] 19:54:02-693 Parser created
[extractSPSInfo_mp4Header] 19:54:02-693 Codec created
[extractSPSInfo_mp4Header] 19:54:02-693 Context created, ticks_per_frame = 2
Used bytes 0/44 (+5)
[extractSPSInfo_mp4Header] 19:54:02-693 Width2 : 1920
[extractSPSInfo_mp4Header] 19:54:02-693 Height2: 1080
[extractSPSInfo_mp4Header] 19:54:02-693 Parser created
[extractSPSInfo_mp4Header] 19:54:02-694 Codec created
[extractSPSInfo_mp4Header] 19:54:02-694 Context created, ticks_per_frame = 2
Used bytes 0/51 (+5)
[extractSPSInfo_mp4Header] 19:54:02-694 Width2 : 1920
[extractSPSInfo_mp4Header] 19:54:02-694 Height2: 1080
[extractSPSInfo] 19:54:02-694 width:1920
[extractSPSInfo] 19:54:02-694 height:1080
[extractSPSInfo] 19:54:02-694 fps1000:23976
[extractSPSInfo] 19:54:02-694 hasStructInfo:1
[extractSPSInfo] 19:54:02-694 hasPocInfo:1
[extractSPSInfo] 19:54:02-694 CpbDpbToSkip:22
[extractSPSInfo] 19:54:02-694 log2MaxFrameNum:4
[extractSPSInfo] 19:54:02-694 log2MaxPocLsb:4
[extractSPSInfo] 19:54:02-694 frameMbsOnlyFlag:1
[extractSPSInfo] 19:54:02-694 darNum:0
[extractSPSInfo] 19:54:02-694 darDen:1
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-694 log2MaxPocLsb value does not match.
[ADM_Composer::checkSegmentStartsOnIntra] 19:54:02-694 SPS mismatch, saved video will be broken.


Apparently I get "log2MaxPocLsb:5" once and further down "log2MaxPocLsb:4".
What exactly is "log2MaxPocLsb" and how can I re-encode the appendable file so the value is the same (no mismatch)?

Thanks in advance!
Greets

sark

#1
Quote from: douche on June 07, 2023, 08:37:15 PMHi there,
Both input and output is .mkv (same resolution, same ref frames, same framerate, etc.).

That represents only a small part of the various parameters a file can contain. In my experience, only files encoded with the same application and settings will successfully, and reliably concatenate in Copy mode.

Quote from: douche on June 07, 2023, 08:37:15 PMhow can I re-encode the appendable file so the value is the same (no mismatch)?

If you're happy to re-encode it should be possible to append both files in Avidemux. Trying to match one file to another is likely to be a fruitless task.

douche

#2
Quote from: sark on June 08, 2023, 09:37:41 AMThat represents only a small part of the various parameters a file can contain. In my experience, only files encoded with the same application and settings will successfully, and reliably concatenate in Copy mode.
True. I hoped it'd be enough already :)

The two files haven't been encoded with the same program (1st: DVDFab 9.1.5.6 / 2nd: Handbrake 1.6), I believe that is the reason for the mismatch (maybe difference in AVC encoders?).
I could post the media info summaries, the ffprobe log or anything else if it helps. But first I need someone with an explanation of what the error means in the first place otherwise I don't even know what to look for.

Quote from: sark on June 08, 2023, 09:37:41 AMIf you're happy to re-encode it should be possible to append both files in Avidemux. Trying to match one file to another is likely to be a fruitless task.
I don't really want to encode both of them. Can't I just encode the 2nd file with the encoding settings of the 1st file (in order to get a SPS match)?
There is only one error, it must be possible to overcome that right?

I'm downloading DVDFab now, maybe encoding the file with DVDFab this time helps to understand the differences. I will post the results tomorrow.

sark

#3
Quote from: douche on June 08, 2023, 01:58:44 PMCan't I just encode the 2nd file with the encoding settings of the 1st file (in order to get a SPS match)?

Should work, yes. (If both encoded with DVDFab). It,s just a case of what were the encoding settings of the first file.
I suspect using DVDFab with the primary settings you are aware of may result in a file that will better match than one encoded with Handbrake.

I use ffmpeg when Avidemux lacks a filter I need. Even though Avidemux is ffmpeg based, there is no guarantee ffmpeg files will concat with Avidemux encoded files. I,m sure it,s possible, with enough settings, but I just output a lossless file from ffmpeg and re-encode in Avidemux before concatenating. I,m convinced this is a more reliable method.

Also,  I,ve personally never had an issue with re-encoding. It is often less a quality issue, but one of encoding time with larger files.

eumagga0x2a

I think the warning about SPS mismatch mentions just the very first mismatched parameter (even within the small subset of parameters Avidemux bothers to check, there are at least 5 which are different in this case) because a single one is enough to make it impossible to merge such videos in copy mode as for compatibility both SPS must match perfectly, bit for bit.

log2MaxPocLsb describes how high the least significant bit (LSB) part of picture order (POC) count may get before it wraps around.

If both H.264 videos were created by x264 and at least one contains a SEI message with encoder parameters, it might be worth trying to re-encoder the other one using these parameters. If SPS is all you have, Avidemux (at least Avidemux) cannot reverse-engineer encoder settings necessary to end up with a H.264 stream referencing the very same SPS. In this case re-encoding the output is the only option.

douche

#5
Quote from: sark on June 08, 2023, 05:46:31 PMShould work, yes. (If both encoded with DVDFab). It,s just a case of what were the encoding settings of the first file. I suspect using DVDFab with the primary settings you are aware of may result in a file that will better match than one encoded with Handbrake.
Agreed. Unfortunately I don't get DVDFab to do what I want it to do.
It doesn't matter what parameters I enter, they will be just ignored by the encoder.
Even looked up the syntax on the forum. My parameters look like that:
[x264 --ref 2 --bframes 0 -o]
also tried: [x264 --preset faster] <- which should result in 2 ref frames
but they are simply ignored by the encoder. No matter what parameters I enter, the result will always be "CABAC / 1 Ref Frame" which of course is totally wrong in the first place. I can't append anything with that.

Does anyone in here know why my parameters are beeing ignored by the program even when applying the correct syntax?
If it isn't my fault, the program sucks big time.

Quote from: eumagga0x2a on June 08, 2023, 06:06:44 PMlog2MaxPocLsb describes how high the least significant bit (LSB) part of picture order (POC) count may get before it wraps around.

If both H.264 videos were created by x264 and at least one contains a SEI message with encoder parameters, it might be worth trying to re-encoder the other one using these parameters. If SPS is all you have, Avidemux (at least Avidemux) cannot reverse-engineer encoder settings necessary to end up with a H.264 stream referencing the very same SPS. In this case re-encoding the output is the only option.
Thanks a lot for the detailed explanation. If it doesn't work with DVDFab I will give up, simply re-encoding everything.

sark

#6
Quote from: sark on June 08, 2023, 09:37:41 AMTrying to match one file to another is likely to be a fruitless task.

As previously stated, if you don,t know the exact encoding parameters of one file, trying to match by reverse engineering is going to be a struggle. I would just re-encode the two files and save yourself the aggravation.

Sorry, no experience with DVDFab . Wouldn't, be my first choice unless working with DVD content.

douche

Quote from: sark on June 09, 2023, 10:25:49 PMAs previously stated, if you don,t know the exact encoding parameters of one file, trying to match by reverse engineering is going to be a struggle. I would just re-encode the two files and save yourself the aggravation.
Ye I know. But it was worth a shot. With a little bit of luck the encoding could have ended up a "CABAC / 2 Ref Frames" with a matching SPS since the encoding program is the same now (DVDFab). Although that beeing a long shot.
Anyhow, I guess it just wasn't meant to be. I will re-encode everything now, which will definitely solve the problem. Thanks for the help though.