Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packing error audio-video-duration-mismatch due to misformatted audio duration value #927

Open
JohnstonJ opened this issue Jul 31, 2024 · 5 comments
Labels
audio package related to dvpackager

Comments

@JohnstonJ
Copy link

While attempting to package a DV file into an MKV file, I got this error from debug logs. This is on Windows with the dvrescue_GUI_22.12.20240730_Windows_x64 nightly build. Before using this nightly build, I converted all the line endings in \scripts to Unix (see #925 )

#AUD_STREAM_COUNT=(4)




(standard_in)



 1: syntax error




#VID_DUR=(3701931.000000), AUD_DIR=(3701931.0000003701931.0000003701931.0000003701931.000000), DUR_DIFF=()




(standard_in) 1: syntax error




### Done:seg_input=1|seg_output=1|output_frames=110947|input_frames=110947|audio_fill=0|output_file=/cygdrive/C/VideoProject/Johnston3/Johnston3-pass4_part1.mkv




### Packaging error: audio-video-duration-mismatch




### Packaging error note: In Johnston3-pass4_part1.mkv the video track is 3701931.000000 milliseconds and the audio track is 3701931.0000003701931.0000003701931.0000003701931.000000. These tracks may lose sync. 




### Packaging finished: /cygdrive/C/VideoProject/Johnston3/Johnston3-pass4_part1.mkv

It looks like somehow the AUD_DUR has several durations in it that have been improperly concatenated to make a single, non-sensical string that can't be compared with the video duration: note the #VID_DUR=(3701931.000000), AUD_DIR=(3701931.0000003701931.0000003701931.0000003701931.000000), DUR_DIFF=() line.

I did get an MKV file on the output, so I'm assuming it's actually fine, and this error is misleading noise.

@dericed
Copy link
Contributor

dericed commented Jul 31, 2024

interesting. Is this a 32khz 4 channel dv and you used the -m flag for mono track outputs?

But yes, the audio duration is mis-expressed and is evaluated in https://github.com/mipops/dvrescue/blob/main/tools/dvpackager#L1291. I'm confused how it comes out like that on windows, perhaps the windows line breaks, prevent the head -n 1 from only taking the first result.

@JeromeMartinez, currently
AUD_DUR=($("${MEDIAINFO_PATH}" -f --Output="Audio;%Duration%" "${OUTPUT_FILE}" | head -n 1 | sed 's/\r//' | awk '{printf "%s", $0}')) is used to set the duration of the first audio track. In @JohnstonJ's case it gives a concatenation of all audio track values. Advice on how to tweak this?

@dericed
Copy link
Contributor

dericed commented Aug 1, 2024

@JohnstonJ
Copy link
Author

JohnstonJ commented Aug 1, 2024

@dericed This video was recorded on a consumer Sony camcorder that would have been sold near the end of 1999 or very early 2000. I'm not sure the exact model.... but just to give you an idea of what probably recorded it.

Here's the output from MediaInfo (the GUI version) for the audio portions:


Audio #1
ID                                       : 0
Format                                   : PCM
Format settings                          : Big / Signed
Duration                                 : 1 h 1 min
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Bit depth                                : 12 bits
Stream size                              : 339 MiB (3%)

Audio #2
ID                                       : 1
Format                                   : PCM
Format settings                          : Big / Signed
Duration                                 : 1 h 1 min
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Bit depth                                : 12 bits
Stream size                              : 339 MiB (3%)

The first audio # 1 seems to be what has the audio. The second one has proved to be blank.

@dericed
Copy link
Contributor

dericed commented Aug 1, 2024

This is the mediainfo output of the DV file, right? In dvpackager, if the DV is like this with four audio channels then the 3rd and 4th channels should be tested to see if any audio is there and if not, then the packager will just skip them when packaging to a container.

@JohnstonJ
Copy link
Author

@dericed Right - this is from a bare DV file. I opened it in MediaInfo GUI, went to the text mode, and copied that snippet.

I did not even know that these things could possibly contain 4 audio channels until very recently... This was recorded on a consumer Sony camcorder, so there's no way it could possibly have actually recorded anything more than stereo. And indeed, now that #925 is fixed, I was able to look at only the audio DIF blocks, and, unsurprisingly, the second half of them are all zeros.

So concluding, this is from a DV file with four 32 kHz channels (2x stereo), and the latter two are totally blank (zero).

Examining one of the packaged MKV file outputs in Media Info GUI, and going to text mode, I also see this:

Audio #1
ID                                       : 2
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : A_PCM/INT/LIT
Duration                                 : 6 s 673 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 024 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Bit depth                                : 16 bits
Stream size                              : 834 KiB (3%)
Writing library                          : Lavc60.3.100 pcm_s16le
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : A_PCM/INT/LIT
Duration                                 : 6 s 673 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 024 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Bit depth                                : 16 bits
Stream size                              : 834 KiB (3%)
Writing library                          : Lavc60.3.100 pcm_s16le
Default                                  : No
Forced                                   : No

Audio #3
ID                                       : 1-0
Format                                   : PCM
Format settings                          : Big / Signed
Muxing mode                              : DV
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 6 s 673 ms
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Bit depth                                : 12 bits
Delay relative to video                  : 67 ms
Stream size                              : 626 KiB (2%)

Audio #4
ID                                       : 1-1
Format                                   : PCM
Format settings                          : Big / Signed
Muxing mode                              : DV
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 6 s 673 ms
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Bit depth                                : 12 bits
Delay relative to video                  : 67 ms
Stream size                              : 626 KiB (2%)

So I guess the testing mechanism you mention might be broken? Audio 1 and 2 are both stereo, and I've noticed when ingesting this file into Hybrid that it detects two audio tracks... the second one being totally blank.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio package related to dvpackager
Projects
None yet
Development

No branches or pull requests

3 participants