0
votes

I'm trying add timestamp to output file from FFMPEG but I'm getting this error.

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

And my command is:

 ffmpeg -i rtsp://admin:[email protected]:554/11 -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:text='\%T': [email protected]: x=7: y=460" -acodec copy -vcodec copy test.avi

And the output:

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': [email protected]: x=7: y=460' was defined for video output stream 0:0 but codec copy was selected. Filtering and streamcopy cannot be used together.

Where I'm doing a mistake ?

Thank you for all reply :)

1
-vcodec copy == streamcopy. You need to re-encode to add a text overlay so choose one encoder like libx264 etc.aergistal
Thank you. I changed it to -vcodec libx264 it said Illegal instructions.kernel252
Bad example, it might not be available in your ffmpeg build, try another (ffmpeg -codecs)aergistal

1 Answers

0
votes

I came across this command posted for ffmpeg (thanks to github user 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

Keep in mind it's one complete line. The \ characters in the timecode option are there to enable the :'s as chars. r sets the frames per second capture rate.