19

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://shafi:[email protected]: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:[email protected]: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

4 Answers 4

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.

1
  • 1
    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. Commented Nov 12, 2018 at 16:26
4

this worked for me as an option to ffmpeg: -use_wallclock_as_timestamps 1

1
  • 4
    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.
    – Gyan
    Commented Jul 19, 2018 at 5:45
2

This error can also be eliminated in some situations (VFR source files with unusual timebases) by using -vsync 0 -enc_time_base -1

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

This was the only option that worked for me.

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.