Cory Gwin
Cory Gwin

Reputation: 1243

Python and ffmpeg

I am attempting to call ffmpeg to create an image from a frame in a video, I am using python to do this with subprocess.Popen on a mac, eventually this will move to a unix server.

I can successfully create a video from the command line with this line

ffmpeg -i /Users/bimemployee/Movies/ski\ commute.m4v -r .5 -vframes 1 -ss 00:01:14 /Users/bimemployee/Movies/untitled\ folder/image-%d.jpeg

I then turn this into a python iterable and passed it Popen

s=["ffmpeg","-i","Users/bimemployee/Movies/ski\ commute.m4v","-r","1","-vframes","1","-ss","00:01:14","/Users/bimemployee/Movies/untitled\ folder/image-%d.jpeg"]
subprocess.Popen(s)

When I do so I get the standard info screen from ffmpeg and an error that says Users/bimemployee/Movies/ski\ commute.m4v: No such file or directory

Why would this path work ok from the command line but not from python?

Secondly is their a better library for handling this, the ones I could find don't seem to be active projects or don't work with straight python but require things like cython.

Thanks, CG

Upvotes: 1

Views: 4386

Answers (1)

DSM
DSM

Reputation: 353059

You're missing the opening forward slash:

/Users/bimemployee/Movies/ski_commute.m4v

is not the same as

Users/bimemployee/Movies/ski_commute.m4v

Upvotes: 3

Related Questions