How to draw the audio track from a video which contains audio?

조회 수: 5 (최근 30일)
Weiqian Jiang
Weiqian Jiang 2016년 8월 17일
답변: Raghava S N 2024년 10월 28일 5:14
Hi there, I want to draw the audio track and analyze it from a video which has audio, but it seems that the "videoreader" cannot do this function, so I wanna whether there is any method that can do this function? Many thanks!

답변 (1개)

Raghava S N
Raghava S N 2024년 10월 28일 5:14
Hi,
As you are looking to extract audio data from a video file, the function “audioread can be used. The “audioread” function can take a MPEG-4 AAC (.m4a” or.mp4) video file as input, from which the audio data can be extracted. Refer to the documentation of “audioread” for more information - https://www.mathworks.com/help/matlab/ref/audioread.html#:~:text=.mp3)%2C-,MPEG%2D4%20AAC%20(.m4a%2C%20.mp4),-%2C%20OGG%20(.ogg.
Here is a code snippet that displays this functionality –
>> [y,Fs] = audioread('<path_to_your_video/your_video>.mp4');
>> audiowrite('outputfile.WAV',y,Fs);
The extracted audio can be stored in a format supported by MATLAB. Refer to this documentation link for the list of audio formats supported by MATLAB - https://www.mathworks.com/help/matlab/import_export/supported-video-file-formats.html#:~:text=in%20MATLAB%20again.-,Audio%20Data%20in%20MATLAB,-What%20Are%20Audio.
For additional details on extracting audio from videos, refer to this MATLAB Answers post - https://www.mathworks.com/matlabcentral/answers/437261-how-to-extract-audio-from-mp4.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by