Encoding movie file with exact settings of existing file (question for experts)

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Description of problem or question:
Hi there,
I want to append a movie to another movie inside AviDemux (which means copy-mode, lossless).
Before I can do that, the two files have to be similar, otherwise I will get the error:
"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?"

These are the two files (see attachments below for screenshots of media info in german):
1. h.264, 8 bits (mkv) <- original file ('1st file' from now on)
2. h.265 10 bits (mkv) <- file to append ('2nd file' from now on)
-> I used ffprobe to analyze the two files. I add the results of both files to the end of this post (see below)

The obvious first:
- of course the two files have to be encoded with the same codec, so I've tried to encode the 2nd file file to h.264 8 bits (not able to append yet)
- then I've tried different encoding settings (like: (cfr vs vfr) / (cqp vs vbr) / different GOP settings (ref / m / n values) / different presets (but still not appendable yet)
- after that I've tried to encode the file with another program (XMediaRecode) with similar settings (still not appendable)
- one option I haven't tried is trying to encode the file with the same (old) libraries libebml v.0.7.8 / libmatroska v.0.8.1 but I wouldn't even know how to do this, since handbrake automatically uses the most recent encoder libraries (which of course makes a lot of sense)

If only I'd knew what exact difference is causing the mismatch while appending but my knowledge isn't big enough to answer that.
Is it the difference in GOP or ref frames? In the used encoder library? Something else I'm missing?
Thats why I'm asking the experts in here. Can you tell me what encoder settings is causing the problem? And how can I encode the 2nd file so it will be exactly the same as the first file in terms of encoder settings and therefore easily appendable?

HandBrake version (e.g., 1.0.0):
1.6.1 (2023012300)

Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Win 10 x64 19045.2965

1st file (h.264) ffprobe:
# ffprobe output

[streams.stream.0]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1920
height=1080
coded_width=1920
coded_height=1088 <- MediaInfo says 1080 here, not sure why ffprobe disapproves
has_b_frames=1
sample_aspect_ratio=1\:1
display_aspect_ratio=16\:9
pix_fmt=yuv420p
level=40
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=651/31250000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A

[streams.stream.0.disposition]
default=1
dub=0
original=0
comment=0
lyrics=0
karaoke=0
forced=0
hearing_impaired=0
visual_impaired=0
clean_effects=0
attached_pic=0
timed_thumbnails=0

[format]
filename=DELETED
nb_streams=2
nb_programs=0
format_name=matroska,webm
format_long_name=Matroska / WebM
start_time=0.000000
duration=314.689379
size=515336865
bit_rate=13100839
probe_score=100

[format.tags]
title=DELETED
encoder=libebml v0.7.8 + libmatroska v0.8.1
creation_time=2014-08-23T02\:03\:37.000000Z

------------------------------------------------------------------------------------------------------------------------------------------------

2nd file (h.265) ffprobe:
# ffprobe output

[streams.stream.0]
index=0
codec_name=hevc
codec_long_name=H.265 / HEVC (High Efficiency Video Coding)
profile=Main 10
codec_type=video
codec_time_base=1001/24000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1920
height=1080
coded_width=1920
coded_height=1088 <- MediaInfo says 1080 here, not sure why ffprobe disapproves
has_b_frames=1
sample_aspect_ratio=1\:1
display_aspect_ratio=16\:9
pix_fmt=yuv420p10le
level=123
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=unspecified
field_order=unknown
timecode=N/A
refs=1
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A

[streams.stream.0.disposition]
default=1
dub=0
original=0
comment=0
lyrics=0
karaoke=0
forced=0
hearing_impaired=0
visual_impaired=0
clean_effects=0
attached_pic=0
timed_thumbnails=0

[streams.stream.0.tags]
language=eng
BPS-eng=6721213
DURATION-eng=00\:05\:12.854000000
NUMBER_OF_FRAMES-eng=7501
NUMBER_OF_BYTES-eng=262844810
_STATISTICS_WRITING_APP-eng=mkvmerge v35.0.0 ('All The Love In The World') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng=2019-08-01 20\:28\:45
_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

[format]
filename=DELETED
nb_streams=8
nb_programs=0
format_name=matroska,webm
format_long_name=Matroska / WebM
start_time=0.000000
duration=312.897000
size=387671831
bit_rate=9911806
probe_score=100

[format.tags]
encoder=libebml v1.3.9 + libmatroska v1.5.2
creation_time=2019-08-01T20\:28\:45.000000Z
Attachments
01_1st_file_(h264).jpg
01_1st_file_(h264).jpg (153.55 KiB) Viewed 5134 times
02_2nd_file_(h265).jpg
02_2nd_file_(h265).jpg (143.63 KiB) Viewed 5134 times
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

