Skip to content

Instantly share code, notes, and snippets.

@allanjos
Last active November 5, 2018 17:53
Show Gist options
  • Save allanjos/cc436d7232f7b568f7cffb55a83aaa20 to your computer and use it in GitHub Desktop.
Save allanjos/cc436d7232f7b568f7cffb55a83aaa20 to your computer and use it in GitHub Desktop.
FFMPEG - Transport Stream Utils

Extract audio and video from TS:

Suppose TS has the following program streams:

Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream #0:1[0x200]: Audio: aac (LC) ([17][0][0][0] / 0x0011), 44100 Hz, stereo, fltp, 143 kb/s

Extract video from TS from stream #0:0:

ffmpeg -i x.ts -map 0:0 -vcodec copy x.mp4

Extract audio from TS from stream #0:1:

ffmpeg -i x.ts -map 0:1 -acodec copy x.aac

Convert TS:

Convert transport stream file to MPEG-4 format:

ffmpeg -i file.ts -c:v copy -c:a aac -strict -2 file.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment