DGDemux development

DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

I used eac3to to rip the THD from the m2ts and convert it to mono flac, so that I could open it up in Audacity and easily compare multiple segments/streams. For example:

Code: Select all

eac3to "BDMV\STREAM\00055.m2ts" 2: 1_55.flac -mono
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

I see, thank you. Try my method. It's much faster and doesn't re-encode.

Working on THD gaps correction. It's not straightforward due to the embedded AC3 and the major/minor frames distinction.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

I have it working but have to double check that the embedded AC3 is not getting hit due to a small technical matter. The durations I get are now:

video: 6258.418 seconds
thd: 6258.420 seconds

Sync is spot on all the way through. So that looks pretty good. :D
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Released THD gaps processing in slipstream 22. Makes mincemeat out of MONSTERS_UNIVERSITY!
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: DGDemux development

Post by Bullwinkle »

OK guys, Rocky is busy on something or other so I'm gonna finish off the garbage skipping feature. Our test disk is CROUPIER reported by mini-moose. Love that nick by the way. Nobody calls me mini! :lol:
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: DGDemux development

Post by Bullwinkle »

OK, all done! Rocky, can you put a notice in the binaries update thread, please?
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Will do. Thank you so much, Bullwinkle!
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

Thank you so much for implementing THD gaps correction! :bravo:

I'm trying to re-check the THD audio stream of some of my Pixar blu-rays with the new version, but ffmpeg/eac3to now fails to decode the THD stream due to checksum errors (is that something that can be fixed?). Your ffmpeg command to remove Atmos doesn't seem to work for me; I just get "Unable to find a suitable output format for 'truehd_core'". Which ffmpeg version did you use?

ffmpeg 2.2.2 (the one Audacity wants):

Code: Select all

.\ffmpeg.exe -i "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd" -bsf:a truehd_core -c:a copy "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms CORE.thd"
ffmpeg version 2.2.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on May 22 2014 19:56:44 with gcc 4.8.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[truehd @ 00ee7780] major sync info header checksum error
    Last message repeated 56411 times
[truehd @ 00eeea60] Could not find codec parameters for stream 0 (Audio: truehd, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd: could not find codec parameters
Conversion failed!
ffmpeg 4.2.2 (latest):

Code: Select all

ffmpeg -i "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd" -bsf:a truehd_core -c:a copy "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms CORE.thd"
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, truehd, from 'C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: truehd, 48000 Hz, 7.1, s32 (24 bit)
[NULL @ 0000015da1a06980] Unable to find a suitable output format for 'truehd_core'
truehd_core: Invalid argument
eac3to:

Code: Select all

C:\Users\domin\Desktop\dgdemux_output\toy-story-4>"C:\Program Files (x86)\eac3to\eac3to.exe" "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd" "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd_.flac" -mono -progressnumbers -log="C:\Program Files (x86)\eac3to\UsEac3To.log"
TrueHD (Atmos), 7.1 channels, 48kHz, dialnorm: -28dB
Removing TrueHD dialog normalization...
Decoding with libav/ffmpeg...
Encoding FLAC with libFlac...
Creating file "C:\Users\domin\Desktop\dgdemux_output\toy-story-4\00800 PID 1100 48000 8ch eng DELAY 0ms.thd_.flac"...
process: 1%
[truehd @ 00032fc0] End of stream indicated.
[truehd @ 00032fc0] Lossless check failed - expected 00, calculated d6.
The libav decoder reported error -1094995529 while decoding.
I've got a small feature suggestion as well: Maybe add a "Remove dialog normalization" switch/option? I think that would be a nice quality-of-life option.
User avatar
Sherman
Posts: 576
Joined: Mon Jan 06, 2020 10:19 pm

Re: DGDemux development

Post by Sherman »

Wow, thanks so much for the feedback, domy (you are a hero for me). I have to take my nap right now but when I wake up we'll get this sorted out for you.
Sherman Peabody
Director of Linux Development
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Go for it, Sherman! Let's see how the young man does on this. Sweet dreams!
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: DGDemux development

Post by Bullwinkle »

Thinking is not optional, Sherman.

Domi, Levi has a message for you:

https://www.youtube.com/watch?v=qXavZYeXEc0
User avatar
Natasha
Posts: 150
Joined: Wed Nov 20, 2019 11:11 am

Re: DGDemux development

Post by Natasha »

You people are demented. Mr. Big will not like this.
User avatar
Curly
Posts: 712
Joined: Sun Mar 15, 2020 11:05 am

Re: DGDemux development

Post by Curly »

It's the heart that sings.
Curly Howard
Director of EAC3TO Development
User avatar
Natasha
Posts: 150
Joined: Wed Nov 20, 2019 11:11 am

Re: DGDemux development

Post by Natasha »

Cry me a river.

Image
User avatar
Boris
Posts: 92
Joined: Sun Nov 10, 2019 2:55 pm

Re: DGDemux development

Post by Boris »

Listen up! We got big shipment from Wuhan:

* masks
* gowns
* gloves
* test kits

And big clearance special on dog meat! Send PM for details. We are here for you.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

domi, Sherman asked me to help him a little with this but I am out of energy for today. Will answer tomorrow morning. Thanks for your patience.
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

No worries, it's nothing urgent at all :)

I figured out how to bypass eac3to and make ffmpeg decode the THD stream while ignoring errors (ffmpeg -i file.thd -ac 1 out.thd, version 4.2.2), but it prints a lot of errors and the final flac file is 5 seconds short by the end for Monster's University (movie length is 1:43:48.389, flac output is 1:43:43.281). The movie itself sounds perfectly in sync throughout though, so this is probably a case of ffmepg's THD decoder being quite strict to the spec and dropping invalid frames, maybe? I haven't yet watched it through entirely so I can't tell you if these errors are audible, but I can imagine that it might cause problems with some THD decoders out there. Either way I can't generate a correct wav/flac bitstream.

Here's an excerpt of the aforementioned errors:

Code: Select all

[11:24] ~\Desktop\dgdemux_output\monsters-university> ffmpeg -i '.\00800 PID 1100 48000 8ch eng DELAY 0ms.thd'
-ac 1 monster-university-thd-mono.flac
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enabl
e-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enabl
e-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enabl
e-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --en
able-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-l
ibopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, truehd, from '.\00800 PID 1100 48000 8ch eng DELAY 0ms.thd':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: truehd, 48000 Hz, 7.1, s32 (24 bit)
Stream mapping:
  Stream #0:0 -> #0:0 (truehd (native) -> flac (native))
Press [q] to stop, [?] for help
Output #0, flac, to 'monster-university-thd-mono.flac':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Audio: flac, 48000 Hz, mono, s32 (24 bit), 128 kb/s
    Metadata:
      encoder         : Lavc58.54.100 flac
[out_0_0 @ 0000020f16250280] 100 buffers queued in out_0_0, something may be wrong.
[truehd @ 0000020f162d6840] End of stream indicated./s speed=41.7x
[truehd @ 0000020f162d6840] Lossless check failed - expected 00, calculated 9f.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] Invalid blocksize.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] quant_step_size larger than huff_lsbs
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x00fe)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1b8b)
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1e07)
Error while decoding stream #0:0: Invalid data found when processing input
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 4 times
[truehd @ 0000020f162d6840] Invalid channel 9 specified as output from matrix.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1781)
[truehd @ 0000020f162d6840] Invalid blocksize.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 2 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1f80)
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] Invalid huff_lsbs.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] Invalid huff_lsbs.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x04d1)
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x02a9)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 8 times
[truehd @ 0000020f162d6840] Number of primitive matrices cannot be greater than 8.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x0030)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x11b3)
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x0fe2)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 9 times
[truehd @ 0000020f162d6840] Invalid blocksize.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 3 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1c82)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 2 times
[truehd @ 0000020f162d6840] quant_step_size larger than huff_lsbs
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1d20)
[truehd @ 0000020f162d6840] Invalid blocksize.
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1519)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1a7f)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 2 times
[truehd @ 0000020f162d6840] quant_step_size larger than huff_lsbs
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[truehd @ 0000020f162d6840] Invalid blocksize.
    Last message repeated 1 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x0d95)
[truehd @ 0000020f162d6840] No samples to output.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[truehd @ 0000020f162d6840] Invalid blocksize.
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x05ee)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x1bad)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 7 times
[truehd @ 0000020f162d6840] quant_step_size larger than huff_lsbs
[truehd @ 0000020f162d6840] Invalid blocksize.
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x03ef)
[truehd @ 0000020f162d6840] No samples to output.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] Negative output_shift is not implemented. Update your FFmpeg version to the newest one from
Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[truehd @ 0000020f162d6840] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and c
ontact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[truehd @ 0000020f162d6840] Negative output_shift is not implemented. Update your FFmpeg version to the newest one from
Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[truehd @ 0000020f162d6840] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and c
ontact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[truehd @ 0000020f162d6840] FIR filter coeff_bits must be between 1 and 16.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] quant_step_size larger than huff_lsbs
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 3 times
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x04d2)
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 2 times
[truehd @ 0000020f162d6840] Sum of coeff_bits and coeff_shift for FIR filter must be 16 or less.
[truehd @ 0000020f162d6840] IIR filter order 13 is greater than maximum 4.
[truehd @ 0000020f162d6840] Invalid blocksize.
[truehd @ 0000020f162d6840] No samples to output.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 7 times
[truehd @ 0000020f162d6840] Invalid blocksize.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 2 times
[truehd @ 0000020f162d6840] Invalid blocksize.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 3 times
[truehd @ 0000020f162d6840] FIR filter order 10 is greater than maximum 8.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 2 times
[truehd @ 0000020f162d6840] Invalid blocksize.
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x0153)
[truehd @ 0000020f162d6840] restart header sync incorrect (got 0x08c7)
[truehd @ 0000020f162d6840] No samples to output.
Error while decoding stream #0:0: Invalid data found when processing input
[truehd @ 0000020f162d6840] Invalid blocksize.
[truehd @ 0000020f162d6840] Invalid channel 11 specified as output from matrix.
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
...
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

