Skip to content

Video speed up when playing with custom websocket #412

@Petingo

Description

@Petingo

Hello and happy new year!

I'm trying to stream .ts file with my own WebSocket, but the video would speed up for like 1.5x when playing in the browser.
I use this command to generate video segments, and I have another program that detects if there's any newly available sequence and writes to the WebSocket.

ffmpeg -y -re \
-f v4l2 \
    -video_size 640x480 -i /dev/video0 \
-f alsa \
                -ar 44100 -i hw:0 \
        -f mpegts \
                -codec:v mpeg1video -s 640x480 -b:v 1000k -bf 0 \
                -codec:a mp2 -b:a 128k \
                -muxdelay 0.001 \
-f hls \
    -hls_time 5 \
    -hls_playlist_type vod \
    -hls_flags independent_segments \
    -hls_segment_type mpegts \
    -hls_segment_filename stream_%v/data%02d.ts \
test

I also tried to use a fixed framerate (ffmpeg -r 25 with -f v4l2 -framerate 25) but the situation is the same.
Since the video is generated on the fly, so the behaviour would be like:
[play seq0 at very fast speed] - [wait for seq1 ( for like 1.5s ) ] - [play seq1 for very fast speed] - [wait for seq2]

I wonder if this happens due to the same reason as #184 (which I also experience). Does anyone know any potential solution (or any alternative)?

p.s.
When I run the websocke example in the README, everything works fine.

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