Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th November 2024, 20:57   #1  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Question about elementary AVC streams

So, I have two .avc streams, extracted from a BD, they are both a remux, no reencode whatsoever, the number of frames are the same, and comparing side by side the frames are virtually the same, no differences at all, same source, same result.

But for some reason, the hashes of the files are different. I was wondering, why could that be?

Thanks in advance!
eXtremeDevil is offline   Reply With Quote
Old 29th November 2024, 18:10   #2  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
Quote:
So, I have two .avc streams, extracted from a BD, they are both a remux,..
not clear what you did in detail, so my guesses are:

a. If there were encoding involved: Multithreading,.. encode the same source with x264 and use '--non-deterministic' and the outputs will not be identical.

b. If I remember correctly, even without encoding, muxing into mkv and extracting with different mkvtoolnix versions might result in non-identical outputs due to header handling,...

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 29th November 2024, 18:19   #3  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Quote:
Originally Posted by Selur View Post
not clear what you did in detail, so my guesses are:

a. If there were encoding involved: Multithreading,.. encode the same source with x264 and use '--non-deterministic' and the outputs will not be identical.

b. If I remember correctly, even without encoding, muxing into mkv and extracting with different mkvtoolnix versions might result in non-identical outputs due to header handling,...

Cu Selur
Hi, thanks for the answers, let me clarify:

a. No encoding, both should be just a remux.

b. I extracted the avc streams them with the same mkvtoolnix versions, but maybe they were muxed into mkvs before with different mkvtoolnix versions, would that affect the result? I guess it shouldn't...

It's not like I want to achieve something here, I'm just curious.
eXtremeDevil is offline   Reply With Quote
Old 30th November 2024, 08:45   #4  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
Yes, different version or muxing setting could alter which headers got stripped.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 1st December 2024, 00:40   #5  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 225
Quote:
Originally Posted by Selur View Post
Yes, different version or muxing setting could alter which headers got stripped.
...or duplicated

I recommend YUView for "inspect the inside of the bitstream" and many other features it has.
Z2697 is offline   Reply With Quote
Old 1st December 2024, 01:13   #6  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Quote:
Originally Posted by Selur View Post
Yes, different version or muxing setting could alter which headers got stripped.
I get that, but if I demux the elementary streams, shouldn't they be the same again??
eXtremeDevil is offline   Reply With Quote
Old 1st December 2024, 11:26   #7  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
No, afaik only the actual video data would be the same, none essential headers might be changed.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 1st December 2024, 13:03   #8  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Sorry, but I still don't get it. Isnt the "the actual video data" the extracted avc stream? Are you saying that the .avc file has headers inside that cannot be removed/ignored in order to create a hash for only video data?
eXtremeDevil is offline   Reply With Quote
Old 1st December 2024, 14:28   #9  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
SEI (supplemental enhancement information) messages do not affect the core decoding process, but can indicate how the video is recommended to be post-processed or displayed. So parts of SEI messages can be dropped, modified,... (repeated more or less frequent) when extracting the video stream.
So if you have a source stream that had the (complete) SEI data only in the first IDR frame but upon extraction is added to each IDR frame the extracted stream would be more 'robust' (to cutting/damage) than the original, while the data for the core decoding process hasn't changeg.
=> you might want to read up on SEI
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 1st December 2024, 17:59   #10  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
You mean that, even with the same extraction tool, the elementary avc stream could have different SEI/IDR data inside?
eXtremeDevil is offline   Reply With Quote
Old 1st December 2024, 18:19   #11  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,279
It's a shame there's not a tool for adjusting the properties of AVC and HEVC elementary streams like 'Re-stream' has been able to do for many years ago with MPEG-2 elementary streams.
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |

