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 -stdin below, bestie, don't forget πŸ‘€)
  • out_file β€” is a transport stream file (but see -stdout and -host below, 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 in private_stream_1. so yeah, this one matters 🎧
  • -vstream vstream_no β€” Take video from video stream vstream_no (0..7). The default is the first video stream found. 🎬
  • -astream astream_no β€” Take audio from audio stream astream_no (0..31). The default is the first audio stream found (this includes private_stream_1 on non-DVD streams). πŸ”Š
  • -ac3stream astream_no β€” Take audio from AC3 substream ac3stream_no (0..7), from private_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., using psreport β€” 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_no is the video PID to use for the data. Use '-vpid 0x<pid>' to specify a hex value. Defaults to 0x68.
  • -apid apid_no β€” apid_no is the audio PID to use for the data. Use '-apid 0x<pid>' to specify a hex value. Defaults to 0x67.
  • -noaudio β€” Don't output the audio data πŸ™Š
  • -pmt pmt_pid_no β€” pmt_pid_no is the PMT PID to use. Use '-pmt 0x<pid>' to specify a hex value. Defaults to 0x66
  • -prepeat pat_freq β€” Output the program data (PAT/PMT) after every pat_freq PS packs. Defaults to 100. πŸ”
  • -pad pad_pkts β€” Pad the start with pad_pkts filler TS packets, to allow a TS reader to synchronize with the datastream. Defaults to 8. πŸ›‹οΈ

βš™οΈ 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., 0x42 means 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 type 0x06 (the default) πŸ‡ͺπŸ‡Ί
  • -dolby atsc β€” Use stream type 0x81 πŸ‡ΊπŸ‡Έ

🫢 SEE ALSO 🫢

esdots(1),


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 πŸ‘‘πŸŒˆ