1

I am using FFmpeg for live streaming with RTMP to YouTube.
My ffmpeg command is like this:

ffmpeg -ar 44100 -ac 2 -f alsa -i plughw:1,0 -f v4l2 -codec:v h264 -framerate 30 \
  -video_size 1920x1080 -itsoffset 0.5 -i /dev/video2 -copyinkf -codec:v copy -codec:a aac \
  -ab 44k -af 'highpass=200, lowpass=3000, volume=1' -g 4 -f flv \
   rtmp://a.rtmp.youtube.com/live2/8b35-vkye-476f-xxxx

I want to add date and time information on live stream video. How can I do this?

2
  • My camera is H.264 camera
    – Paul
    Jul 1, 2019 at 4:52
  • Can I add time-stamp H.264 stream from camera ?
    – Paul
    Jul 1, 2019 at 5:07

1 Answer 1

1

I think adding:

-vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: text='%{localtime\:%T}': [email protected]: x=7: y=700"

should work. See Adding time stamp overlay to video stream using ffmpeg

4
  • I did, but does not work properly.
    – Paul
    Jul 11, 2019 at 6:42
  • I think that is why the frame format from camera is H.264 format. so, it can not rendering to H.264 directly.
    – Paul
    Jul 11, 2019 at 6:43
  • Worked for me. I just needed to adjust the coordinates.
    – Peter L
    Apr 17, 2022 at 22:21
  • The Text Expansion section explains how strftime is used so you can replace %T with any strftime format Dec 26, 2023 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.