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

2 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Abhijeet el 4 de Abr. de 2023
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.

Más respuestas (0)




Community Treasure Hunt

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

Start Hunting!

Translated by