How to convert 4K mp4 video into frames?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
How do i convert 4K video into frames..
video recorded in gopro camera and stored in mp4 format.
채택된 답변
Nitin Kapgate
2021년 1월 11일
편집: Nitin Kapgate
2021년 1월 11일
You can refer to the code snippet below which demonstrates extraction of frames and export of the frames to a folder:
% import the in-built video file, replace 'xylophone.mp4' with your file name
vidObj = VideoReader('xylophone.mp4');
% read the total number of frames
frames = vidObj.NumFrames;
% file format of the frames to be saved in
imageFormat ='.png';
% create a new folder for frames
mkdir frames
% reading and writing the frames
for x = 1 : frames
% converting integer to string
frameIndex = num2str(x);
% concatenating 2 strings to get indexed frame name
frameName = strcat(frameIndex, imageFormat);
% read x'th frame from video
vidFrame = read(vidObj, x);
cd frames
% exporting the frames to the folder
imwrite(vidFrame, frameName);
cd ..
end
댓글 수: 5
Sir,
Thank you for you answer.. but, I'm getting this error
Error in VideoReader (line 104)
obj@audiovideo.internal.IVideoReader(varargin{:});
Error in gopro4k (line 2)
vidObj = VideoReader('GH010440.mp4');
Can you post the complete error log?
Vimal Raj
2021년 1월 19일
Yes sir,
>> gopro4k
Error using VideoReader/initReader (line 734)
Failed to initialize internal resources.
Error in audiovideo.internal.IVideoReader (line 136)
initReader(obj, fileName, currentTime);
Error in VideoReader (line 104)
obj@audiovideo.internal.IVideoReader(varargin{:});
Error in gopro4k (line 2)
vidObj = VideoReader('GH010440.mp4');
I understand that the error "Failed to Initialize internal resources" pops up when trying to use the 'VideoReader' function.
There could be various reasons behind this error which are listed as follows:
- The required codec is missing for the particular video file. Determine whether the codec is installed on the computer.
- The video file contains an audio stream (eg. AC-3) not supported by the API (QTKit, in AC-3 case) used by VideoReader. The only workaround is to re-encode the audio stream in the file into a different format such as MPEG-4/AAC and then try to read the file.
- Sometimes, VideoReader cannot open a video file for reading on Windows platforms. This might occur if you have installed a third-party codec that overrides your system settings. Uninstall the codec and try opening the video file in MATLAB again.
The supported container formats and codecs link explains supported codecs in detail. Go through the troubleshooting section to determine if that could be a possibility in this particular case.
Vimal Raj
2021년 1월 20일
Thank you sir... Thank you soo Much. it works..
One more clarification sir, after convering the format, the quality seems tobe lowered than the original video.
The reason why i go for 4K is its quality only. but, after conversion process, the video and frames look like a compressed one (diminished colors). Size of the video also reduced to half of the original.
Any way to rectify that sir.. Also, at the end of frame conversion, again getting this error sir
>> gopro4k
Error using pngwritec
PNG library failed: Write Error.
Error in writepng (line 280)
pngwritec(data, map, filename, colortype, bitdepth, ...
Error in imwrite (line 546)
feval(fmt_s.write, data, map, filename, paramPairs{:});
Error in gopro4k (line 27)
imwrite(vidFrame, frameName );
An error was encountered while saving the command history
추가 답변 (0개)
카테고리
도움말 센터 및 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!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
