Reputation: 85
I have this command in ffmpeg that I want to write in Python,
ffmpeg -ss 00:12:14 -i video.mp4 -vframes 1 output.png
Is it possible to write this in Python?
Upvotes: 1
Views: 1647
Reputation: 2293
using the python bindings, you'd write it like this:
ffmpeg.input('video.mp4', vframes=1, ss=('00:12:14')).output('output.png').run()
(not 100% sure if the ss filter takes the time params like this, if that doesn't work use count of seconds instead)
Upvotes: 1
Reputation: 2425
Kinda depends on what you mean by 'write this in Python'.
Using the subprocess module:
import subprocess
cmd = ['ffmpeg', '-ss', '00:12:14', '-i', 'video.mp4', '-vframes', '1', 'output.png']
cmdproc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
while True:
line = cmdproc.stdout.readline()
if not line:
break
(or something similar, since there's check_output(), call()...)
If you mean by a 'native' way of doing that, you can try out ffmpeg-python [1], though I know nothing about that.
[1] - https://github.com/kkroening/ffmpeg-python
Upvotes: 1