mediastreamsegmenter(1) BSD General Commands Manual mediastreamsegmenter(1) NAME mediastreamsegmenter -- Create segments from MPEG-2 Transport streams for HTTP Live Streaming. SYNOPSIS mediastreamsegmenter [-b | -base-url <url>] [-t | -target-duration duration] [-u | -receive-data-timeout duration] [-U | -exit-on-receive-data-timeout] [-f | -file-base path] [-p | -program] [-program-duration durationMins] [-i | -index-file fileName] [-B | -base-media-file-name name] [-s | -sliding-window-entries entries] [-S | -start-index-file-count entries] [-I | -initial-sequence-number num] [-D | -delete-files] [-v] [-k | -encrypt-key file] [-K | -encrypt-key-url <url>] [-g] [-key-rotation-period period] [-n | -base-encrypt-key-name name] [-F | -meta-file file] [-y | -meta-type [picture | text | id3]] [-l | -log-file file] [-q | -quiet] [-reuse-media-entry-name num] [-a | -audio-only] [-O | -optimize] [-c | -file-complete-command command] [-C | -file-delete-command command] [-e | -crypt-file-complete-command command] [-E | -crypt-file-delete-command command] [address:port] DESCRIPTION The mediastreamsegmenter is a command-line tool that segments media for deployment using HTTP Live Streaming. The mediastreamsegmenter receives an MPEG-2 transport stream over UDP at [address:port] or over stdin and divides it into a series of small media files of approximately equal durations. The mediastreamsegmenter also creates an index file containing references to the individual media files. The index file and media files can then be deployed using common web server infrastructure. The mediastreamsegmenter can produce either live or video-on-demand (VOD) streams. For live streams, the transport stream from the media encoder is ingested, new media files are created, and the index file is periodically updated (and older media files expired and deleted). This type of stream is suit- able for continuous broadcasts. For VOD streams, the mediastreamsegmenter will generate media files for the complete program and an index file that contains all of the media files. This kind of stream allows the client access to the entire program at once. A stream created this way can also be viewed in-progress, giving the user access to the available portion of the event while it is happening. The mediastreamsegmenter can encrypt the segments using AES-128 encryption. The mediastreamsegmenter can issue specified system commands when a file is completed, or when it is deleted. A command can be issued for index or media files, and separate command can be issued for crypt files. The command should be a command-line string, with %P indicating the complete path for the file, and %F indicating the file name. To end a session, use control-C. An end of file tag will be added to the index file. The mediastreamsegmenter command accepts the following arguments: -b | -base-url <url> Specifies a base url to add to the media file name when written into the index file. -t | -target-duration duration Specifies a target duration for the media files. The default duration is 10 seconds. The dura- tion is calculated by looking at the PTS/DTS in the Video transport stream PES. -u | -receive-data-timeout duration Specifies a timeout after which the segmenter will switch to a paused state if no data is received. 0 means never. -U | -exit-on-receive-data-timeout duration Specifies that the segmenter should exit instead of pause when the receive timeout is reached. -f | -file-base path Directory to store the media and index files. -p | -program The -program option specifies that a VOD style program is being captured. This means all segments remain in the playlist file. To capture an open-ended performance, stop the session by hitting control-C. -program-duration durationMins The -program-duration option specifies that a VOD style program is being captured with a fixed number of minutes. The durationMins parameter is specified in minutes. -i | -index-file fileName This option defines the index file name. The default is prog_index.m3u8. It is recommended that the index file have an extension of .m3u8 or .m3u. -B | -base-media-file-name name This option defines the base name of the media files. The default is fileSequence. The current sequence number of the file is appended, and an extension added. For example, specifying name as AppleMediaFile will generate file names that look like AppleMediaFile12.ts. -s | -sliding-window-entries entries This option defines the number of media file entries that should be kept in the index file. The default is 5. -S | -start-index-file-count entries This option defines the number of media file entries that must be present before the first index file is written. The default is 3. -I | -initial-sequence-number num Sets the initial sequence number that is appended to -base-media-file-name. -D | -delete-files In a live stream, this option will specify that the media files that are no longer in the index file will be removed after an expiry period. -k | -encrypt-key file Specifies an encrypt key file if the -g command is not present. Specifies an encrypt key file if the -g command is present without the period parameter (single encryption file for the entire session). Specifies the directory to store the rotating encryption key if the -g period parame- ter is specified. -K | -encrypt-key-url <url> HTTP base URL for the encrypt key file to write into the index file. -g | -generate-key The -generate-key option will generate an encryption key. It will generate the key 1 time. The -generate-key option requires a -encrypt-key option. -key-rotation-period period The -key-rotation-period option will generate an encryption key and rotate the key every period media files. The -key-rotation-period option requires a -encrypt-key option. -n | -base-encrypt-key-name name This option defines the base name of the crypt key files. The default is crypt. The current sequence number of the file is appended, and an extension added. For example, specifying name as AppleCrypt will generate file names that look like AppleCrypt12.key. -F | -meta-file file Reads the specified file and writes it's contents as metadata at the start of each media file. If the specified file doesn't exist, no metadata will be written. -y | -meta-type [picture | text | id3] Specifies the metadata type. If picture, expects a JPEG or PNG. If id3, expects a complete ID3 frame. To inject images into an audio only stream, use picture as the argument. -l | -log-file file Writes console messages to file -q | -quiet Only outputs error messages. -reuse-media-entry-names num Reuses the media file entry names every num files. For example, if num is set to 10, fileSe- quence0.ts, fileSequence1.ts, ... , fileSequence9.ts will be used, then fileSequence0.ts will be reused. This number must be at least 3 times the -sliding-window-entries count. -a | -audio-only Strips the audio elementary stream (AAC/ADTS or MP3) and writes it into the media file. -O | -optimize Repackage the incoming transport stream to remove excess padding. -c | -file-complete-command command Will execute command when a media file or index file is completed. The command will have %P replaced by the full path of the media or index file, and will have %F replaced by the file name of the media or index file. -C | -file-delete-command command Will execute command when a media file or index file is delete (due to a -delete-files command). The command string will have %P replaced by the full path of the media or index file, and will have %F replaced by the file name of the media or index file. -e | -crypt-file-complete-command command Will execute command when a crypt key file is completed. The command will have %P replaced by the full path of the crypt key file, and will have %F replaced by the file name of the crypt key file. -E | -crypt-file-delete-command command Will execute command when a crypt key file is deleted (due to a -delete-files command). The command will have %P replaced by the full path of the crypt file, and will have %F replaced by the file name of the media or index file. COMPATIBILITY The mediastreamsegmenter will only work with MPEG-2 Transport Streams as defined in ISO/IEC 14496-1. The transport stream must contain H.264 (MPEG-4, part 10) video and AAC or MPEG audio. If AAC audio is used, it must have ADTS headers. H.264 video access units must use Access Unit Delimiter NALs, and must be in unique PES packets. EXAMPLES mediastreamsegmenter -b http://foo.com/stream -s 3 -D -f /Library/WebServer/Documents/stream 239.4.1.5:2_1_3 Captures and creates unencrypted Live stream. The index file can be downloaded at http://foo.com/stream/prog_index.m3u8. In steady-state, the index file will contain 3 items. mediastreamsegmenter -b http://bar.com/hiRes -program-duration 12_ -f /Library/WebServer/Documents/hiRes -key-rotation-period 15 -k /Volumes/SecureServer/Protected -K https://foo.bar.com/login/key.php?streamname=hiRes 223.1.2.4:12313 Captures and creates an encrypted VOD stream. The encryption key is on a different server, and is accessible via https. mediastreamsegmenter --audio-only -meta-file inject.jpg -meta-type picture 223.4.3.2:41324 Captures MPEG2 transport stream, pulls out audio elementary stream and injects "inject.jpg" into each media file, if it exists. mediastreamsegmenter -D -f streamTempDirectory -file-complete-command "scp %P streaming@stream- ing.foo.com:docroot/mySession/%F" -file-delete-command "ssh -n streaming@streaming.foo.com rm -f doc- root/mySession/%F" 239.4.1.5:2_1_3 Captures and creates a live stream; when an index file or media segment is completed, it is copied to a remote server using the scp command. When the index or media file is deleted, it will be removed using the ssh command.
mediastreamsegmenter用法
最新推荐文章于 2019-05-18 21:54:44 发布