开发者

Recording Video with FFmpeg gives "The filename, directory name, or volume label syntax is incorrect."

开发者 https://www.devze.com 2023-01-10 02:19 出处:网络
I\'m trying to record video (with audio!) in this way: ffmpeg = \"C:\\bin\\ffmpeg.exe\" cmd = \'%s -r 15 -f vfwcap -i 0 c:/output2.mpg\' % 开发者_Python百科(ffmpeg)

I'm trying to record video (with audio!) in this way:

ffmpeg = "C:\bin\ffmpeg.exe"
cmd = '%s -r 15 -f vfwcap -i 0 c:/output2.mpg' % 开发者_Python百科(ffmpeg)
os.system(cmd)

And I have the error: "The filename, directory name, or volume label syntax is incorrect." I think that this is a problem with vfwcap, but I don't know how to fix it.

Any ideas? Maby something else is wrong?


I think mermoz must be joking with you. You've got a few problems here. Python uses '\' as an escape character, so it won't find your file unless you either double them up or switch to forward slashes, as you've then done in your cmd. The syntax of your ffmpeg command line is also completely wrong. You're saying you want to set the frames per minute to 15 and format vfwcap to your inputfile, which is "0." Also you shouldn't use os.system. Use subprocess.popen and pass your commands as lists. Not sure if this question is serious, but if so, this should start you in the right direction.


isn't it just the small c in "c:/output.mpg" instead of "C:/output.mpg"?


The direct problem is that the \ in the command line are being interpreted as control chars, use either c: \ \ or use c:/

As Profane says you have the output file flags wrong for ffmpeg

0

精彩评论

暂无评论...
验证码 换一张
取 消