Are you only re-encoding the second file? Depending on what AviDemux is looking for it'll probably be easier/necessary to re-encode both.

What's the final output container format? Might be easier to not use AviDemux.
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

Re: coded height, does MediaInfo ever report coded height? If it does, 1080 is definitely wrong, you cannot have an H.264 or HEVC bitstream with a coded height of 1080. You're might be confusing with display height ("height"), for which ffprobe agrees that it's 1080.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Rodeo wrote: Tue Jun 06, 2023 10:05 pm Are you only re-encoding the second file? Depending on what AviDemux is looking for it'll probably be easier/necessary to re-encode both.
What's the final output container format? Might be easier to not use AviDemux.
Well, the 1st file is only a representation. The truth is, I've got 12 files I will be joining/appending together.
11 files are like the 1st file (h.264) and only 1 file is h.265, so it makes sense to encode only the one file that is different than all the others.
And I don't really want to encode all 12 files again only for 1 problematic file.
The final output container will be .mkv, too (same as source). AviDemux usually is the best option to join multiple files together. MKVToolnix sometimes works as well, but normally AviDemux is more reliable. Besides those, I don't know any other options for losslessly appending files.
I will make some further tests and share the log file of AviDemux here. I found some curious stuff in there but it requires further testing first.
Rodeo wrote: Tue Jun 06, 2023 10:08 pm Re: coded height, does MediaInfo ever report coded height? If it does, 1080 is definitely wrong, you cannot have an H.264 or HEVC bitstream with a coded height of 1080. You're might be confusing with display height ("height"), for which ffprobe agrees that it's 1080.
Yeah, that was my bad. I wanted to edit my post when I realized it but it was already too late. I just mixed up the two values, so all fine there.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

I've made some further tests and I think I found the problem but not the solution.
I encoded the file with different settings but the result has always been the same.
Comparing the log files (AviDemux) of the working file with the not working files gives me this:

Comparing the log files of AviDemux inside Notepad++ with built in compare function:

Not appendable/not working file:
"
[ADM_Composer::checkSegmentStartsOnIntra] 18:50:08-808 log2MaxPocLsb value does not match.
[ADM_Composer::checkSegmentStartsOnIntra] 18:50:08-808 refFrames value does not match.
[ADM_Composer::checkSegmentStartsOnIntra] 18:50:08-808 SPS mismatch, saved video will be broken.
"
while appendable/working file states at the same line of code inside the log:
"
[ADM_Composer::checkSegmentStartsOnIntra] 18:45:56-117 Checking for in-band SPS...
[ADM_Composer::getOpenGopDelayForSegment] 18:45:56-117 Pts delta = 125125
[ADM_Composer::getOpenGopDelayForSegment] 18:45:56-117 Pts delta = 41708
[ADM_Composer::getOpenGopDelayForSegment] 18:45:56-117 Pts delta = 83416
[ADM_Composer::getOpenGopDelayForSegment] 18:45:56-117 Not a bframe, stopping (4)
[ADM_Composer::checkSegmentStartsOnIntra] 18:45:56-117 Getting previous segment, current segment number: 1
[ADM_Composer::switchToSegment] 18:45:56-117 Trying to switch to seg 0 with startTime in reference pic= 42 ms
[ADM_Composer::seektoTime] 18:45:56-117 Seeking to a keyframe at 00:00:00,042
[ADM_Composer::seektoTime] 18:45:56-117 Seeking to frame 0 at 00:00:00,042
[ADM_Composer::seektoTime] 18:45:56-117 Seek to time without decoding ok
[ADM_Composer::switchToSegment] 18:45:56-117 Switched ok to segment 0 (dontdecode=1)
[ADM_Composer::checkSegmentStartsOnIntra] 18:45:56-117 Switched to segment 0
[ADM_Composer::getFrameNumFromPtsOrBefore] 18:45:56-117 Best candidate for time 00:05:14,731 in reference is frame 7543
[ADM_Composer::checkSegmentStartsOnIntra] 18:45:56-117 IDR verified, ref videos are different but probably compatible.
"

After doing some research online on SPS mismatch in AviDemux I found this link:
https://avidemux.org/smif/index.php?topic=19071.0

"If a H.264 stream was produced with libx264, it is very likely that a SEI message with x264 encoder parameters is present in the first access unit of the stream. When saving in copy mode not from the first keyframe of a video, Avidemux looks for this SEI message and injects it into the stream as FFmpeg uses it to apply some quirks: https://github.com/mean00/avidemux2/blo ... jector.cpp
This info might allow to fine-tune x264 to produce compatible output."

