我需要录制 RTSP 流,在存储它之前我需要在视频上画一些文字。
以下命令仅适用于记录流(不写入文本)。
openRTSP -D 10 -v -t -c -b 800000 rtsp://video_link.mov | ./ffmpeg -r 15 -i - -codec copy -hls_list_size 65535 -hls_time 2 "./video/live.m3u8"
但我还需要在录制之前在视频上绘制一些文字。因此我重写了上述命令,如下所示
openRTSP -D 10 -v -t -c -b 800000 rtsp://video_link.mov | ./ffmpeg -r 15 -i - -vf drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf: text='Some Text': fontcolor=white: fontsize=24: box=1: boxcolor=black: x=(w-text_w)/2: y=(h-text_h-line_h)/2" -codec copy -hls_list_size 65535 -hls_time 2 "./video/live.m3u8"
但给出了如下错误,
input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 704x480, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Filtergraph 'drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf: text='Stack Overflow': fontcolor=white: fontsize=24: box=1: boxcolor=black: x=(w-text_w)/2: y=(h-text_h-line_h)/2' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together.
我理解录制和绘图不能同时进行。有没有类似的方法来解决上述问题?