Reading PCM Audio from a Video Container
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I can successfully read 16-bit PCM Audio data from a .wav file using the 'native' flag using audioread():
>> wav1 = audioread("audioOnly.wav", 'native');
>> whos wav1
Name Size Bytes Class Attributes
wav1 2868224x1 5736448 int16
>> nfo1 = audioinfo('audioOnly.wav')
nfo1 =
struct with fields:
Filename: '...\audioOnly.wav'
CompressionMethod: 'Uncompressed'
NumChannels: 1
SampleRate: 44100
TotalSamples: 2868224
Duration: 65.0390929705215
Title: []
Comment: []
Artist: []
BitsPerSample: 16
>> [min(wav1) max(wav1)]
ans =
1×2 int16 row vector
-32768 32767
This results in the expected int16 data set.
However, if I attempt to apply the 'native' flag when reading audio from a video container such as .avi, I always seem to end up with a normalized single instead of an int16, just as if I was not applying the 'native' flag:
>> wav2 = audioread("audioVideo.avi", 'native');
>> whos wav2
Name Size Bytes Class Attributes
wav2 2868136x1 11472544 single
>> nfo2 = audioinfo('audioVideo.avi')
nfo2 =
struct with fields:
Filename: '...\audioVideo.avi'
CompressionMethod: 'Uncompressed'
NumChannels: 1
SampleRate: 44100
TotalSamples: 2868224
Duration: 65.0390929
Title: []
Comment: []
Artist: []
BitsPerSample: 16
>> [min(wav2) max(wav2)]
ans =
1×2 single row vector
-1 0.9999695
I'm confident that that .avi container has 16-bit uncompressed PCM audio data (it was generated from the original .wav audio data) and I've verified this via ffmpeg externally from MATLAB.
...So what am I misunderstanding about why MATLAB is returning a single to me rather than the expected int16 native data?
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Audio and Video Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!