domy wrote:
Sat Apr 18, 2020 4:51 am
No worries, it's nothing urgent at all
It is urgent because we don't want to be demuxing invalid files. Investigating...
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Hey domy, I'm using 00801.mpls from MONSTERS_UNIVERSITY. Is that what you are using? We need to be using the same source.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Let's address the first issue with ATMOS stripping. I demuxed the THD track from MONSTERS 00801.mpls with the do-not-split option unchecked. I copied the file into my ffmpeg 4.2.2 bin directory. I opened a CMD prompt there and did the stripping without issues:

Code: Select all

C:\Standalone\ffmpeg 4.2.2\bin>ffmpeg -i dgdemux.thd -c:a copy -bsf:a truehd_core dgdemux_.thd
ffmpeg version git-2020-04-01-afa5e38 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 77.101 / 58. 77.101
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, truehd, from 'dgdemux.thd':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: truehd, 48000 Hz, 7.1, s32 (24 bit)
Output #0, truehd, to 'dgdemux_.thd':
  Metadata:
    encoder         : Lavf58.42.100
    Stream #0:0: Audio: truehd, 48000 Hz, 7.1, s32 (24 bit)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 4756512kB time=01:44:18.41 bitrate=6226.1kbits/s speed= 366x
video:0kB audio:4756512kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

C:\Standalone\ffmpeg 4.2.2\bin>
Audacity now loads the stripped file without issues. Let's try to get closure on this before we go to the rest, as there may be a common issue. I do see you changed the order of the options. Please try with my order. Also, it looks like we have different component versions (e.g., look at libavformat) and build configurations, but both claim 4.2.2. :scratch:
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

Ahh, I was using powershell. It works with cmd. I'm using 00800.mpls, do-not-split unchecked, ffmpeg 4.2.2 as well.

So, this is kind of a weird situation: If I import the THD core into Audacity, the length of the audio stream is 1:43:43.290 (298,717,920 samples). If I force ffmpeg to decode it by transcoding to flac*, the resulting file has 1:43:43.281 (298,717,504 samples). The demuxed h265 stream has 149,333 frames, amounting to a duration of 1:43:48.431 - that's about 5 seconds longer than the THD stream. But, it seems the THD stream really is 1:43:48; ffmpeg stops transcoding at :48, and playing the THD file with mpv lets me seek all the way up to :48. If I mux THD+H265 together with MKVtoolnix 45.0.0, the movie is (seemingly perfectly) in sync with the THD audio at any point I seek to. Playing back the movie without any seeking also keeps sync just fine.

* the transcoding command, super simple:

Code: Select all

ffmpeg -i dgdemux.thd dgdemux_mono.flac
The Atmos stripping completes without errors, but I believe ffmpeg does this with only minimal parsing (I get a speed of about 200x when doing this). Transcoding it is significanly slower (about 35x on my machine) and reports heaps of errors.

I suspect that DGDemux now outputs some flawed THD frames at or near the segment boundaries (given the ffmpeg errors), which probably causes ffmpeg to just remove them from the output. I guess the playback decoder ignores the errors and plays the audio anyway, even if the checksum or whatever is wrong - that would explain why the movie is nicely in sync and plays fine (at least in mpv), despite the transcode errors. But again, that's just my best guess given the evidence.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Well that's weird that Powershell acts so differently. I'll have to start over with 00800.mpls. There shouldn't be a 5-second discrepancy between audio and video. Let's see if I can reproduce that.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Just not seeing it, domy.

Demuxed video and thd track from 00800.mpls. Indexed the elementary video and obtained 149332 frames. That leads to 6228.38 seconds at 24000/1001. Then I used a tool I have to count frames in the (not ATMOS stripped) THD and that gave 6228.39 seconds.

Code: Select all

D:\Don\Programming\C++\TrueHD\x64\Debug>truehd dgdemux.thd
58693 major, 7415375 minor, 7474068 total, 6228.390000 duration
So it seems your method for determining the duration of the THD file is suspect. I can give you my little app if you want it. I wrote it myself. And sync is great so... Now about the eac3to errors and flac transcoding, let's get this discrepancy sorted out first before moving to them.

PS: Can we talk about total seconds and not hours:minutes:seconds?
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

Sorry, let me clarify: I know that the THD stream is in fact 6228 seconds long. What I mean is that when you let ffmpeg transcode the THD stream, it spits out a bunch of errors and what comes out is only 6223 seconds long. I don't have any other way to analyze the actual audio samples but to go through ffmpeg (I think?).

As a side note, I would argue that this is an issue since most AV software uses ffmpeg under the hood, and I think a THD stream that ffmpeg decodes without errors is all but guaranteed to play nice with every player/decoder out there.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

OK, thank you, domy. Now we're cooking with gas. It could be that we need to re-write some checksums when deleting minor frames (which may be a pain in the patootie but it's what it is). Have to check the spec. Tomorrow. Right now, it's nap time. :D

Really appreciate your patience and assistance! It will be great to get this working flawlessly. :salute:
Post Reply