In AudioLabeler, is it possible to export the frame # for each label?

2 views (last 30 days)
I am using AudioLabeler to load a video file to view the audio signal. When I export my labels, I only get the time information, but I would also like to export the frame #. Is that possible?

Accepted Answer

Abhijeet
Abhijeet on 4 Apr 2023
Hi,
Yes, it is possible to export the frame number along with the time information when exporting labels from AudioLabeler.
In AudioLabeler, when you export labels, you can choose the export format. The default export format is CSV, but you can also export in other formats such as Excel or MATLAB.
If you export to the MATLAB format (.mat), you can export the frame number along with the time information by setting the 'SamplingRate' and 'StartFrame' fields of the exported struct.
For example, if your video has a frame rate of 30 frames per second and you want to export labels for a range of time from 1.5 seconds to 2.5 seconds, you can do the following:
video = VideoReader('myvideo.mp4');
label = audioLabeler(video);
% Define the range of time for the labels
startTime = 1.5;
endTime = 2.5;
% Get the frame number for the start and end times
startFrame = round(startTime * video.FrameRate) + 1;
endFrame = round(endTime * video.FrameRate);
% Export labels to a .mat file
exportLabels(label, 'mylabels.mat', 'Format', 'mat', ... 'SamplingRate', video.FrameRate, 'StartFrame', startFrame);
When you load the exported .mat file into MATLAB, you can access the labels along with the frame number by using the 'Time' and 'Frame' fields of the struct.
Thanks

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!