Reading video file compressed losslessly with x264

조회 수: 6 (최근 30일)
Till
Till 2014년 11월 27일
답변: Walter 2019년 6월 19일
As the title suggests, I have a problem reading video frames from a video file compressed losslessly with x264. I am using MATLAB 2014b.
I have used x264 lossless compression in VirtualDub. The result is a video file that plays fine in VLC and can also be reopened in VirtualDub. I can also succesfully create a VideoReader object referencing to this video file. The VideoReader object gives me the correct video properties like FrameRate, Width, Height, and so forth. It even has the correct NumberOfFrames property.
However, when I first try to read frames from the object, MATLAB generates an error:
Error using VideoReader/readFrame (line 105)
No more frames available to read from file.
The same happens when I try the older command "read" and explicitly refer to frames I want to read (i.e. the first frame or the last frame, using Inf).
Interestingly, when I compress the same source video file with x264 and use the highest quality setting, i.e. almost lossless while keeping the other settings the same, then MATLAB is able to read frames from the compressed video.
Is that a bug? Do I need to adjust some settings in my codecs or is there another workaround?
Thanks in advance!
Till
  댓글 수: 1
Gaszton
Gaszton 2016년 1월 29일
Hi!
i just ran into the exact same problem.
Must be a bug.

댓글을 달려면 로그인하십시오.

답변 (2개)

Sergey Salishev
Sergey Salishev 2018년 5월 24일
It seems that the problem is due to pixel format yuv444.
I converted using the ffmpeg with the following command line and it magically works
ffmpeg -i %1.mkv -c:v libx264 -pix_fmt yuv420p -map 0:v:%2 %1_%2.mkv

Walter
Walter 2019년 6월 19일
THe recommendation by Sergey did not work for me on R2018a

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by