FFMpeg Copy Live Stream (Limit to 60s file)

后端 未结 2 2049
灰色年华
灰色年华 2020-12-21 08:17

I currently have a working way to get a live stream and start downloading it locally while it is still live.

ffmpeg -i source_hls.m3u8 -c copy output.mkv -y

2条回答
  •  旧时难觅i
    2020-12-21 08:28

    Late answer, but you can use -t duration, i.e.:

    ffmpeg -y -t 60 -i source_hls.m3u8 -c copy output.mkv
    

    From ffmpeg docs:

    -t duration (input/output)
    

    When used as an input option (before -i), limit the duration of data read from the input file.

    When used as an output option (before an output url), stop writing the output after its duration reaches duration.

    duration must be a time duration specification, see (ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual.

    -to and -t are mutually exclusive and -t has priority.


    -t argument examples:

    • 55 - 55 seconds
    • 12:03:45 - 12 hours, 03 minutes and 45 seconds
    • 23.189 - 23.189 seconds

提交回复
热议问题