FFmpeg MP4 video into a TS file __ffmpeg

Source: Internet
Author: User

Slice generates m3u8 List command:

ffmpeg-i input.mp4-c:v libx264-c:a aac-strict-2-F HLS output.m3u8

The length of the default per piece (that is, a TS file) for this conversion command is the only last 5 piece of information that is saved by default in the 2s,m3u8 list file, that is, the player can only broadcast the last 5 TS video files in the pull stream.

This is definitely not what you want, so luckily, FFmpeg provides parameters to change these related settings, as follows:

Related Settings parameters:

' Hls_time seconds '

Set the segment length in seconds. Default value is 2. (Set the length of each slice, the default value is 2.) Unit is seconds)

' Hls_list_size size '

Set the maximum number of playlist entries. If set to 0 The list file would contain all the segments. Default value is 5. (Set the maximum number of entries saved by the playlist, set to 0 to save a piece of information, the default value is 5)

' Hls_wrap Wrap '

Set the number after which the "segment filename number" (the number specified in each segment file) wraps. If set to 0 the number would be never wrapped. Default value is 0.

This option is useful to avoid to fill the disk with many segment files, and limits the maximum number of segment files WR Itten to disk Towrap. (The number of slices is set to start overwriting, if set to 0 will not overwrite, the default value is 0.) This option avoids storing too many slices on disk and can limit the number of slices written to disk.

' Start_number number '

Start The playlist sequence number from number. Default value is 0. (The value of sequence number in the set playlist is number, and the default is 0)

Note that the playlist sequence number must are unique for each segment and it are not the confused with the segment Filen AME sequence number which can cyclic, for example if the ' wrap ' is specified. (Hint: Playlist sequence number for each segment Must be unique, and it cannot be confused with the file name of the slice, because if the "wrap" option file name is specified, it will appear reused. )

Use examples:

Ffmpeg-i 1.mp4-c:v libx264-c:a copy-f hls-threads 8-hls_time 5-hls_list_size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.