copying AVI files by using Matlab

1 Ansicht (letzte 30 Tage)
Majid Al-Sirafi
Majid Al-Sirafi am 17 Dez. 2017
Kommentiert: Majid Al-Sirafi am 17 Dez. 2017
Hi everyone
The following two Matlab code (which they do copy new avi files from another)
First one:
- By using VideoWriter
clear all;
close all; %%%%%%%%%%%%%%%%%%%%%%%
[filename pathname] = uigetfile('*.avi','File Selector');
vid = strcat(pathname, filename);
obj = mmreader(vid);
vid = read(obj);
Frames = obj.NumberOfFrames;
new10=VideoWriter('output10.avi');
for x = 1 : Frames
blocks{x}=vid(:,:,:,x);
end
open(new10);
for f=1:1
ss=im2frame(blocks{f});
writeVideo(new10,ss);
end
close(new10);
msgbox('end of operation','Message','warn');
Second one:
- By using avifile
close all
clear all
[filename pathname] = uigetfile('*.avi','File Selector');
vid = strcat(pathname, filename);
obj = mmreader(vid);
vid = read(obj);
frames = obj.NumberOfFrames;
%%
new10=avifile('output10.avi','compression','None');
for x = 1 : frames
a=vid(:,:,:,x);
blocks{x}=a;
end
%%
for f=1:frames
new10=add frame(new10,blocks{f});
end
new10=close(new10);
msgbox('end of operation','Message','warn');
After running the first one program the new avi file is different from the original file (the pixels of frames are different).
While, after running the first one program the new avi file is same asthe original file (the pixels of
frames are similar).
Please inform me the reason
Best regards
Majid
  4 Kommentare
Majid Al-Sirafi
Majid Al-Sirafi am 17 Dez. 2017
hi dear Jan this is first one
close all
clear all
[filename pathname] = uigetfile('*.avi','File Selector');
vid = strcat(pathname, filename);
obj = mmreader(vid);
vid = read(obj);
Frames = obj.NumberOfFrames;
new10=VideoWriter('output10.avi');
for x = 1 : Frames
blocks{x}=vid(:,:,:,x);
end
open(new10);
for f=1:1
ss=im2frame(blocks{f});
writeVideo(new10,ss);
end
close(new10);
msgbox('end of operation','Message','warn');
and this second one
close all
clear all
[filename pathname] = uigetfile('*.avi','File Selector');
vid = strcat(pathname, filename);
obj = mmreader(vid);
vid = read(obj);
frames = obj.NumberOfFrames;
new10=avifile('output10.avi','compression','None');
for x = 1 : frames
a=vid(:,:,:,x);
blocks{x}=a;
end
for f=1:frames
new10=addframe(new10,blocks{f});
end
new10=close(new10);
msgbox('end of operation','Message','warn');
regards
Majid
Majid Al-Sirafi
Majid Al-Sirafi am 17 Dez. 2017
these two files

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 17 Dez. 2017
Why not simply use copyfile()?
  1 Kommentar
Majid Al-Sirafi
Majid Al-Sirafi am 17 Dez. 2017
Actually, this copy is the first step in video processing. later I want to develop this procedure in another processing not just for copying
best regards Majid

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by