フィルターのクリア

Read 1fps mp4 usinf videoreader or equivalent

2 ビュー (過去 30 日間)
Amit
Amit 2016 年 1 月 28 日
コメント済み: Amit 2016 年 2 月 8 日
I have two identical 1fps mp4 files which I want to stitch side-by-side (its 16:9 and I want a duplicate 32:9).
I am trying to use an available code, but stumbling in the first line as following:
>> vid1 = VideoReader('Left.mp4');
Error using VideoReader/init (line 457)
Failed to initialize internal resources.
Error in VideoReader (line 146)
obj.init(fileName);
This may be because my file is non-standard 1fps. Can someone help. The overall code I am trying to use if courtesy @SamuelNLP on StackOverflow and is as follows (its for avi but I have mp4):
close all
clc
clear
vid1 = VideoReader('video1.avi');
vid2 = VideoReader('video2.avi');
videoPlayer = vision.VideoPlayer;
% new video
outputVideo = VideoWriter('newvideo.avi');
outputVideo.FrameRate = vid1.FrameRate;
open(outputVideo);
while hasFrame(vid1) && hasFrame(vid2)
img1 = readFrame(vid1);
img2 = readFrame(vid2);
imgt = horzcat(img1, img2);
% play video
step(videoPlayer, imgt);
% record new video
writeVideo(outputVideo, imgt);
end
release(videoPlayer);
close(outputVideo);
Thanks much. Good day all.
Regards, Amit

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 1 月 28 日
Are you using Linux? If so then you probably need to make a fix for gstreamer; see http://uk.mathworks.com/matlabcentral/answers/94531-why-do-i-receive-an-error-when-creating-a-videoreader-object-on-linux-in-matlab-r2010b-7-11 (Note that the problem has more symptoms than just those shown in that Question)
  2 件のコメント
Amit
Amit 2016 年 1 月 28 日
編集済み: Amit 2016 年 1 月 28 日
Dear Walter:
Thanks for your kind response. I am using Windows 10 and Matlab 2014a. I should have stated earlier.
The solution you pointed to is probably not applicable. For one, on windows I am not able to find the directory 'os' under 'sys'.
There are no more symptoms of problems as 2014a otherwise works perfectly fine for me.
Any further thoughts will be immensely useful.
Regards,
Amit
Walter Roberson
Walter Roberson 2016 年 1 月 28 日
Ah, what I referred to is Linux specific.

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


Walter Roberson
Walter Roberson 2016 年 1 月 28 日
  1 件のコメント
Amit
Amit 2016 年 2 月 8 日
Hi again. My codecs seem to be in order. I think the problem is with 1fps which is somehow non-standard. Thanks very much anyway. I ended up achieving objective in ffmpeg.

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

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by