Skip to content

Loss of rtmp stream conversion in the end as ffmpeg is taking time to do the conversion. #8

@Lohith4

Description

@Lohith4

I am streaming from obs studio to a nginx server which uses nginx-rtmp-module. I have a ffmpeg process which consumes the rtmp stream and convert to dash live stream. For every 4 second dash segment it takes approx 6-7 sec to do the conversion (may be due to low end device). So let's say i stopped the stream from obs and the total stream length is 10 minutes. Ffmpeg is not able to convert the complete rtmp stream to dash and it's loosing the content in the end. This is the ffmpeg command which i am using.

ffmpeg -f live_flv -re -i rtmp://172.20.10.8:1935/live/ls1
-max_muxing_queue_size 9999 -flags +global_header -r 60/1
-filter_complex "split=4[s0][s1][s2][s3];[s0]scale=640x360[s0];[s1]scale=854x480[s1];[s2]scale=1280x720[s2];[s3]scale=1920x1080[s3]"
-pix_fmt yuv420p -c:v libx264
-b:v:0 700K -maxrate:v:0 700K -bufsize:v:0 700K/2
-b:v:1 1200K -maxrate:v:1 1200K -bufsize:v:1 1200K/2
-b:v:2 2500K -maxrate:v:2 2500K -bufsize:v:2 2500K/2
-b:v:3 6000K -maxrate:v:3 6000K -bufsize:v:3 6000K/2
-g:v 120 -keyint_min:v 120 -sc_threshold:v 0 -profile:v baseline -color_primaries bt709 -color_trc bt709 -colorspace bt709
-c:a aac -ar 48000 -b:a:0 64000 -b:a:1 128000 -b:a:2 163840
-map [s0] -map [s1] -map [s2] -map [s3] -map 0:a -map 0:a -map 0:a
-preset veryfast -tune zerolatency -adaptation_sets 'id=0,streams=v id=1,streams=a' -seg_duration 4 -frag_duration 1 -frag_type duration -use_timeline 1 -use_template 1 -index_correction 1 -utc_timing_url "https://time.akamai.com/?iso" -window_size 75 -streaming 1 -ldash 1 -suggested_presentation_delay 3 -media_seg_name '$RepresentationID$/seg-$Number$.$ext$' -init_seg_name '$RepresentationID$/seg-init.$ext$' -f dash /live_streaming/data/$tenant_name/$stream_id/$stream_id.mpd.

What configuration more is required to consume the whole stream without loosing the ending stream. If I use few resolutions to convert then it is able to convert whole content without loosing any.

Also in between i could see logs like Queue input is backward in time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions