Getting lossless images from mjpeg
이전 댓글 표시
I am learning with video to image conversion and vice versa.
I had a mjpeg of 3 sec, when i converted to jpeg images i got 55 images.
then i used all 55 images to make a mjpeg video but the video is not of 3 sec anymore
Please tell me correct way of video to image conversion and vice versa. i am not getting where i am going wrong.
채택된 답변
추가 답변 (2개)
Walter Roberson
2019년 1월 16일
0 개 추천
It is impossible to get lossless images from Motion JPEG. mjpeg inherently uses lossy jpeg compression .
However it sounds to me as if you did not tell the video writer that the frame rate should be 55/3 frames per second. (I suspect your real frame rate is either 18 or 20 fps and that 3 seconds is an approximation )
Iqra Saleem
2019년 1월 27일
0 개 추천
Hey;
Varsha Natraj , can you tell me please how you convert motion jpeg to jpeg images?
댓글 수: 6
Walter Roberson
2019년 1월 27일
Use VideoReader (basic MATLAB) or vision.VideoFileReader (Computer Vision Toolbox) to read frame by frame from the motion JPEG file, and imwrite() each frame to a file.
Iqra Saleem
2019년 1월 27일
Thanks for your reply , i am using VideoReader in matlab but this error appear.
Error using VideoReader/init (line 619)
Unable to determine the codec required.
my video is motion jpeg with .mjpeg extension
Iqra Saleem
2019년 1월 30일
i am not getting your point. kindly help me, I want to read motion jpeg video in matlab but this error occurs:
Error using VideoReader/errorIfImageFormat (line 494)
The filename specified is an image file. Use imread instead of VideoReader.
Error in VideoReader/init (line 612) VideoReader.errorIfImageFormat(fullName);
Error in Untitled2 (line 5)
xyloObj = VideoReader('akiyo_CIF.mjpg');
Iqra Saleem
2019년 1월 30일
My matlab code is :
clc
close all
clear all
info = mmfileinfo('akiyo_CIF.mjpg');
xyloObj = VideoReader('akiyo_CIF.mjpg');
get(xyloObj)
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
% Preallocate movie structure.
mov(1:nFrames) = ...
struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
'colormap', []);
% Read one frame at a time.
for k = 1 : 3
mov(k).cdata = read(xyloObj, k);
end
% Size a figure based on the video's width and height.
hf = figure;
set(hf, 'position', [150 150 vidWidth vidHeight])
% Play back the movie once at the video's frame rate.
movie(hf, mov, 1, xyloObj.FrameRate);
Walter Roberson
2019년 1월 30일
Except possibly on Linux, .mpeg or .mjpg is not a supported video format. Motion JPEG is supported inside of .avi
카테고리
도움말 센터 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!