Last edited by SeeMoreDigital; 1st December 2024 at 21:28.
SeeMoreDigital is offline   Reply With Quote
Old 1st December 2024, 19:48   #12  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Quote:
Originally Posted by SeeMoreDigital View Post
It's a shame there's not a tool for adjusting the properties of AVC and HEVC elementary streams like 'Re-stream' which was available many years ago for adjusting the properties of MPEG-2 elementary streams.
Is that a yes to my last question? xD
eXtremeDevil is offline   Reply With Quote
Old 2nd December 2024, 01:21   #13  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 225
SPS and PPS can also be duplicated.
Z2697 is offline   Reply With Quote
Old 2nd December 2024, 06:34   #14  |  Link
ivanb
Registered User
 
Join Date: May 2023
Posts: 33
You can try to open both files in the analyzer like https://media-analyzer.pro/. Perhaps you might spot some differences right away. Once you find them, it’ll be easier to fix them if needed.
ivanb is offline   Reply With Quote
Old 2nd December 2024, 15:13   #15  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
Quote:
You mean that, even with the same extraction tool, the elementary avc stream could have different SEI/IDR data inside?
If you use different version or setting in the tool: yes, you can have different SEI data.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 2nd December 2024, 20:21   #16  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Quote:
Originally Posted by Selur View Post
If you use different version or setting in the tool: yes, you can have different SEI data.
No no, I used the exact same tool and options for extracting both .avc out of both. mkv.
eXtremeDevil is offline   Reply With Quote
Old 2nd December 2024, 20:49   #17  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
Quote:
Originally Posted by ivanb View Post
You can try to open both files in the analyzer like https://media-analyzer.pro/. Perhaps you might spot some differences right away. Once you find them, it’ll be easier to fix them if needed.
Great tool, but I can't see the differences side by sides, there's too many data

EDIT

I actually managed to find differences, seems like one of the streams have a few of these:

00324107b7AVC End Of Sequence #31789

Is there a way to edit them or something similar, remove that data (or whatever it is), just to check again both files and see if they have the same hash?

If not, in any case, which stream would be better, if I had to keep one?

Thanks guys!

Last edited by eXtremeDevil; 2nd December 2024 at 21:32.
eXtremeDevil is offline   Reply With Quote
Old 2nd December 2024, 22:06   #18  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Posts: 225
Quote:
Originally Posted by eXtremeDevil View Post
Is there a way to edit them or something similar, remove that data (or whatever it is), just to check again both files and see if they have the same hash?
FFmpeg bitstream filter "filter_units".
Code:
ffmpeg -i bfd.264 -bsf:v filter_units=pass_types=1-5 -c copy out.264
NALU type id 1-5 in AVC is VCL. The result file is not decodeable due to the lack of SPS and PPS, it only contains all of the encoded frames' data.

Last edited by Z2697; 4th December 2024 at 15:45. Reason: "-c copy"
Z2697 is offline   Reply With Quote
Old 3rd December 2024, 16:47   #19  |  Link
ivanb
Registered User
 
Join Date: May 2023
Posts: 33
Quote:
Originally Posted by Z2697 View Post
Code:
ffmpeg -i bfd.264 -bsf:v filter_units=pass_types=1-5 out.264
I guess for this particular case we would need something like
Code:
ffmpeg -i bfd.264 -bsf:v filter_units=remove_types=10 out.264
to filter out EOS NALUs
ivanb is offline   Reply With Quote
Old 3rd December 2024, 19:40   #20  |  Link
eXtremeDevil
Registered User
 
eXtremeDevil's Avatar
 
Join Date: Jul 2010
Posts: 212
I tried both commands, and the results of the "different" avc files are identical, same hash. Can we then say the videos are virtually the same? Since one has those "End Of Sequence" data, which video could be better to keep? I don't quite understand what "End Of Sequence" data do, and if it's better or irrelevant to have it.

EDIT

BTW, why the result file is 3gb and the .avc file is 28gb?

Last edited by eXtremeDevil; 4th December 2024 at 00:13.
eXtremeDevil is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.