I'm trying to write an .mp4 file but I keep getting permission denied
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
`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 Commenti
Geoff Hayes
il 8 Apr 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.
Risposte (2)
Susan Pizzuti
il 10 Feb 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.
0 Commenti
Kondasani
il 11 Ago 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);
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!