[FFmpeg-user] MPEG-DASH / HLS Audio Video Sync

Bryn Larsen bryn.larsen at live.com
Fri Apr 12 21:36:56 EEST 2019


Hi,

I’m trying to take an incoming rtmp stream (via nginx-rtmp) and transmux / transcode it into an mpeg-dash / hls stream. I’m having trouble keeping the audio and video in sync. If I re-encode the audio instead of copying it, the trancoded bitrate stays in sync but the transmuxed video still drifts out of sync. Here is the command I am running:

ffmpeg \
    -hide_banner \
    -f live_flv \
    -i "rtmp://localhost/myapp/test01" \
    -map 0:v -c:v:0 libx264 -bf 0 -refs 3 -preset veryfast -tune zerolatency -sc_threshold 0 -g 120 -b:v:0 1600k -s 640x360 \
    -map 0:v -c:v:1 copy \
                -map 0:a -c:a:0 copy \
    -f dash \
    -streaming 1 \
    -seg_duration 2 \
    -use_timeline 0 \
    -use_template 1 \
    -window_size 5 \
    -extra_window_size 10 \
    -index_correction 1 \
    -remove_at_exit 1 \
    -media_seg_name 'chunk-stream-$RepresentationID$-$Number%05d$.m4s' \
    -init_seg_name 'init-stream1-$RepresentationID$.m4s' \
    -adaptation_sets "id=0,streams=v id=1,streams=a" \
    -method PUT \
    -strict experimental \
    -lhls 1 \
    -http_persistent 1 \
    -hls_playlist 1 \
    -ignore_io_errors 1 \
     http://127.0.0.1/video/manifest.mpd


More information about the ffmpeg-user mailing list