Log in

View Full Version : Trouble downsampling audio in VirtualDub prior to compression


rmiller3
7th October 2024, 08:35
I started recording with OBS and it seems to have recoded my audio in the following format. I'm ultimately just trying to compress it into a pretty small file (24Kbit/s, 24000Hz, Mono).

If I try to just keep it raw PCM and use the conversion option in virtualdub to downsample, switch it to mono, or convert it to 8bit or 16bit, it gives me an error:


---------------------------
VirtualDub Error
---------------------------
Cannot convert audio: the source audio format is not supported (must be 8-bit or 16-bit PCM).


I did see this thread from several years ago which was a bit hard for me to follow. I assume much of the discussion is irrelevant since it seems my audio is just PCM. Plus, virtualdub can play the audio fine, and I can edit my video fine as long as I don't compress. https://forum.videohelp.com/threads/397499-Decoding-WMAP-audio-codecs-with-VirtualDub

I did get it to compress using some online converter just for sanity. Any idea how to get VirtualDub to get it to work?

I'm using an older version presumably (build 44282 from 2020), but I don't expect this would've changed much.


File info:

From VirtualDub file information:

Audio:
Sampling rate: 48000Hz
Channels: 2 (Stereo)
Sample precision: 32-bit float
Compression: PCM (chmask 3)
Layout: 5774 chunks (1.37s preload)
Length: 378379200 samples (2:11:22.90)
Min/avg/max/total frame size: 318976/524252/524288 (2956088K)
Data rate: 3072 kbps (0.00% overhead)



From a free online tool (Maztr):

File Summary:
sox WARN wav: wave header missing extended part of fmt chunk
Channels : 2
Sample Rate : 48000
Precision : 24-bit
Duration : 00:02:01.50 = 5832000 samples ~ 9112.5 CDDA sectors
File Size : 46.7M
Bit Rate : 3.07M
Sample Encoding: 32-bit Floating Point PCM


Full Details:
File Detail
sox WARN wav: wave header missing extended part of fmt chunk
Samples read: 11664000
Length (seconds): 121.500000
Scaled by: 2147483647.0
Maximum amplitude: 0.614301
Minimum amplitude: -0.511002
Midline amplitude: 0.051650
Mean norm: 0.036291
Mean amplitude: -0.000067
RMS amplitude: 0.056860
Maximum delta: 0.548948
Minimum delta: 0.000000
Mean delta: 0.010106
RMS delta: 0.017150
Rough frequency: 2304
Volume adjustment: 1.628

Channel Detail
sox WARN wav: wave header missing extended part of fmt chunk
Overall Left Right
DC offset -0.000076 -0.000076 -0.000059
Min level -0.511002 -0.511002 -0.508057
Max level 0.614301 0.614301 0.583200
Pk lev dB -4.23 -4.23 -4.68
RMS lev dB -24.90 -24.91 -24.89
RMS Pk dB -15.71 -15.71 -15.71
RMS Tr dB -54.62 -54.62 -54.62
Crest factor - 10.82 10.25
Flat factor 0.00 0.00 0.00
Pk count 2 2 2
Bit-depth 32/32 32/32 32/32
Num samples 5.83M
Length s 121.500
Scale max 1.000000
Window s 0.050

tebasuna51
8th October 2024, 12:37
1) OBS can be configured to store audio already compressed or like PCM 16 bits (CD quality, more than enough to convert to 24Kbit/s, 24000Hz, Mono)

2) If your VirtualDub2 not support PCM 32 bits float use other software (MeGUI, ffmpeg tools,...).

rmiller3
11th October 2024, 21:16
Thanks, yeah, I can get other tools working; just didn't see why VirtualDub2 couldn't do it.

In OBS itself; I can toggle between 2 sample rates and change it to Mono. Looks like I can adjust the audio bitrate as well, but the only encoder option I have is AAC. I wonder if it's AAC that virtualdub can't handle.

Weird that the information I found in the original post says it's PCM. I thought that it should say AAC then?

tebasuna51
12th October 2024, 12:33
1) OBS can be configured to AAC, ..., OPUS, PCM 16,..., PCM 32 float. See first image.
Here you can select PCM 16 for maximize speed (without recode, half size than 32 and enough quality).
Or for less size to AAC/OPUS (with a power PC without problems to recode on the fly).

2) VirtualDub2 44282 from 2020 can manage AAC but also PCM 32 float, only it can't resample with that format, see the image2 to convert it to 16 bits, mono and 24000Hz.
After that conversion you can save it like mp3 8/32 Kbit/s, 24000Hz, Mono (or better to AAC/OPUS)

rmiller3
14th October 2024, 07:08
@Tebasuna51

#1. Thanks for the OBS screenshot, it's good to see that others see other options. I don't have the FFMpeg options. I've used it on the command line in the past though (albeit rarely). I'll try installing it and hope OBS picks it up. The only option I have is AAC on that menu.

#2. That is what I tried to resample. That's where I get the error: mentioned above (
Cannot convert audio: the source audio format is not supported (must be 8-bit or 16-bit PCM)). It works with lower bit PCM.

Anything requiring conversion, even just changing it from stereo to mono (and leaving it as 'no compression') gives me that error

tebasuna51
14th October 2024, 20:58
Work fine for me. Post your images.

rmiller3
14th October 2024, 22:30
Actually I'm not getting the VD error now. I think the only changes were downloading the standalone executable for ffmpeg and rebooting. However, while I'm not seeing the pop-up error, when I write the output file I just get a 0 byte audio track even if I just change the conversion to mono. (https://photos.app.goo.gl/GkpQgjCLJscMmVcr9)
https://photos.app.goo.gl/GkpQgjCLJscMmVcr9

Here's the screenshot of OBS: https://photos.app.goo.gl/Wp1BzzbZZNimDVtj7
(img url isn't working... added as an attachment (or you can go here: https://photos.google.com/photo/AF1QipM47VwHj_1RAks-02j5zcowZVRq6U-IKSpXwG36)

tebasuna51
15th October 2024, 23:07
Please review:

rmiller3
18th October 2024, 01:09
Interesting, so some files I recorded with OBS seem to work, not sure why.

File 1: This file was created by stitching and trimming different videos, compressing the video but NOT compressing the audio from OBS. I don't have the source anymore to test. However, if I now try to convert the audio, I get an error if I try to save to wav. (Cannot convert audio: the source audio format is not supported (must be 8-bit or 16-bit PCM)). If instead of saving the wav, I just try to recompress the video and audio into a single file, it processes, but gives a 0byte audio track and there's no audio.

Source: https://mediaarea.net/MediaInfoOnline

General
Complete name : w2_att1x.wav
Format : Wave
Format settings : WaveFormatExtensible
File size : 625 KiB
Duration : 1 s 667 ms
Overall bit rate mode : Constant
Overall bit rate : 3 072 kb/s

Audio
Format : PCM
Format profile : Float
Codec ID : 00000003-0000-0010-8000-00AA00389B71
Codec ID/Hint : IEEE
Duration : 1 s 667 ms
Bit rate mode : Constant
Bit rate : 3 072 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Bit depth : 32 bits
Stream size : 625 KiB (100%) / 625 KiB (100%)


This one DOES convert the audio. It's raw from OBS (I may have monkeyed with some OBS setting so I can't guarantee whether it's a problem with the source or the stitching together process in the first one).

General
Complete name : 2024-10-08 12-42-52x.wav
Format : Wave
Format settings : WaveFormatExtensible
File size : 36.7 MiB
Duration : 1 min 40 s
Overall bit rate mode : Constant
Overall bit rate : 3 072 kb/s

Audio
Format : PCM
Format profile : Float
Codec ID : 00000003-0000-0010-8000-00AA00389B71
Codec ID/Hint : IEEE
Duration : 1 min 40 s
Bit rate mode : Constant
Bit rate : 3 072 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Bit depth : 32 bits
Stream size : 36.7 MiB (100%)


I wonder if it's some issue with the frame editing I was doing and the root cause is trouble stitching? Once I get into processing the next directory I'll know more since I have the source. In the meantime I'll try 3rd party tools (I've used audacity in the past, probably start there).

tebasuna51
18th October 2024, 08:13
File 1: ... if I now try to convert the audio, I get an error if I try to save to wav. (Cannot convert audio: the source audio format is not supported (must be 8-bit or 16-bit PCM)).

Both files have identical parameters in MediaInfo (32 bits float), maybe you forget change the precision to 16 bits like show in my first image in previous post, or the file is corrupt not detected by MediaInfo.

Upload the problematic file to check it.

rmiller3
20th October 2024, 01:45
See attached sample. Virtualdub and other players can play the audio, but I can't convert / compress it within virtualdub. Again, it was from a stitched together video where the audio was 'direct stream copy'. But it doesn't always happen with other recorded videos.

If I recompress the whole video with an audio conversion, it works, but writes an empty audio track. If I save as wav, I get the error.

tebasuna51
21st October 2024, 21:44
That video can't be 'direct stream copy' by VirtualDub2 but no problem with convert/compress the audio.

rmiller3
22nd October 2024, 06:36
Thanks for checking, just to confirm, you can both convert and write to wav with VD2 and recompress the video with audio conversion and the audio track is nonzero size? I wonder what is wrong on my system. At least it works on some other files...

tebasuna51
22nd October 2024, 08:15
If you want preserve the video you can use:

ffmpeg.exe -i w2_att1x.avi -vcodec copy -acodec mp3 -ab 128k NEW.avi

Input #0, avi, from 'D:\tmp\w2_att1x.avi':
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 1093 kb/s, 30 fps, 30 tbr, 30 tbn
Stream #0:1: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 48000 Hz, stereo, flt, 3072 kb/s
Output #0, avi, to 'D:\tmp\NEW.avi':
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=2-31, 1093 kb/s, 30 fps, 30 tbr, 30 tbn
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp