ps2ts(1)
π NAME π
ps2ts β Extract a program stream from a Transport Stream π
okay so bestie, you opened up the ps2ts(1) page from the General Commands Manual and honestly? iconic choice. let's get into it π¦
β¨ SYNOPSIS β¨
ps2ts -pid pid | -video | -audio [-err stdout] [-err stderr]
[-verbose | -v] [-quiet | -q] [-max max_pkts | -m max_pkts]
[-dvd | -notdvd | -nodvd] [-vstream vstream_no]
[-astream astream_no] [-ac3stream ac3stream_no]
[-host host[:port]] [-vpid vpid_no] [-apid apid_no] [-noaudio]
[-pmt pmt_pid_no] [-prepeat pat_freq] [-pad pad_pkts]
[-h264 | -avc | -h262 | -mp42 | -vtype video_type]
[-dolby dvd | atsc] in_file | -stdin out_file | -stdout
π DESCRIPTION π
So the whole vibe here is: convert an H.222 program stream to H.222 transport stream. That's the job. That's the whole job. π«
Now, important thing: this program does not make use of any Program Stream Map packets in the data (and honestly? mainly because the author has yet to see data with any π). Which means the program has to determine the stream type of the data based on the first few ES units. No map, no roadmap, just vibes and detective work. π
Also, this program does not output more than one video and one audio stream. If your program stream data contains more than one of each, the first will be used, and the others ignored β with a message indicating this, so at least you're not ghosted silently π
And like, it's assumed that the video stream will contain DTS values in its PES packets at reasonable intervals, which can be used as PCR values in the transport stream, and thus the video stream's PID can be used as the PCR PID in the transport stream. that's the whole arrangement, bestie π€
ποΈ Files
in_fileβ is a file containing the program stream data (but see-stdinbelow, bestie, don't forget π)out_fileβ is a transport stream file (but see-stdoutand-hostbelow, again, look down β¨)
π₯ input switches
-stdinβ take input from<stdin>, instead of a named file π«Ά-dvdβ The PS data is from a DVD. This is the default. This switch has no effect on MPEG-1 PS data. πΏ-notdvd,-nodvdβ The PS data is not from a DVD. The DVD specification stores AC-3 (Dolby), DTS and other audio in a specialised manner inprivate_stream_1. so yeah, this one matters π§-vstream vstream_noβ Take video from video streamvstream_no(0..7). The default is the first video stream found. π¬-astream astream_noβ Take audio from audio streamastream_no(0..31). The default is the first audio stream found (this includesprivate_stream_1on non-DVD streams). π-ac3stream astream_noβ Take audio from AC3 substreamac3stream_no(0..7), fromprivate_stream_1. This implies-dvd. (If audio is being taken from a substream, the user is assumed to have determined which one is wanted, e.g., usingpsreportβ so like, that's on you, bestie, but you got this π )
π€ Output Switches
-err stdoutβ Write error messages to standard output (the default)-err stderrβ Write error messages to standard error (Unix traditional π§β¨)-host host[:Arport]β Writes output (over TCP/IP) to the named<host>, instead of to a named file. If<port>is not specified, it defaults to 88. π-vpid vpid_noβvpid_nois the video PID to use for the data. Use'-vpid 0x<pid>'to specify a hex value. Defaults to0x68.-apid apid_noβapid_nois the audio PID to use for the data. Use'-apid 0x<pid>'to specify a hex value. Defaults to0x67.-noaudioβ Don't output the audio data π-pmt pmt_pid_noβpmt_pid_nois the PMT PID to use. Use'-pmt 0x<pid>'to specify a hex value. Defaults to0x66-prepeat pat_freqβ Output the program data (PAT/PMT) after everypat_freqPS packs. Defaults to100. π-pad pad_pktsβ Pad the start withpad_pktsfiller TS packets, to allow a TS reader to synchronize with the datastream. Defaults to8. ποΈ
βοΈ General switches
-v,-verboseβ Print a'v'for each video packet and an'a'for each audio packet, as it is read πβ¨-q,-quietβ Only output error messages π€«-max max_pkts,-m max_pktsβ Maximum number of PS packets to read π
π Stream type
When the TS data is being output, it is flagged to indicate whether it conforms to H.262, H.264, etc. It is important to get this right, as it will affect interpretation of the TS data. no pressure or anything π
If input is from a file, then the program will look at the start of the file to determine if the stream is H.264 or H.262 data. This process may occasionally come to the wrong conclusion π, in which case the user can override the choice using the following switches. slay, you always get a say π
If input is from standard input (via -stdin), then it is not possible for the program to make its own decision on the input stream type. Instead, it defaults to H.262, and relies on the user indicating if this is wrong. main character energy = you, deciding the stream type β¨
-h264,-avcβ Force the program to treat the input as MPEG-4/AVC π¦-h262β Force the program to treat the input as MPEG-2 πΈ-mp42β Force the program to treat the input as MPEG-4/Part 2 π-vtype video_typeβ Force the program to treat the input as video of stream type<type>(e.g.,0x42means AVS video). It is up to the user to specify a valid<type>. bestie. we are trusting you. π
If the audio stream being output is Dolby (AC-3), then the stream type used to output it differs for DVB (European) and ATSC (USA) data. It may be specified as follows:
-dolby dvbβ Use stream type0x06(the default) πͺπΊ-dolby atscβ Use stream type0x81πΊπΈ
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie π this Debian page for ps2ts(1) is dated October 28, 2015 β yeah, it's giving vintage, but it still ate fr fr. go convert some streams, you absolute legend ππ
π¦ where this page comes from
- debian bookworm: tstools 1.13~git20151030-6 Β· MPL-1.1
- debian trixie: tstools 1.13~git20151030-6 Β· MPL-1.1
- ubuntu jammy: tstools 1.13~git20151030-5 Β· MPL-1.1
- ubuntu noble: tstools 1.13~git20151030-6 Β· MPL-1.1
- ubuntu questing: tstools 1.13~git20151030-7
- ubuntu resolute: tstools 1.13~git20151030-7build1 Β· MPL-1.1
- ubuntu stonking: tstools 1.13~git20151030-8 Β· MPL-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms