Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
14th August 2020, 06:35 | #1 | Link |
Registered User
Join Date: Jan 2017
Posts: 37
|
How to convert a video to images?
Hi, so I did some googling and according to this article: https://www.alexkras.com/convert-vid...-command-line/
I should be able to do so with this command in FFMPEG: Code:
ffmpeg -i 1.mkv -r 24 a/output_%05d.png av_interleaved_write_frame(): I/O error This one: https://gist.github.com/savvot/9e4316dc68f6111f7b1f My version: Code:
ffmpeg -ss 00:14:13.000 -i "1.mkv" -t 00:00:13.000 -q:v 2 -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync 0 frame%03d.jpg Except I get this error: [image2 @ 000000000068d880] Could not open file : frameH:\FFMPEG\bin\1.bat3d.jpg av_interleaved_write_frame(): I/O error What am I doing wrong? Probably lots as I'm not really a CLI kind of person and prefer and dumb down GUI one, but there is no such thing, at least according to my google searches...although there are websites that would do this for you but I'm not going to upload a massive file...that's gonna take forever! So chose to do a local method with something I already have installed. |
14th August 2020, 12:08 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Maybe of some little help.
test.bat Code:
REM test.bat : With location of ffmpeg.exe in environment PATH, and empty IMG directory relative to test.bat file. REM Gotta have double %% in bat for it to work, or single if direct on command line, also used %%06d (not %%05d) as 100,000 [0->99999] frames max potentially a bit low for long src clip. REM r 1, 1 frame per second (originally 24) REM writes png files to IMG directory relative bat file. ffmpeg -i 1.mkv -r 1 "IMG/output_%%06d.png" Code:
ffmpeg -i 1.mkv -r 1 "output_%%06d.png" Code:
ffmpeg -i 1.mkv -r 1 "H:\IMG\output_%%06d.png" Code:
ffmpeg -i 1.mkv -r 1 "H:\IMG\output_%06d.png" Your "a/output_%05d.png", with single '%', CLI BAT processing, interprets the name of your test.bat as an arg inserted into the output filename eg (from your error line) "a/output_H:\FFMPEG\bin\1.bat5d.png" so your original bat file was "H:\FFMPEG\bin\1.bat". [error was originating in bat processing, not ffmpeg] Hope that you can use above to figure out how to get 2nd comand working, good luck.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 14th August 2020 at 14:46. |
15th August 2020, 08:46 | #3 | Link | |
Registered User
Join Date: Jan 2017
Posts: 37
|
Quote:
New line which combines both aspects: Code:
ffmpeg -ss 00:14:04.000 -i "1.mkv" -t 00:00:12.000 -r 23.97602397602398 a/output_%%04d.png Last edited by egr; 15th August 2020 at 08:52. |
|
15th August 2020, 11:50 | #4 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
best if you adopt a standard max number of frames, 6 digits cope with up to a million frames, and no screwing around when you change requirment. (avisynth standard is 6 digits with good reason). A longish single movie can easily have hundreds of thousands of frames at standard 24/25FPS. Also, any script to process output frame names might have to be edited whenever you change 4 decimal naming scheme, so best stick with something that dont need constant editing. Quote:
I think that this is the keyframe selection : -vf select="eq(pict_type\,PICT_TYPE_I)" EDIT: Maybe removing "-r 23.97602397602398" will just output all frames using input framerate for 12 seconds, dont know.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 15th August 2020 at 11:59. |
||
25th August 2020, 06:11 | #5 | Link | |
Registered User
Join Date: Jan 2017
Posts: 37
|
Quote:
Oh I guess I was wrong then if your bit is to select keyframes.... You're right, leaving the -r command and value outputs frames using input framerate source.... Hows it looking now: Code:
ffmpeg -ss 00:00:00.000 -i "grab.mp4" -vf select="eq(pict_type\,PICT_TYPE_I)" -t 00:00:08.000 e/output_%%06d.png |
|
25th August 2020, 14:59 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
I dont see anything obviously wrong, but then I aint no expert, just a novice.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
26th August 2020, 15:55 | #10 | Link |
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
|
What is the objective?
If you want all extract all the frames for a given time period it is obviously not enough to only select keyframes. Basically everything is compressed in a video including keyframes. The idea that I frames are great and P and B frames are bad is an unrealistic simplification. |
10th September 2020, 17:10 | #11 | Link | |
Registered User
Join Date: Jan 2017
Posts: 37
|
Quote:
|
|
10th September 2020, 20:29 | #12 | Link |
Registered User
Join Date: Jun 2020
Posts: 303
|
Keyframes
Depending on encoding parameters, Keyframes may be more meaningful than other frames (ex: inserted on scene changes in movie encodes, they also allow lossless cutting with h264/hevc). There also less keyframes than regular frames. Ex 100min movie: - 100*60*24=144000 frames - 1000 keyframes if average duration is 6s Keyframes are also used for seeking in video players such as mcp-hc and video editors such as avidemux, vdub2, so they are good to use for screenshots. Keyframes usually give the best result, when choosing a thumbnail for compressed video.
__________________
bShaders: realtime Effects/filters for video players Last edited by butterw2; 10th September 2020 at 21:14. |
20th September 2020, 12:02 | #14 | Link |
Registered User
Join Date: Jun 2020
Posts: 303
|
As was pointed out, all frames can be used, it just depends what your goal is.
If you don't need all frames: output only 1 frame per second for exemple, or keyframes only. It's worth noting that all frames of a video could be keyframes in some cases (depends on encoding parameters).
__________________
bShaders: realtime Effects/filters for video players |
Thread Tools | Search this Thread |
Display Modes | |
|
|