Answers.Body: <p>The usual solution for this situation: <code>-fflags +genpts</code></p>
  
  <p>It should eliminate the warning, but there's no guarantee your sync issues will be solved.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-12T16:26:26.007Z
Answers.Text: This worked better than `-use_wallclock_as_timestamps 1` when mashing a pair of avi files together.  The resulting file synced up perfectly with the subtitle (`.sub` & `.idx`) files I had.
Answers.UserDisplayName: Andrew Beals
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-18T18:06:32.920Z
Answers.LastActivityDate: 2018-07-18T18:06:32.920Z
Answers.UserDisplayName: Mike Brown
Answers.Body: <p>This error can also be eliminated in some situations (VFR source files with unusual timebases) by using <code>-vsync 0 -enc_time_base -1</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-28T18:48:12.360Z
Answers.LastActivityDate: 2019-06-28T18:48:12.360Z
Answers.UserDisplayName: electron.rotoscope
Answers.Body: <p>As an input option <code>-r</code> <strong>ignore[s] any timestamps</strong> [...] and instead generate[s] timestamps assuming constant frame rate <em>fps</em>.</p>
  <p><code>ffmpeg -r 25 -i &quot;udp://...</code></p>
  <p>Source:<a href="https://ffmpeg.org/ffmpeg-all.html#Video-Options" rel="nofollow noreferrer">ffmpeg Documentation: Video Options: -r</a></p>
  <p>This was the only option that worked for me.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-15T18:23:12.023Z
