mencoder 生成空的 .avi 文件
我从 python 脚本调用 mencoder 从各种 .png 文件生成电影:
import sys, os
command = ''.join([
'mplayer\mencoder.exe ',
'mf://frames/out_*.png ',
'-mf type=png:w=800:h=600:fps=10 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o out.avi '
])
print "executing", command
os.system(command)
mencoder 给我一个 4KB out.avi 和此输出:
C:\Windows\system32\cmd.exe /c python make_video.py executing mplayer\mencoder.exe mf://frames/out_*.png -mf type=png:w=800:h=600:fps=10 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o out.avi MEncoder Sherpya-SVN-r34118-4.2.5 (C) 2000-2011 MPlayer Team success: format: 16 data: 0x0 - 0x0 MF file format detected. [mf] search expr: frames/out_*.png [mf] number of files: 129 (516) VIDEO: [MPNG] 800x600 24bpp 10.000 fps 0.0 kbps ( 0.0 kbyte/s) [V] filefmt:16 fourcc:0x474E504D size:800x600 fps:10.000 ftime:=0.1000 Opening video filter: [expand osd=1] Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffpng] vfm: ffmpeg (FFmpeg PNG) ========================================================================== Flushing video frames. Filters have not been configured! Empty file? Writing index... Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Video stream: nan kbit/s (-2147483648 B/s) size: 0 bytes 0.000 secs 0 frames
请帮忙。
i am calling mencoder from a python script to generate a movie from various .png files:
import sys, os
command = ''.join([
'mplayer\mencoder.exe ',
'mf://frames/out_*.png ',
'-mf type=png:w=800:h=600:fps=10 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o out.avi '
])
print "executing", command
os.system(command)
mencoder gives me a 4KB out.avi and this output:
C:\Windows\system32\cmd.exe /c python make_video.py executing mplayer\mencoder.exe mf://frames/out_*.png -mf type=png:w=800:h=600:fps=10 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o out.avi MEncoder Sherpya-SVN-r34118-4.2.5 (C) 2000-2011 MPlayer Team success: format: 16 data: 0x0 - 0x0 MF file format detected. [mf] search expr: frames/out_*.png [mf] number of files: 129 (516) VIDEO: [MPNG] 800x600 24bpp 10.000 fps 0.0 kbps ( 0.0 kbyte/s) [V] filefmt:16 fourcc:0x474E504D size:800x600 fps:10.000 ftime:=0.1000 Opening video filter: [expand osd=1] Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffpng] vfm: ffmpeg (FFmpeg PNG) ========================================================================== Flushing video frames. Filters have not been configured! Empty file? Writing index... Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Video stream: nan kbit/s (-2147483648 B/s) size: 0 bytes 0.000 secs 0 frames
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这是一个旧线程,但我遇到了同样的问题,所以我想分享我的解决方案,以防其他人遇到同一页面。
基本上,当尝试从源文件夹位置之外运行 mencoder 时,就会出现错误。因此,要使其正常工作,只需将 CD 放入包含源图像的文件夹中,然后从那里运行命令即可。
或者您可以修改 python 脚本并在运行 mencoder 之前添加一行将当前路径更改为源图像路径。像这样的东西:
os.chdir(sourcefolder) # 其中 sourcefolder 是源图像的位置
干杯!
-凯文
I guess this is an old thread, but i was having the same issue so thought I'd share my solution in case someone else runs into this same page.
basically the error comes in when trying to run mencoder from outside your source folder location. so to get this to work, just CD into the folder with your source images and run the command from there.
OR you can modify your python script and add a line changing the current path to your source image path just before running mencoder. Something like:
os.chdir(sourcefolder) # where sourcefolder is the location of your source images
Cheers!
-Kevin