-> So I guess we found our culprit: the ref frames a.k.a. B-frames if I'm not mistaken.
In other words:
- this is the current status: "CABAC / 4 Ref Frames"
- this is my goal: "CABAC / 2 Ref Frames"

What settings will make sure I will get 2 Ref Frames after encoding?
Right now every preset (VERYFAST; FASTER; FAST; SLOW) will result in 4 Ref frames, although the list of encoding parameters (inside Handbrake parameter window, while hovering over) says: ref=2 (at least for the presets FAST and FASTER).
So I guess the ref frame / b-frame parameter is overwritten by other settings, but I can't tell which one it is.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I didn't find a way inside Handbrake so I consulted XMediaRecode again, where you can set the exact number of b-frames (why doesn't Handbrake have this neat feature?).
After encoding I finally get the CABAC / 2 Ref Frames.
But the file still isn't appendable.

Logfile:
[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.


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Finally I got rid of the line: [ADM_Composer::checkSegmentStartsOnIntra] 18:50:08-808 refFrames value does not match.
That leaves me with "log2MaxPocLsb value does not match"

I couldn't find anything online so what is that and how do I fix it?
Any help or should I give up at this point?
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

"ref=2:bframes=0" without quotes in advanced settings box.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Rodeo wrote: Wed Jun 07, 2023 8:37 pm "ref=2:bframes=0" without quotes in advanced settings box.
A little inconvenient but thanks.
I wish there was an additional tab "Advanced Settings" inside Handbrake but ok. At least it works this way, I get "CABAC / 2 Ref Frames" after encoding.

However while appending this new file it adds another line to the logfile of AviDemux:
[ADM_Composer::checkSegmentStartsOnIntra] 20:49:49-921 hasPocInfo value does not match.

That didn't happen with the encoded file of XMediaRecode.
I'm not quite sure what it means but it is strange that it occurs only while encoding with Handbrake in the first place.

You got anything on the "log2MaxPocLsb mismatch"?
I posted the problem on the avidemux forum as well, maybe they have further intel on that.
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

For hasPocInfo, maybe "fake-interlaced=1" without quotes, don't forget to add a colon to separate from other options.

Honestly, it really would be easier to combine everything with e.g. mkvmerge and re-encode the whole file to make sure everything is clean.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Rodeo wrote: Wed Jun 07, 2023 8:58 pm For hasPocInfo, maybe "fake-interlaced=1" without quotes.
Encoded it again with your suggested parameters "ref=2:bframes=0:fake-interlaced=1" (other settings remained the same):
Still same error, that wasn't it.
-> [extractSPSInfo] 21:06:33-646 hasPocInfo:0
and further down the log file:
-> [extractSPSInfo] 21:06:33-646 hasPocInfo:1
-> result: mismatch
Rodeo wrote: Wed Jun 07, 2023 8:58 pm Honestly, it really would be easier to combine everything with e.g. mkvmerge and re-encode the whole file to make sure everything is clean.
Ye that of course is a possibility, but I see it as a last resort.
I would like to learn something new here in order to prevent that stuff from happening in the future.
Simply re-encoding seems like the cheap solution here :D
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

Forget fake-interlaced, the H.264 appears to be progressive. You could try pic-struct=1 instead. And also min-keyint=3:keyint=15 (to match the GOP limits of the other bitstream).

Looking at the MediaInfo of the first file, it looks like it was encoded with DVDFab which may not have used x264 to do so (the GOP settings used would be very atypical for x264 encodes). Thus it may simply be entirely impossible to provide a file with an identical/compatible SPS altogether.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Rodeo wrote: Thu Jun 08, 2023 8:00 am Forget fake-interlaced, the H.264 appears to be progressive. You could try pic-struct=1 instead. And also min-keyint=3:keyint=15 (to match the GOP limits of the other bitstream).
Yes it already is progressive. But still same errors after new encoding (ref=2:bframes=0:pic-struct=1:min-keyint=3:keyint=15):
[ADM_Composer::checkSegmentStartsOnIntra] 14:19:11-644 hasPocInfo value does not match.
[ADM_Composer::checkSegmentStartsOnIntra] 14:19:11-644 log2MaxPocLsb value does not match.
[ADM_Composer::checkSegmentStartsOnIntra] 14:19:11-644 SPS mismatch, saved video will be broken.
Rodeo wrote: Thu Jun 08, 2023 8:00 am Looking at the MediaInfo of the first file, it looks like it was encoded with DVDFab which may not have used x264 to do so (the GOP settings used would be very atypical for x264 encodes). Thus it may simply be entirely impossible to provide a file with an identical/compatible SPS altogether.
Ye it could be a h.264 vs. x264 issue.
I will rest the case for now. Maybe someone will come up with a new idea in the future. Thanks anyway for the help!
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

While it's "only" semantics: x264 creates H.264 bitstreams, there is no such thing as "h.264 vs. x264"; the case here is "x264 vs. <whatever encoder was used by DVDFab>" where both are h.264 encoders.

Given the results of that last test, I am 99.9% confident that DVDFab did indeed not use x264 for the file you're trying to append to; chances of success producing a compatible SPS and PPS are close to zero (unless you feel like spending hours parsing your source's SPS and PPS and modifying x264's source code accordingly).
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Rodeo wrote: Thu Jun 08, 2023 2:54 pm While it's "only" semantics: x264 creates H.264 bitstreams, there is no such thing as "h.264 vs. x264"; the case here is "x264 vs. <whatever encoder was used by DVDFab>" where both are h.264 encoders.
MediaInfo clearly states: AVC (Advanced Video Codec) so it can only be either h.264 or x264. I think no other codec would be labeled as AVC or would it? With a few exceptions for video proprietary camera codecs (Panasonic, etc.) and some other exotic software encoders (OpenH264, QuickTimeEncoder, Nero, etc.).
Rodeo wrote: Thu Jun 08, 2023 2:54 pm Given the results of that last test, I am 99.9% confident that DVDFab did indeed not use x264 for the file you're trying to append to; chances of success producing a compatible SPS and PPS are close to zero (unless you feel like spending hours parsing your source's SPS and PPS and modifying x264's source code accordingly).
What codec could DVDFab have been using then instead? Most likely not x264, since MediaInfo would list that. But what else then?
I'm downloading DVDFab as we speak. Maybe I will find out what the program does differently by encoding the file with DVDFab this time.
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

justincase wrote: Thu Jun 08, 2023 3:13 pm
Rodeo wrote: Thu Jun 08, 2023 2:54 pm While it's "only" semantics: x264 creates H.264 bitstreams, there is no such thing as "h.264 vs. x264"; the case here is "x264 vs. <whatever encoder was used by DVDFab>" where both are h.264 encoders.
MediaInfo clearly states: AVC (Advanced Video Codec) so it can only be either h.264 or x264.
It's not either/or. x264 is an h.264 encoder, period. x264 produces h.264 bitstreams. x264 is not a video format, it's just an encoder among dozens of other h.264 encoders out there.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

Rodeo wrote: Thu Jun 08, 2023 3:23 pm It's not either/or. x264 is an h.264 encoder, period. x264 produces h.264 bitstreams. x264 is not a video format, it's just an encoder among dozens of other h.264 encoders out there.
ok I see. The DVDFab documentation states:
"Derzeit sind Software, CUDA und Intel Quick Sync sowohl für H.264 als auch für H.265 Videoquellen verfügbar."
-> "Currently available encoders: Software, CUDA, Intel Quick Sync (for both h.264 as well as h.265 material)"

So I guess it was the CUDA encoder, since MediaInfo says so?
I will post the result of the DVDFab encoding tomorrow. Maybe this will shed some light on it.
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

Could be using their software encoder too. But it doesn't have to be x264.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

I tried to encode the file with DVDFab this time.
Unfortunately the program kinda sucks. It completely ignores my parameters.
[x264 --ref 2 --bframes 0 -o] (not working)
[x264 --preset faster -o] <- which should result in 2 ref frames (not working)

No matter what parameters I enter, the result will always be "CABAC / 1 Ref Frame"
Can't try appending the newly encoded file as long as it only contains 1 ref frame. Any solutions?
If not I will give up, simply re-encoding everything.
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

Given how DVDFab is not x264 (and probably does not use x264 under the hood either), attempting to pass x264-specific parameters to it had a near-100% chance of failing.

It's possible DVDFab has documentation somewhere on how to configure their H.264 encoder.
justincase
Bright Spark User
Posts: 152
Joined: Sun Nov 22, 2009 1:09 am

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by justincase »

DVDFab is using x264/x265 though. Even their documentation says so.
x264 core:161 r3018 db0d417
Syntax: x264 [options] -o outfile infile

According to the documentation: https://www.dvdfab.cn/tips/custom-h264- ... VDFab%2012
this is exactly the way they want the parameters to be entered. Starting with "x264"

But ok, I guess it just wasn't meant to be. I will re-encode everything now which definitely solves the problem. Thanks for the help though.
Deleted User 11865

Re: Encoding movie file with exact settings of existing file (question for experts)

Post by Deleted User 11865 »

That documentation looks iffy. It's also possible your source was encoded with a version of DVDFab before they started to use x264, or even using DVDFab + a hardware-accelerated encoder like Quick Sync Video, NVENC or VCE.
Post Reply