linux - FFMPEG rtsp流向输出文件添加时间戳

标签 linux ffmpeg timestamp rtsp

我正在尝试向 FFMPEG 的输出文件添加时间戳,但收到此错误。

Filtergraph 'drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:text='\%T': fontcolor=white@0.8: x=7: y=460' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together

我的命令是:

 ffmpeg -i rtsp://admin:password@192.168.1.52:554/11 -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:text='\%T': fontcolor=white@0.8: x=7: y=460" -acodec copy -vcodec copy test.avi

输出:

ffmpeg version N-75939-g6eaf97c Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Raspbian 4.9.2-10) configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libfreetype
libavutil 55. 3.100 / 55. 3.100
libavcodec 57. 5.100 / 57. 5.100
libavformat 57. 3.100 / 57. 3.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 11.100 / 6. 11.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100 Input #0, rtsp, from 'rtsp://user:@192.168.1.52:554/11':
Metadata:
title : 10 Duration: N/A, start: 0.159000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p, 1280x720, 25.08 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: adpcm_g726, 8000 Hz, mono, s16, 16 kb/s Filtergraph 'drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:text='\%T': fontcolor=white@0.8: x=7: y=460' was defined for video output stream 0:0 but codec copy was selected. Filtering and streamcopy cannot be used together.

我哪里做错了?

谢谢大家的回复:)

最佳答案

我发现了这个为 ffmpeg 发布的命令(感谢 github 用户 reidransom):

ffmpeg -i video.mov -vcodec libx264 -cmp 22 -vf "drawtext=fontfile=DroidSansMono.ttf: timecode='09\:57\:00\:00': r=29.976: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000099" -y output.mov

请记住,这是一个完整的行。时间码选项中的\字符用于启用 : 作为字符。 r 设置每秒帧数捕获率。

关于linux - FFMPEG rtsp流向输出文件添加时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33130927/

相关文章:

c - linux中sleep命令的使用

c - 尽管参数正确,Linux 重启系统调用仍会返回错误

audio - ffmpeg 在尝试通过音频循环视频时卡住

ffmpeg - 使用 FFmpeg 设置时间偏移后覆盖视频

php - 每当我使用 PHP 将数据添加到 MySQL 时,如何获取 TIMESTAMP?

python - 树莓派上的 os.walk 失败

linux - Bash:如何检查命令是否及时执行

animation - FFmpeg多个drawtext过滤器彼此相邻

javascript - Angular Strap Datepicker : Inconsistent timestamps returned, UTC +0 vs UTC +12 小时

timestamp - 如何转换Erlang :timestamp() to normal date format?