Answers.Body: <p>I think adding:</p>
  
  <pre><code>-vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: text='%{localtime\:%T}': fontcolor=white@0.8: x=7: y=700"
  </code></pre>
  
  <p>should work. See <a href="https://einar.slaskete.net/2011/09/05/adding-time-stamp-overlay-to-video-stream-using-ffmpeg/" rel="nofollow noreferrer">Adding time stamp overlay to video stream using ffmpeg</a> </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T06:42:08.397Z
Answers.Text: I did, but does not work properly.
Answers.UserDisplayName: Paul
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T06:43:54.457Z
Answers.Text: I think that is why the frame format from camera is H.264 format. so, it can not rendering to H.264 directly.
Answers.UserDisplayName: Paul
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-04-17T22:21:56.647Z
Answers.Text: Worked for me. I just needed to adjust the coordinates.
Answers.UserDisplayName: Peter L
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-26T05:44:11.873Z
Answers.Text: The [Text Expansion section](https://ffmpeg.org/ffmpeg-all.html#Text-expansion) explains how [strftime](https://linux.die.net/man/3/strftime) is used so you can replace `%T` with any strftime format
Answers.UserDisplayName: Spencer Williams
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-01T15:20:32.123Z
Answers.LastActivityDate: 2019-07-02T22:20:59.317Z
Answers.LastEditDate: 2019-07-02T22:20:59.317Z
Answers.UserDisplayName: Thor Tomasarson
Body: <p>I am using FFmpeg for live streaming with RTMP to YouTube.<br>
  My ffmpeg command is like this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I want to add date and time information on live stream video.
  How can I do this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-01T04:52:19.653Z
Comments.Text: My camera is H.264 camera
Comments.UserDisplayName: Paul
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-01T05:07:29.077Z
Comments.Text: Can I add time-stamp H.264 stream from camera ?
Comments.UserDisplayName: Paul
Tags: <ffmpeg><rtmp>
Title: Adding date/time information on video for ffmpeg
UserDisplayName: Paul
ThreadText: # Adding date/time information on video for ffmpeg
  
  (Asked by: username_0 on 2019-07-01)
  
  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?
  
  **Tags:** ffmpeg, rtmp
  
  > **Comments:**
  > **username_0**: My camera is H.264 camera  
  > **username_0**: Can I add time-stamp H.264 stream from camera ?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-07-01. Score: 1
  
  I think adding:
  
  ```
  -vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: text='%{localtime\:%T}': fontcolor=white@0.8: x=7: y=700"
  
  ```
  
  should work. See [Adding time stamp overlay to video stream using ffmpeg](https://einar.slaskete.net/2011/09/05/adding-time-stamp-overlay-to-video-stream-using-ffmpeg/)
  
  > **Comments:**
  > **username_0**: I did, but does not work properly.  
  > **username_0**: I think that is why the frame format from camera is H.264 format. so, it can not rendering to H.264 directly.  
  > **username_2**: Worked for me. I just needed to adjust the coordinates.  
  > **username_3**: The [Text Expansion section](https://ffmpeg.org/ffmpeg-all.html#Text-expansion) explains how [strftime](https://linux.die.net/man/3/strftime) is used so you can replace `%T` with any strftime format  
  
  ---
  
  