codec setting across a cut point do not match - any debug log?

Started by johnvid, April 06, 2023, 04:25:20 PM

Previous topic - Next topic

johnvid

Hi all,

Using Avidemux 2.7.6 on Windows 10 x64. I have about 10 videos, all from an iPad, all h265 @ 1920x1080. I had to re-encode one of them after cropping it, then resizing it to the same 1920x1080. Mediainfo seems to show pretty much the same codec params (pasted below), minor differences which.

I attempted to concatenate via "copy" the reencoded one with an original iPad one (mediainfo codec settings of the two videos below), and avidemux complains that codec settings across a cut point do not match. Indeed if I choose to continue, playback is garbled after the concatenation point.

I know I can reencode the whole thing, but I'd rather keep the original quality of all videos and save time re-encoding too.

My question: Can I activate debug logging or verbose output or something in Avidemux, to see exactly what codec params it doesn't like, and perhaps be able to edit them without re-encoding?

I'm aware it's a long shot... if the above isn't possible, then I'd be grateful for other ideas that either avoids reencoding, or can reencode fast enough and without losing quality or add to file size

vid1 (which was cropped, resized back to 1920x1080, and reencoded):
Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L4@Main
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 8 s 542 ms
Bit rate                       : 12.8 Mb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Variable
Frame rate                     : 30.088 FPS
Minimum frame rate             : 28.571 FPS
Maximum frame rate             : 600.000 FPS
Original frame rate            : 30.125 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Bits/(Pixel*Frame)             : 0.205
Stream size                    : 13.0 MiB (99%)
Writing library                : x265 3.4:[Windows][MSVC 1925][64 bit] 8bit
Encoding settings              : cpuid=1049583 / frame-threads=3 / numa-pools=8 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x1080 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=20 / lookahead-slices=6 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=1 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=3 / selective-sao=4 / early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=cqp / qp=19 / ipratio=1.40 / pbratio=1.30 / aq-mode=0 / aq-strength=0.00 / no-cutree / zone-count=0 / no-strict-cbr / qg-size=64 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.01 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0
Codec configuration box        : hvcC

vid2 (original from the iPad):
Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L4@Main
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 8 s 644 ms
Bit rate                       : 7 551 kb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Variable
Frame rate                     : 30.081 FPS
Minimum frame rate             : 28.571 FPS
Maximum frame rate             : 600.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Bits/(Pixel*Frame)             : 0.121
Stream size                    : 7.78 MiB (99%)
Color range                    : Limited
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.709
Codec configuration box        : hvcC

eumagga0x2a

Quote from: johnvid on April 06, 2023, 04:25:20 PMUsing Avidemux 2.7.6 on Windows 10 x64.

Totally unsupported ancient version. Only latest 2.8.2 nightly builds and formally the last release 2.8.1 are supported. However, all issues with the release need to be verified against the latest nightly --> using the latest nightly right away makes more sense and provides the best experience.

Quote from: johnvid on April 06, 2023, 04:25:20 PMMy question: Can I activate debug logging or verbose output or something in Avidemux, to see exactly what codec params it doesn't like, and perhaps be able to edit them without re-encoding?

You (almost for sure) won't be able to fix this without re-encoding, but admlog.txt in %localappdata%\avidemux from loading / appending the videos dumps codec extradata which must match perfectly byte for byte in order to be able to merge videos in copy mode.


johnvid

Tested in 2.8.1 and got the same results.

Quotecodec extradata which must match perfectly byte for byte in order to be able to merge videos in copy mode

I kind of expected that was the case. However, is there a way I could either strip some irrelevant codec extradata (e.g. "writing library") to make them match and use copy mode? or conversely, add extradata to videos that lack it? Would be nice if Avidemux did that on the fly (ignore and strip irrelevant codec extradata entries to see if copy mode can be used) but happy to do it manually if there is a way

eumagga0x2a

Quote from: johnvid on April 10, 2023, 01:46:48 PMis there a way I could either strip some irrelevant codec extradata (e.g. "writing library")

Neither writing library info in container metadata nor x264 / x265 encoder parameters (the latter are optionally inserted into video stream as a SEI message) have anything to do with codec extradata. Codec extradata (actually, each bit of it) explains a decoder how to interpret else completely opaque compressed frames in video stream. The part of extradata which contains VUI (video usability information like pixel aspect ratio, colorspace and HDR-related info etc) is indeed not required for being able to decode video frames, but, unless VUI is bogus anyway, it gives a video player important clues how to display the video.

Quote from: johnvid on April 10, 2023, 01:46:48 PMis there a way I could [...] add extradata to videos that lack it?

A HEVC or H.264 video lacking extradata (in-band or out-of-band) is in general just (a lot of) binary garbage and therefore useless.