Ffmpeg-python: exr's to mov only reads one frame

Created on 22 Sep 2018  路  19Comments  路  Source: kkroening/ffmpeg-python

Ive given the tool a folder to a number of EXR's numbered with the following convention
something_something_something.1765700.exr
these sequence goes from say 1765506 to 1765719

but the tool only reads ONE frame and even says the stream is reading just one frame code is as follows

stream = ffmpeg.input('path to the first exr', framerate=25, patter_type='glob')
stream = ffmpeg.output(stream, 'test.mp4')
ffmpeg.run(stream)

but i only get one frame

[exr_pipe @ 0x7ff484801200] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, exr_pipe, from '/Volumes/FBH/_output/internal/to_vfx_editorial/EXR/0001_F301C013_180126_R0DQ/F301C013_180126_R0DQ.1765506.exr':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: exr, rgb48le, 2048x967 [SAR 1:1 DAR 2048:967], 24 tbr, 24 tbn, 24 tbc
Stream mapping:
Stream #0:0 -> #0:0 (exr (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'flip.mp4':
Metadata:
encoder : Lavf58.18.100
Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 2048x967 [SAR 1:1 DAR 2048:967], q=2-31, 200 kb/s, 24 fps, 12288 tbn, 24 tbc
Metadata:
encoder : Lavc58.27.101 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 1 fps=0.0 q=7.5 Lsize= 76kB time=00:00:00.00 bitrate=7677234.6kbits/s speed=0.000746x
video:75kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.114797%
[Finished in 3.1s]

Most helpful comment

Have you tried replacing %7d by *? (without the start=...)

All 19 comments

This is does not look like an ffmpeg-python issue, but rather a matter of input arguments.

If I understand correctly, you are trying to generate a movie from a sequence of images. If so, then the correct input is a pattern (instead of a filename), something like (in pure ffmpeg):
ffmpeg -r 25 -i path/to/something_something_something.%7d.exr -start 1765506 ...
This assumes:

  • that all image names follow the pattern "something_something_something.%7d.exr", meaning something_something_something.<7 digit number>.exr;
  • that images are numbered consecutively;
  • that the first image has number 1765506.

Read more for instance here: https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/image_sequence

With ffmpeg-python you could try:
stream = ffmpeg.input('path/to/something_something_something.%7d.exr', framerate=25, start=1765506)

Hope this helps,
Pierre

See this example: https://github.com/kkroening/ffmpeg-python/tree/master/examples#assemble-video-from-sequence-of-frames

So: ffmpeg.input('/path/to/frames/*.exr', pattern_type='glob', framerate=25)

tried both didnt work

@pderian
[image2 @ 0x7fd0dd802e00] Could not open file : /Volumes/FBH/_output/internal/to_vfx_editorial/EXR/0001_F301C013_180126_R0DQ/F301C013_180126_R0DQ.%7d.exr
[image2 @ 0x7fd0dd802e00] Could not find codec parameters for stream 0 (Video: exr, none): unspecified size

@pderian
yup am aware of that trying to find a way to make it work for me, isnt working hence the question here

@Shaunimsorry
Mhm... Out of curiosity, did it work in pure ffmpeg?

ffmpeg -r 25 -i /Volumes/FBH/_output/internal/to_vfx_editorial/EXR/0001_F301C013_180126_R0DQ/F301C013_180126_R0DQ.%7d.exr -start 1765506 test.mp4

@pderian
i was never able to get ffmpeg running it was SUPER complex for me so i ended up just trying to go off the python version from kkroening seemed much easier for me to just keep it this way that my supervisors can call on and use without having to install the FFMPEG thingofajig

im still trying to find out why its having a hard time because even before your comment i had tried adding %7d as per the documentation but then it just breaks, single frame works fine.

this is my current code

stream = ffmpeg.input('/Volumes/FBH/_output/internal/to_vfx_editorial/EXR/0001_F301C013_180126_R0DQ/F301C013_180126_R0DQ.%7d.exr', pattern_type='glob', framerate=25, start=1765506)
stream = ffmpeg.output(stream, 'flip.mp4')
ffmpeg.run(stream)

this is the output

fmpeg version N-91814-gc4cda4eb87 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
  configuration: 
  libavutil      56. 19.100 / 56. 19.100
  libavcodec     58. 27.101 / 58. 27.101
  libavformat    58. 18.100 / 58. 18.100
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 27.100 /  7. 27.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
Option start not found.
Traceback (most recent call last):
  File "/Volumes/FBH/_pipeline/bin/pythonStudioTools/bin/bbtools/exrtoMov/v0001/exrtoMov.py", line 16, in <module>
    ffmpeg.run(stream)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ffmpeg/_run.py", line 212, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

alright this works fine

inputstream = 'smb://100.0.0.43/FBH/_output/internal/to_vfx_editorial/EXR/0001_F301C013_180126_R0DQ/F301C013_180126_R0DQ.%7d.exr'
fixed = inputstream.replace("smb://100.0.0.43", "/Volumes")


stream = ffmpeg.input('/Volumes/FBH/_output/internal/to_vfx_editorial/EXR/0001_F301C013_180126_R0DQ/F301C013_180126_R0DQ.1765506.exr', pattern_type='glob', framerate=25)
stream = ffmpeg.output(stream, 'flip.mp4')
ffmpeg.run(stream)

when when i try to add the %7d or say start=#### it breaks it

Have you tried replacing %7d by *? (without the start=...)

@153957
That worked Arne!
thank you but can you explain why ? I mean i understand how to use * but why does the "%7d" fail ?
also thanks for helping

See the explanation of the different pattern_type options here: https://ffmpeg.org/ffmpeg-formats.html#image2-1

I guess that pattern_type='sequence' could also have worked if you used %07d. In most cases I prefer the easy way and just use * (with pattern_type='glob') so I don't have to worry about number of digits and exact file names.

@153957 so ive had immense success running the tool seems to stitch just fun i have a new strange error now that im asking here to avoid making double tools, on another system (dispite installing ffmpeg-python) its now throwing an OSERROR [Errno 2] at me. My machine is fine but if i run the script in edit it breaks with a no such file or directory every time i run the stitcher.

That means that the path to the images or ffmpeg is probably incorrect for that system.

@153957 yeah really strange works fine if i run it in termainal on my system, works fine if i use the python launcher (on my system) breaks if i use edit and breaks on all systems on the test users system.

also think it cant find the source image...dont know why

screen shot 2018-09-25 at 7 42 11 pm

cant seem to even trouble shoot because its working on some systems but not on others
totally lost for steps to trouble shoot..maybe im hungry @153957 haha

this is how simple this test is thats breaking on my system
trying abspath as well no joy

screen shot 2018-09-25 at 7 51 20 pm

@Shaunimsorry : as @153957 pointed out, it seems that ffmpeg is either:
1 - not installed in the system,
2 - or installed but not in the system PATH.

If ffmpeg is installed but not in the path, and you can't add it for whatever reason, you could also try
ffmpeg.run(stream, cmd='/path/to/ffmpeg')

works fine now thanks guys

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CNugteren picture CNugteren  路  5Comments

Matttman picture Matttman  路  6Comments

monokal picture monokal  路  3Comments

cbitterfield picture cbitterfield  路  4Comments

nathanaelneveux picture nathanaelneveux  路  4Comments