time of source and copied movie

2 ビュー (過去 30 日間)
Majid Al-Sirafi
Majid Al-Sirafi 2015 年 11 月 9 日
コメント済み: Walter Roberson 2015 年 11 月 11 日
Hi everyone
I had written a program with Mat lab. This program makes copy for movie from source movie. When I play two movies, the time of the source movie file is less than the copied file. So, how to make the time of source movie same as the copied movie
please see the following code
clear all;
close all;
%%%%%%%%%%%%%%%%%%%%%%%
[filename pathname] = uigetfile('*.avi','File Selector');
vid = strcat(pathname, filename);
obj = mmreader(vid);
vid = read(obj);
frames = obj.NumberOfFrames;
new10=avifile('copied_movie.avi','compression','None');
for x = 1 : frames
blocks{x}=vid(:,:,:,x);
end
for f=1:frames
new10=addframe(new10,blocks{f}); % the result is red movie
end
new10=close(new10);
msgbox('end of operation','Message','warn');
Regards,
Majid
  2 件のコメント
Chad Greene
Chad Greene 2015 年 11 月 9 日
I assume your application is more complex than simply copying the file, but if you're only trying to copy the file you can use copyfile.
Majid Al-Sirafi
Majid Al-Sirafi 2015 年 11 月 9 日
Really, i do not need just copy, but i want to do some operations(change color, drop frame from movie.. etc.) on the original movie file and then produce a new movie after the operations. The time of produced movie is more than the original movie

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

採用された回答

Walter Roberson
Walter Roberson 2015 年 11 月 10 日
The obsolete routine avifile() uses a default 'FPS' (frames per second) of 15. If your original movie has a different rate then the time of the resulting movie will be different.
You should be switching to VideoWriter from avifile(), but still you need to remember to set the frame rate.
  3 件のコメント
Majid Al-Sirafi
Majid Al-Sirafi 2015 年 11 月 10 日
thank you vey much
Walter Roberson
Walter Roberson 2015 年 11 月 11 日
aviinfo can return Frames Per Second (but only as an integer). Like avifile() it is recommended that you switch over to newer routines.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by