controlling the speed of the hls play list, generated by ffmpeg

22 Views Asked by At

I have a ffmpeg process which the input is an rtsp stream, and the output is a m3u8 play list.

when i simply watches the rtsp input stream, the play speed is correct and everything works fine. but when i play the created HLS playlist, it seems to play in a much faster speed.

The way i create the ffmpeg process:

_SEGMENT_FILE_FORMAT = 'output%d.ts'
output_dir_path = "C:\\Tempdir"


source = ffmpeg.input(
    'rtsp://myrtspserveraddress',
    rtsp_transport='tcp',
    fflags='nobuffer',  
    flags='low_delay'  
)

pipe = source.output(
    os.path.join(output_dir_path, _SEGMENT_FILE_FORMAT),
    **dict(vcodec='copy', video_bitrate='1000k'),
    copyts=None,
    f='segment', 
    segment_list_flags='live',
    segment_time=10,
    segment_list_size=20, 
    segment_wrap=20,

    segment_format='mpegts',
    segment_list=os.path.join(output_dir_path, "test_file"),
    segment_list_type='m3u8',
)

Which seems to create a list of "10 seconds" files, but the actual data in those files, is pretty much a 30 seconds video which simply plays much faster.

What exactly controls the "play speed" of the video, and how can i know why it plays faster, and control it so the play speed would be the actual speed matching the RTSP stream?

0

There are 0 best solutions below