如果我通过将以下代码粘贴到 cmd 或 powershell 中来启动它,它可以正常工作。
@echo off
C:\Users\sohba\Downloads\0ffmpeg\bin\ffmpeg -f dshow -i video="CC1" -vf "fps=0.5,drawtext=fontfile=/Windows/Fonts/Arial.ttf:text='%{localtime}':x=(w-tw)/2:y=h-(2*lh):fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -q:v 2 -t 9 "C:\Users\sohba\Downloads\0ffmpeg\t1\frame%03d.jpg"
但如果我创建一个批处理文件camera1.bat
或camera1.cmd
双击它,它将不起作用,它说
[image2 @ 0000019fc1833c40] The specified filename 'C:\Users\sohba\Downloads\0ffmpeg\t1\frameC:\Users\sohba\Downloads\0ffmpeg\camera1.bat3d.jpg' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 0000019fc1833c40] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
[image2 @ 0000019fc1833c40] Could not open file : C:\Users\sohba\Downloads\0ffmpeg\t1\frameC:\Users\sohba\Downloads\0ffmpeg\camera1.bat3d.jpg
[vost#0:0/mjpeg @ 0000019fc1834580] Error submitting a packet to the muxer: I/O error
Last message repeated 1 times
[out#0/image2 @ 0000019fc1823840] Error muxing a packet
[out#0/image2 @ 0000019fc1823840] Task finished with error code: -5 (I/O error)
[out#0/image2 @ 0000019fc1823840] Terminating thread with return code -5 (I/O error)
有人知道如何解决这个问题吗?
更新了蝙蝠
C:\Users\sohba\Downloads\0ffmpeg\bin\ffmpeg -f dshow -i video="CC!" -vf "fps=0.5,drawtext=fontfile=/Windows/Fonts/Arial.ttf:text='%%{localtime}':x=(w-tw)/2:y=h-(2*lh):fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=30" -q:v 2 -t 9 "C:\Users\sohba\Downloads\0ffmpeg\t1\frame%03d.jpg"
错误
[image2 @ 0000024031943cc0] The specified filename 'C:\Users\sohba\Downloads\0ffmpeg\t1\frameC:\Users\sohba\Downloads\0ffmpeg\camera1.bat3d.jpg' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 0000024031943cc0] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
[image2 @ 0000024031943cc0] Could not open file : C:\Users\sohba\Downloads\0ffmpeg\t1\frameC:\Users\sohba\Downloads\0ffmpeg\camera1.bat3d.jpg
[vost#0:0/mjpeg @ 0000024031944540] Error submitting a packet to the muxer: I/O error
Last message repeated 1 times
[out#0/image2 @ 0000024031943bc0] Error muxing a packet
[out#0/image2 @ 0000024031943bc0] Task finished with error code: -5 (I/O error)
[out#0/image2 @ 0000024031943bc0] Terminating thread with return code -5 (I/O error)
[out#0/image2 @ 0000024031943bc0] video:37KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 1 fps=0.3 q=2.0 Lsize=N/A time=00:00:02.00 bitrate=N/A speed=0.592x
Conversion failed!