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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th February 2014, 15:17   #1  |  Link
Nozdrum
Registered User
 
Join Date: May 2013
Posts: 31
Extracting frames from mp4 clip using ffmpeg

Hi, I'm using ffmpeg to extract all frames contained in a 10 seconds mp4 file (avc/no audio), this is the syntax of the bat file (name: "extract-frames.bat"):

Code:
ffmpeg -i input.mp4 -r 1 output%05d.png
pause
But only the first frame is extracted correctly, then it returns this error:

Code:
[image2 @ 022fcce0] Could not open file : outputC:\Jan2014\01\extract-frames.bat5d.png
av_interleaved_write_frame(): Input/output error
I think the batch syntax "%0" causes the conflict within the output file name, do you know an alternative to this syntax that could work correctly for ffmpeg?

I was following this example:
http://www.alecjacobson.com/weblog/?p=2102
Nozdrum is offline   Reply With Quote
Old 10th February 2014, 15:33   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,003
Found this with a quick Google search:
FFMPEG - Making an Image Sequence from a video

Code:
ffmpeg -i "input.mov" -an -f image2 "output_%05d.jpg"
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 10th February 2014 at 15:48.
LoRd_MuldeR is offline   Reply With Quote
Old 10th February 2014, 16:28   #3  |  Link
Nozdrum
Registered User
 
Join Date: May 2013
Posts: 31
The problem is that %0 in batch always causes the same issue, even with that command line:

Code:
[image2 @ 024ad520] Could not open file : output_C:\Jan2014\01\extract-frames.bat5d.jpg
av_interleaved_write_frame(): Input/output error
Maybe I need to get an updated ffmpeg.exe, I'll try again with a different version.

Edit: tried with latest build from here but the problem is the same, probably %0 shouldn't be used.

Last edited by Nozdrum; 10th February 2014 at 16:37.
Nozdrum is offline   Reply With Quote
Old 10th February 2014, 16:58   #4  |  Link
Nozdrum
Registered User
 
Join Date: May 2013
Posts: 31
Quote:
Originally Posted by LoRd_MuldeR View Post
Found this with a quick Google search:
FFMPEG - Making an Image Sequence from a video

Code:
ffmpeg -i "input.mov" -an -f image2 "output_%05d.jpg"
Thanks it works, I just needed to escape the "%" symbol, it should be:

Code:
ffmpeg -i "input.mov" -an -f image2 "output_%%05d.jpg"
Nozdrum is offline   Reply With Quote
Old 10th February 2014, 17:19   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,793
Does anyone know how to get ffmpeg to start numbering at frame "zero" instead of frame "one" for exporting image sequences ?
poisondeathray is offline   Reply With Quote
Old 10th February 2014, 17:28   #6  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 9,687
Try adding a "-start_number 0" parameter.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 10th February 2014, 17:32   #7  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,793
Quote:
Originally Posted by nevcairiel View Post
Try adding a "-start_number 0" parameter.
It works, thanks!
poisondeathray is offline   Reply With Quote
Old 13th February 2014, 08:26   #8  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 5,814
Nice, didn't know that there is a '-start_number' parameter
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Reply

Tags
batch, extract, ffmpeg, frames, mp4

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.