MATLAB Answers

Matlab VideoWriter is very slow

31 views (last 30 days)
timo
timo on 30 Jul 2018
Edited: Jan on 3 Aug 2018
So i am trying to cut an mp4 file , and remove the last 20% I go from start :) and i have this code where 5833 is the last frame i want to write
videoFReader = vision.VideoFileReader('2018-07-30_21h52_48.mp4');
videoFWriter = vision.VideoFileWriter('myFile.avi','FrameRate',...
videoFReader.info.VideoFrameRate);
for i=1:5833
videoFrame = step(videoFReader);
step(videoFWriter,videoFrame);
end
I observed that : 1. My CPU is used around 25% (only one core from 8) 2. the process is very slow - the original file is 45 Mb but 5 minutes passed and is still at 80% done ..
Any workaround to make it faster (use GPU / or multi core ) ? For a professional product this is kinda of embarrassing :(
  11 Comments
Jan
Jan on 2 Aug 2018
Let's keep the discussion on a professional level.

Sign in to comment.

Accepted Answer

Jan
Jan on 2 Aug 2018
Matlab is not the perfect tool for cropping MP4 files. Why not let a special tool like ffmpeg do this? See https://www.ffmpeg.org/
  3 Comments
timo
timo on 3 Aug 2018
Hello I have latest Matlab

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by