Matlab VideoWriter is very slow

28 ビュー (過去 30 日間)
timo
timo 2018 年 7 月 30 日
編集済み: Jan 2018 年 8 月 3 日
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 件のコメント
OCDER
OCDER 2018 年 8 月 1 日
編集済み: OCDER 2018 年 8 月 1 日
I really do support your efforts to make a multithreaded video WRITER, not multithreaded video processor or reader. VideoWriter is slow for you and others, and you'll be doing yourself and others a favor. The multithreaded video writer would be great - just ignore my skepticism, as that comes from my ignorance.
"for sure you can write from 8 processes in parallel on the hard drive ." "Well i can make a demo where i have a file with..." "If i cannot do it..."
So can you or can you not do it???
"If you pay me 50 bucks i can make the demo... If i cannot do it i will pay u 50 bucks."
No. Why pay you 50 before you make something, and if you fail, you just return (or not return) 50? Sounds unfair.... Plus, it's maybe a violation of forum policy to request money for code/service.
"Content that you submit must be offered free of charge. You may not use the Site to sell or market your products or services to others."
Jan
Jan 2018 年 8 月 2 日
Let's keep the discussion on a professional level.

サインインしてコメントする。

採用された回答

Jan
Jan 2018 年 8 月 2 日
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 件のコメント
Dinesh Iyer
Dinesh Iyer 2018 年 8 月 3 日
In 18a, there have been performance improvements made to VideoWriter as per the release notes. Maybe you can give 18a a shot.
timo
timo 2018 年 8 月 3 日
Hello I have latest Matlab

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by