Error when reading sound in avi files
이전 댓글 표시
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.
답변 (1개)
Walter Roberson
2021년 2월 14일
0 개 추천
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
Hermenegildo Bello García
2021년 2월 14일
Hermenegildo Bello García
2021년 2월 15일
Walter Roberson
2021년 2월 15일
Interlaced sound? How does that work? Is it multiple channel sound?
Hermenegildo Bello García
2021년 2월 16일
Hermenegildo Bello García
2021년 2월 16일
카테고리
도움말 센터 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


