I'm trying to write an .mp4 file but I keep getting permission denied

10 visualizaciones (últimos 30 días)
Oscar Ramos
Oscar Ramos el 8 de Abr. de 2020
Respondida: Kondasani el 11 de Ag. de 2023
`Cannot create file VelTemp4.mp4. Permission Denied.`
I have the correct coding as I understand it but that is the only thing the error message says. I have MATLAB R2019b.
  8 comentarios
Geoff Hayes
Geoff Hayes el 8 de Abr. de 2020
That line of code works for me, so there is nothing wrong with the way you have written it. I do suggest trying an alternative folder.
Oscar Ramos
Oscar Ramos el 8 de Abr. de 2020
It worked. Saving it to a different folder made all the difference.

Iniciar sesión para comentar.

Respuestas (2)

Susan Pizzuti
Susan Pizzuti el 10 de Feb. de 2021
I just had this issue and found that my antivirus "ransomware protection" was preventing matlab from writing the file. Try temporarily turning off your antivirus and see if that helps.

Kondasani
Kondasani el 11 de Ag. de 2023
% Initialize webcam and face detector
cam = webcam();
detector = buildDetector(1, 176);
% Set up video recording
outputVideo = VideoWriter('output_video.mp4', 'MPEG-4');
outputVideo.FrameRate = 10; % Adjust the frame rate as needed
open(outputVideo);
% Initialize variables for blink and yawn detection
prevEyeStatus = false;
yawnCount = 0;
while true
% Capture a frame from the webcam
img = snapshot(cam);
% Detect face parts in the current frame
[bbox, bbimg, faces, bbfaces] = detectFaceParts(detector, img, 2);
% Display the image with bounding boxes around detected face parts
imshow(uint8(bbimg));
% Detect eye blinking
currEyeStatus = detectEyeBlink(faces{1}); % Assuming one face
% Detect yawn (based on mouth aspect ratio)
mouthAspectRatio = calculateMouthAspectRatio(faces{1}); % Implement your method
% Play beep sound for blink or yawn detection
if currEyeStatus && ~prevEyeStatus
sound(beepSound, 44100); % Play beep sound
end
if mouthAspectRatio > thresholdYawnAspectRatio
yawnCount = yawnCount + 1;
if yawnCount >= yawnThresholdFrames
sound(beepSound, 44100); % Play beep sound
yawnCount = 0;
end
else
yawnCount = 0;
end
prevEyeStatus = currEyeStatus;
% Write the current frame to the video file
writeVideo(outputVideo, uint8(bbimg));
% Exit the loop when 'q' key is pressed
if strcmpi(get(gcf, 'CurrentCharacter'), 'q')
break;
end
end
% Release the webcam and close the video file
clear cam;
close(outputVideo);

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by