Answers.LastActivityDate: 2021-11-15T18:23:12.023Z
Answers.UserDisplayName: drake7
Answers.Body: <p>this worked for me as an option to ffmpeg: <code>-use_wallclock_as_timestamps 1</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-19T05:45:03.900Z
Answers.Text: If your read speed is different than stream framerate, output playback speed (and audio sync) will be wrong. Add `-re` before both video and audio input to avoid that.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-18T09:51:34.927Z
Answers.LastActivityDate: 2018-07-18T09:51:34.927Z
Answers.UserDisplayName: shafi
Body: <p>I am using below command to push the video to Wowza server, since we are pushing raw H.264 video, the RTP packet does not have the timestamp,  and we could observe audio video sync issue while playing video using VLC Media Player. While executing the FFmpeg command, there is a warning showing as </p>
  
  <blockquote>
    <p>[rtsp @ 0xb754bda0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly</p>
  </blockquote>
  
  <p>IS there any option available in FFmpeg to add timestamp in RTP packet and push the video and audio?</p>
  
  <pre><code>$ffmpeg -f h264 -i /tmp/enc_sd_stream.h264 -f aac -i /tmp/aud_rec_stream  -acodec copy -vcodec copy -r 23 -f rtsp 
   rtsp://shafi:shafi@192.168.1.135:1935/live/myStream
  
  Input #0, h264, from '/tmp/enc_sd_stream.h264':
    Duration: N/A, bitrate: N/A
      Stream #0:0: Video: h264 (Baseline), yuv420p, 720x576, 25 fps, 25 tbr, 1200k tbn, 50 tbc
  Input #1, aac, from '/tmp/aud_rec_stream':
    Duration: N/A, bitrate: 57 kb/s
      Stream #1:0: Audio: aac (LC), 32000 Hz, mono, fltp, 57 kb/s
  [udp @ 0xb7553290] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  [udp @ 0xb7553320] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  [udp @ 0xb754c520] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  [udp @ 0xb758d670] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  Output #0, rtsp, to 'rtsp://shafi:shafi@192.168.1.135:1935/live/myStream':
    Metadata:
      encoder         : Lavf57.25.100
      Stream #0:0: Video: h264, yuv420p, 720x576, q=2-31, 25 fps, 25 tbr, 90k tbn, 15 tbc
      Stream #0:1: Audio: aac (LC), 32000 Hz, mono, 57 kb/s
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (copy)
    Stream #1:0 -&gt; #0:1 (copy)
  Press [q] to stop, [?] for help
  [h264 @ 0xb752e2b0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
  
      [rtsp @ 0xb754bda0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
  
  [aac @ 0xb75f7880] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
  frame=10213 fps= 14 q=-1.0 Lsize=N/A time=00:06:48.80 bitrate=N/A speed=0.574x
  </code></pre>
  
Tags: <video><ffmpeg><audio><codec><sync>
Title: Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
UserDisplayName: shafi
ThreadText: # Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
  
  (Asked by: username_0 on 2018-07-13)
  
  I am using below command to push the video to Wowza server, since we are pushing raw H.264 video, the RTP packet does not have the timestamp, and we could observe audio video sync issue while playing video using VLC Media Player. While executing the FFmpeg command, there is a warning showing as
  
  > [rtsp @ 0xb754bda0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
  
  IS there any option available in FFmpeg to add timestamp in RTP packet and push the video and audio?
  
  ```
  $ffmpeg -f h264 -i /tmp/enc_sd_stream.h264 -f aac -i /tmp/aud_rec_stream  -acodec copy -vcodec copy -r 23 -f rtsp 
   rtsp://username_0:username_0@192.168.1.135:1935/live/myStream
  
  Input #0, h264, from '/tmp/enc_sd_stream.h264':
    Duration: N/A, bitrate: N/A
      Stream #0:0: Video: h264 (Baseline), yuv420p, 720x576, 25 fps, 25 tbr, 1200k tbn, 50 tbc
  Input #1, aac, from '/tmp/aud_rec_stream':
    Duration: N/A, bitrate: 57 kb/s
      Stream #1:0: Audio: aac (LC), 32000 Hz, mono, fltp, 57 kb/s
  [udp @ 0xb7553290] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  [udp @ 0xb7553320] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  [udp @ 0xb754c520] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  [udp @ 0xb758d670] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
  Output #0, rtsp, to 'rtsp://username_0:username_0@192.168.1.135:1935/live/myStream':
    Metadata:
      encoder         : Lavf57.25.100
      Stream #0:0: Video: h264, yuv420p, 720x576, q=2-31, 25 fps, 25 tbr, 90k tbn, 15 tbc
      Stream #0:1: Audio: aac (LC), 32000 Hz, mono, 57 kb/s
  Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Stream #1:0 -> #0:1 (copy)
  Press [q] to stop, [?] for help
  [h264 @ 0xb752e2b0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
  
      [rtsp @ 0xb754bda0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
  
  [aac @ 0xb75f7880] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
  frame=10213 fps= 14 q=-1.0 Lsize=N/A time=00:06:48.80 bitrate=N/A speed=0.574x
  
  ```
  
  **Tags:** video, ffmpeg, audio, codec, sync
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_0 on 2018-07-18. Score: 4 | Accepted answer
  
  this worked for me as an option to ffmpeg: `-use_wallclock_as_timestamps 1`
  
  > **Comments:**
  > **username_5**: If your read speed is different than stream framerate, output playback speed (and audio sync) will be wrong. Add `-re` before both video and audio input to avoid that.  
  
  ---
  
  ### Answer by username_1 on 2018-07-18. Score: 12
  
  The usual solution for this situation: `-fflags +genpts`
  
  It should eliminate the warning, but there's no guarantee your sync issues will be solved.
  
  > **Comments:**
  > **username_2**: This worked better than `-use_wallclock_as_timestamps 1` when mashing a pair of avi files together.  The resulting file synced up perfectly with the subtitle (`.sub` & `.idx`) files I had.  
  
  ---
  
  ### Answer by username_3 on 2019-06-28. Score: 2
  
  This error can also be eliminated in some situations (VFR source files with unusual timebases) by using `-vsync 0 -enc_time_base -1`
  
  
  ---
  
  ### Answer by username_4 on 2021-11-15. Score: 0
  
  As an input option `-r` **ignore[s] any timestamps** [...] and instead generate[s] timestamps assuming constant frame rate *fps*.
  
  `ffmpeg -r 25 -i "udp://...`
  
  Source:[ffmpeg Documentation: Video Options: -r](https://ffmpeg.org/ffmpeg-all.html#Video-Options)
  
  This was the only option that worked for me.
  
  
  ---
  
  