Skip to content

av sync drifts (rtmp streaming) #11

@darrellenns

Description

@darrellenns

I'm not sure that this is really an issue with libbmd, but hopefully someone could at least point me in the right direction. I am using the bmd branch of libav to send an rtmp stream to akamai. I've found that the audio is leading the video by about 1 second after 24 hours of streaming.

I'm using a DeckLink SDI 4K card, and the latest git versions of libbmd, libav, and rtmpdump. The script I'm using is shown below (URLs, passwords, etc changed). The CPU usage is low (around 13%), so no issues there.

Is anyone using this for long form streaming/recording? Are there some avconv options I should be using (maybe some combination of -vsync and the asyncts filter)? I would not expect there to be any need to do any special syncing, as all the data is clocked to the same SDI source. Or am I missing something?

A huge thanks to lu-zero for making the glue to put all these pieces together!

!/bin/sh

HIGH_WIDTH=1280
HIGH_HEIGHT=720
HIGH_RATE=2500k

MEDIUM_WIDTH=854
MEDIUM_HEIGHT=480
MEDIUM_RATE=1000k

LOW_WIDTH=640
LOW_HEIGHT=360
LOW_RATE=750k

ENTRY_POINT="rtmp://myentrypoint.akamaientrypoint.net/EntryPoint"
USERNAME=myakamaiuser
PASSWORD="myakamaipass"
STREAM_ID1="akamai_id1"
STREAM_ID2="akamai_id2"
STREAM_ID3="akamai_id3"

GOP_LENGTH=150

##########################

#limit to 8GB of ram in case of memory leak
ulimit -v 8000000

nice -n -10 avconv \
-stats -loglevel verbose \
-analyzeduration 0 -f bmd -video_mode 8 -audio_connection 2 -video_connection 4 -video_format 1 -i default \
 \
-c:v libx264 -pre:v medium -profile:v baseline -level 40 -b:v ${HIGH_RATE} -minrate ${HIGH_RATE} -maxrate ${HIGH_RATE} -bufsize 2048k \
-tune fastdecode -g ${GOP_LENGTH} -refs 0 -threads 12 \
-c:a libfdk_aac -ac 2 -ar 44100 -b:a 128k \
-filter:v "scale=w=${HIGH_WIDTH}:h=${HIGH_HEIGHT}" \
-f flv "${ENTRY_POINT} live=true pubUser=${USERNAME} pubPasswd=${PASSWORD} playpath=${STREAM_ID1} flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" \
 \
-c:v libx264 -pre:v medium -profile:v baseline -level 40 -b:v ${MEDIUM_RATE} -minrate ${MEDIUM_RATE} -maxrate ${MEDIUM_RATE} -bufsize 1024k \
-tune fastdecode -g ${GOP_LENGTH} -refs 0 -threads 12 \
-c:a libfdk_aac -ac 2 -ar 44100 -b:a 128k \
-filter:v "scale=w=${MEDIUM_WIDTH}:h=${MEDIUM_HEIGHT}" \
-f flv "${ENTRY_POINT} live=true pubUser=${USERNAME} pubPasswd=${PASSWORD} playpath=${STREAM_ID2} flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" \
 \
-c:v libx264 -pre:v medium -profile:v baseline -level 40 -b:v ${LOW_RATE} -minrate ${LOW_RATE} -maxrate ${LOW_RATE} -bufsize 192k \
-tune fastdecode -g ${GOP_LENGTH} -refs 0 -threads 12 \
-c:a libfdk_aac -ac 2 -ar 44100 -b:a 128k \
-filter:v "scale=w=${LOW_WIDTH}:h=${LOW_HEIGHT}" \
-f flv "${ENTRY_POINT} live=true pubUser=${USERNAME} pubPasswd=${PASSWORD} playpath=${STREAM_ID3} flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)"

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9272392-av-sync-drifts-rtmp-streaming?utm_campaign=plugin&utm_content=tracker%2F256780&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F256780&utm_medium=issues&utm_source=github).

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