butterflow fails to write output when output rate is not 30fps
See original GitHub issueBy sheer luck, I tried 30fps for my first run of butterflow, and it worked great. This was my incantation:
butterflow -e -m -v -r30 in.mp4 -o interp.mp4
(in.mp4 is a 24000/1001 1920x1040 video) It also succeeds with 30000 / 1001, 48000 / 1001, and 96000 / 1001 But when I tried it with 59.95, and 60, it fails
[aaron@aka Wall Street REMASTERED (1987) [1080p]]$ butterflow -e -m -v -r60 in.mp4 -o interp.mp4
[butterflow:INFO]: Version 0.2.3
[butterflow:INFO]: Cache directory: /tmp/butterflow-0.2.3
[butterflow:INFO]: At least one compatible OpenCL device was detected
[butterflow:INFO]: Using device: Ellesmere (autoselected)
[butterflow:INFO]: Hardware acceleration is enabled
[butterflow:INFO]: Rendering:
[butterflow:INFO]: Sequence: Duration=0:00:10.110000 (10.11s), Frames=242, Rate=23.9760246277
[butterflow:INFO]: Subregion (0): Time=0:00:00-0:00:10.110000 Frames=0-241 Speed=1.0,Duration=?,Fps=?
[butterflow:INFO]: Rendering to: in.24805.mp4
[butterflow:INFO]: Final destination: interp.mp4
[butterflow:INFO]: [Subprocess] Opening a pipe to the video writer
[butterflow:INFO]: Rendering progress: 0.00%
[butterflow:INFO]: Start working on Subregion (0): Time=0:00:00-0:00:10.110000 Frames=0-241 Speed=1.0,Duration=?,Fps=?
[butterflow:INFO]: Frames in region: 0-241
[butterflow:INFO]: Region length: 242
[butterflow:INFO]: Region duration: 10.110000s
[butterflow:INFO]: Number of frame pairs: 241
[butterflow:INFO]: Interpolation rate: 2
[butterflow:INFO]: Time stepping: 0.333,0.667
[butterflow:INFO]: Frames to write: 606
[butterflow:INFO]: Will interpolate: 723
[butterflow:INFO]: Extra frames (to discard): 117
[butterflow:INFO]: Drop every: 6
[butterflow:INFO]: Dupe every: 0
[butterflow:INFO]: Ready to run: 242 times
[butterflow:INFO]: Showing a sample of the first and last 15 runs:
[butterflow:INFO]: To write: S0 I1,1 0.33%
[butterflow:INFO]: To write: S1 I2,0 0.83%
[butterflow:INFO]: To write: S2 I1,1 1.16%
[butterflow:INFO]: To write: S3 I1,1 1.49%
[butterflow:INFO]: To write: S4 I2,0 1.98%
[butterflow:INFO]: To write: S5 I1,1 2.31%
[butterflow:INFO]: To write: S6 I2,0 2.81%
[butterflow:INFO]: To write: S7 I1,1 3.14%
[butterflow:INFO]: To write: S8 I1,1 3.47%
[butterflow:INFO]: To write: S9 I2,0 3.96%
[butterflow:INFO]: To write: S10 I1,1 4.29%
[butterflow:INFO]: To write: S11 I2,0 4.79%
[butterflow:INFO]: To write: S12 I1,1 5.12%
[butterflow:INFO]: To write: S13 I1,1 5.45%
[butterflow:INFO]: To write: S14 I2,0 5.94%
[butterflow:INFO]: To write: S15 I1,1 6.27%
[butterflow:INFO]: <Snipping 212 runs from the console, but will update progress periodically every 21 frames rendered>
[butterflow:INFO]: <Rendering progress: 8.25%>
[butterflow:INFO]: <Rendering progress: 16.67%>
[butterflow:INFO]: <Rendering progress: 25.25%>
[butterflow:INFO]: <Rendering progress: 33.50%>
[butterflow:INFO]: <Rendering progress: 41.91%>
[butterflow:INFO]: <Rendering progress: 50.33%>
[butterflow:INFO]: <Rendering progress: 58.91%>
[butterflow:INFO]: <Rendering progress: 67.33%>
[butterflow:INFO]: <Rendering progress: 75.74%>
[butterflow:INFO]: <Rendering progress: 83.99%>
[butterflow:WARNING]: B is None
[butterflow:INFO]: To write: S216
[butterflow:WARNING]: Dropping S216
[butterflow:INFO]: Run 217 (this is the final run):
[butterflow:ERROR]: A is None
[butterflow:INFO]: To write: S217
Traceback (most recent call last):
File "/usr/bin/butterflow", line 11, in <module>
load_entry_point('butterflow==0.2.3', 'console_scripts', 'butterflow')()
File "/usr/lib/python2.7/site-packages/butterflow/cli.py", line 441, in main
number=1)
File "/usr/lib/python2.7/timeit.py", line 237, in timeit
return Timer(stmt, setup, timer).timeit(number)
File "/usr/lib/python2.7/timeit.py", line 202, in timeit
timing = self.inner(it, self.timer)
File "/usr/lib/python2.7/timeit.py", line 100, in inner
_func()
File "/usr/lib/python2.7/site-packages/butterflow/render.py", line 467, in render
self.render_subregion(sub)
File "/usr/lib/python2.7/site-packages/butterflow/render.py", line 414, in render_subregion
draw.draw_marker(fr, fill=fr_type == 'INTERPOLATED')
File "/usr/lib/python2.7/site-packages/butterflow/draw.py", line 15, in wrapper
scale = min(float(fr.shape[1]) / float(w_fits),
AttributeError: 'NoneType' object has no attribute 'shape'
[butterflow:INFO]: [Subprocess] Closing pipe to the video writer
It seems to be failing somewhere in the middle of the video output.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
How to encode a video at 30 FPS from images taken at 7 FPS
The image demuxer uses -framerate , while the output frame rate is set using -r . Error: Option framerate not found. The -framerate...
Read more >Change the frame rate of an MP4 video with ffmpeg - Super User
Note that this method will drop frames to achieve the desired speed. You can avoid dropped frames by specifying a higher output frame...
Read more >A Plague Tale Requiem might also be locked at 30fps on ...
EDIT: Someone pointed out that it might be a 30 fps capture uploaded ... This was an unexpected circumstance, as the game will...
Read more >H.264 render of 24fps reverts to 30fps in output
The adobe media encoder does not do as good a job interpreting between frames if you force a different frame rate, but the...
Read more >Is it true that movies only have 30 fps? If so, why not ... - Quora
Standard movie frame rate is 24 frames per second, meaning 24 different pictures are shown on the screen every single second. In the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Glad it worked for you. Though butterflow should be used on the original file so it has as much data to use for the new output as possible. It is possible to both upscale the frame rate and increase the duration as well.
Thanks @wagesj45 that works! I think I’ve figured it out what went wrong for me. TLDR: butterflow was looking for frames that didn’t exist, because ffmpeg did not update frame rate metadata correctly after slowing video down with setpts.
I had already slowed my input file to 80% of the original speed with ffmpeg, then was trying to use butterflow to smooth it as ffmpeg minterpolate didn’t work for me (I have since found out all I needed to do was change
-filter
to-filter:v
. But butterflow works better anyway)In the log I noticed there are 2586 frames and it errors on the 2069th frame: 2069 / 2586 = 0.800077 = 80%
So it is erroring 80% of the way through a video I have slowed to 80% the original frame rate. Original video is 30fps. After slowing it down it should be 24 fps, but the metadata still shows 2586 frames at 30fps:
[butterflow:INFO]: Sequence: Duration=0:01:26.302000 (86.30s), Frames=2586, Rate=29.9700298309
After using your command, except I start with an mkv and convert to mp4, I get the correct 24fps metadata:
[butterflow:INFO]: Sequence: Duration=0:01:26.289000 (86.29s), Frames=2069, Rate=23.9776325226
So I guess ffmpeg doesn’t update frame rate metadata after changing video speed with setpts.