I don't know how to use ffmpeg ssegment

Asked 2 years ago, Updated 2 years ago, 95 views

There is a script file that encodes the video obtained by raspivid with ffmpeg as a sample, but I don't know how to use the segment written like the ffmpeg option.I'm having a hard time finding a website that explains how to use it.
This is the program.

#!/bin/bash                                                                                                                                                 

base="/data/live"

cd$base

raspivid-n-w720-h405-fps25-vf-t86400000-b1800000-o-\
| ffmpeg-y\
    -i-\
    -c:v copy\
    -map 0:0\
    -fssegment\
    -segment_time4\
    -segment_format mpegts\
    -segment_list "$base/stream.m3u8"\
    -segment_list_size720\
    -segment_list_flags live\
    -segment_list_type m3u8\
    "segments /%08d.ts"


trap "rm stream.m3u8 segments /*.ts" EXIT

# vim:ts=2:sw=2:sts=2:et:ft=sh

This is the first time I've seen a script file and I understand a little, but I'm not sure about the segment.I would like someone to tell me how to use it.
Thank you for your cooperation.

ffmpeg

2022-09-29 22:03

1 Answers

The publishing script FFmpeg provides live streaming file output in the HTTP Live Streaming format (also known as HLS).

The segment or segment option specifies that the moving image data is time-divided into units called "segments" and printed into multiple files.Since the publishing script specifies -segment_time4, the segment length is divided into 4 seconds.The last "segments/%08d.ts" specifies the output segment filename.(segments/00000000.ts, segments/00000001.ts, segments/00000002.ts... is printed.)

Although segment and segment (full name stream_segment) have similar names, the former is the output format that requests the global header, and the latter is the unnecessary output format.The publishing script specifies -segment_format mpegts and the segment output format is MPEG-2TS, so we use segment without global header.


2022-09-29 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.