How to draw the audio track from a video which contains audio?
4 views (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
Raghava S N
on 28 Oct 2024 at 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!
0 Comments
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!