Error when reading sound in avi files
Ältere Kommentare anzeigen
Hello, i whould like to make an aplication that add volume to a film.
In my code i have used a bucle in order to match the audio with the frames. But i found a problem that when reading audio from a film it has a lot of samples that are at 0 value, thoose samples introduce me a lot of distorsion in the audio. When i read a video in mp4 it doesent give me that distorsion because the sound doesen`t have void samples. I whould appreciate if you could healp me. I attach my code in order to explain better

In that picture i have read a mp4 video file that doesen't introduce distorsion.

Same experiment but reading a film.

Same experiment but with other film.
I suppose that this distorison is due the compression of the audiofile but i thought that the dsp.AudioReaderFile function could uncompress that sound.
Those films with distorison are correctly heared in a videoplayer like VLC.
Antworten (1)
Walter Roberson
am 14 Feb. 2021
0 Stimmen
MATLAB use the model that audio is attached to the frame, and that each frame has the same amount of audio. If the source does not have the same amount of audio as the first frame, then MATLAB zero fills.
For fixed-framerate video this is an more acceptable model, as lack of audio in such a case can be tied directly to silence for a fixed period.
But for variable-framerate video, the assumption of the same amount of audio for each frame when the frames are not spaced equally presents obvious problems.
I do not know how one might get around this problem.
I wonder, though... perhaps if you fetched the timestamp for each frame as you read it, then the difference in timestamps would give you information on how much audio should have been expected, and then maybe you can chop the buffer if it should have been short?
5 Kommentare
Hermenegildo Bello García
am 14 Feb. 2021
Hermenegildo Bello García
am 15 Feb. 2021
Walter Roberson
am 15 Feb. 2021
Interlaced sound? How does that work? Is it multiple channel sound?
Hermenegildo Bello García
am 16 Feb. 2021
Hermenegildo Bello García
am 16 Feb. 2021
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


