MPEG-DASH / HLS Audio Video Sync

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MPEG-DASH / HLS Audio Video Sync

Bryn Larsen
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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: MPEG-DASH / HLS Audio Video Sync

Carl Eugen Hoyos-2
2019-04-12 20:36 GMT+02:00, Bryn Larsen <[hidden email]>:
> 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 \

Please remove hide_banner an provide the command
line you tested together with the complete, uncut console
output if you need help here.

>     -f live_flv \

You should normally not force the input format.

>     -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

Do I understand correctly that you only have problems with
the copied video stream? It is most likely not cfr.

The issue would be easier to test if you dump the input
stream and use file input instead of network input.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".