This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] Passthrough audio changes sample rate on multiple audio streams
#1
Hello,

I have some PAL SD videos captured from digital camera using Windows Media Player over FireWire. They are Type-2 AVIs (the audio stream is stored twice - once interleaved in the video, and once separately, where the interleaved stream is disabled). Here's a sample of ffprobe:

  Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25000 kb/s, 25 fps, 25 tbr, 25 tbn
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
  Stream #0:2: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s

For some reason, the interleaved stream is at 48000 Hz (wrong!), but the real stream is correct at 32000 Hz. This shouldn't be a problem because the wrong stream is disabled anyway. When I encode with Hybrid using "passthrough all", I expect the streams to be preserved. However, it seems like instead, the second one gets resampled to 48000 Hz:

  Stream #0:0: Video: utvideo (ULY0 / 0x30594C55), yuv420p(tv, bt470bg/bt470bg/bt709), 720x576, SAR 16:15 DAR 4:3, 50 fps, 50 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc59.25.100 utvideo
      BPS             : 117941433
      DURATION        : 00:00:52.040000000
      NUMBER_OF_FRAMES: 2602
      NUMBER_OF_BYTES : 767209028
      _STATISTICS_WRITING_APP: mkvmerge v67.0.0 ('Under Stars') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-07-09 14:27:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      BPS             : 1536016
      DURATION        : 00:00:34.757000000
      NUMBER_OF_FRAMES: 869
      NUMBER_OF_BYTES : 6673416
      _STATISTICS_WRITING_APP: mkvmerge v67.0.0 ('Under Stars') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-07-09 14:27:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    Metadata:
      BPS             : 1535994
      DURATION        : 00:00:51.840000000
      NUMBER_OF_FRAMES: 1296
      NUMBER_OF_BYTES : 9953244
      _STATISTICS_WRITING_APP: mkvmerge v67.0.0 ('Under Stars') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2022-07-09 14:27:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

As you would expect, this resampling completely messes the audio when played back.

Out of curiosity, why does Hybrid extract the audio streams and them merge them back in? This sounds like an error-prone process.

Actually, even if you fix the "passthrough" issue, so both streams keep their sample rate, I think that would still break my case because when encoding the final video, Hybrid won't set the second stream as default/the first one as disabled. Would it be possible to just add audio "auto add (last)" the same way there is "auto add (first)"? This will be a nice trick for all Type-2 AVIs. I was planning to work around this issue by using the mkvmerge custom option "--audio-tracks 1" and select the second stream, but that fails since Hybrid already uses "--no-audio" due to the extraction mechanism above.
The reason why I can't just manually make these selections is because I am running an automated pipeline with zero user interaction.

My system:
- Windows 11
- Hybrid 2022.07.01.1

Thank you!
Reply


Messages In This Thread
Passthrough audio changes sample rate on multiple audio streams - by potejan - 09.07.2022, 16:44

Forum Jump:


Users browsing this thread: 1 Guest(s)