Note that there are some explanatory texts on larger screens.

plurals
  1. POFFmpeg - Extracting video and audio from transport stream file (.ts)
    primarykey
    data
    text
    <p>I wish to <strong>extract the audio and video of a certain program in a transport stream file</strong> (.ts) by specifying its PID without losing quality and using the same codec in the resulting file (the output file is a MPEG).</p> <p>Is that even <em>possible</em> with FFmpeg? If so, how can I do it?</p> <p>So far, I've come to this command:</p> <pre><code> ffmpeg -i tsfile.ts -vcodec copy -acodec copy -q:v 1 output.mpg </code></pre> <p><em>Edit</em>: Note that the file output.mpg is created. The file contains the video but the audio isn't attached (no sound). Also, I am unable to specify the program PID to extract.</p> <p><em>Edit 2</em>: Here's the output of <strong>ffmpeg -i tsfile.ts</strong></p> <pre><code>ffmpeg version N-47062-g26c531c Copyright (c) 2000-2012 the FFmpeg developers built on Nov 25 2012 12:21:26 with gcc 4.7.2 (GCC) libavutil 52. 9.100 / 52. 9.100 libavcodec 54. 77.100 / 54. 77.100 libavformat 54. 37.100 / 54. 37.100 libavdevice 54. 3.100 / 54. 3.100 libavfilter 3. 23.102 / 3. 23.102 libswscale 2. 1.102 / 2. 1.102 libswresample 0. 17.101 / 0. 17.101 libpostproc 52. 2.100 / 52. 2.100 [mpeg2video @ 0201c7a0] mpeg_decode_postinit() failure Last message repeated 10 times [mpegts @ 0037b800] PES packet size mismatch Input #0, mpegts, from 'tsfile.ts': Duration: 00:01:30.58, start: 56297.848344, bitrate: 18045 kb/s Program 1 Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), s16, 384 kb/s </code></pre> <p>Here's a <strong>tsinfo.exe on the .ts file</strong>:</p> <pre><code>Reading from C:\tsfile.ts Scanning 10000 TS packets Packet 1 is PAT Program list: Program 1 -&gt; PID 0020 (32) Packet 2 is PMT with PID 0020 (32) Program 1, version 1, PCR PID 0031 (49) Program info (38 bytes): 0e 03 c0 b9 16 10 06 c0 02 71 c0 04 00 0b 02 42 3f 05 04 47 41 39 34 86 0d e2 65 6e 67 7e 3f ff 65 6e 67 c1 3f ff maximum bitrate (3 bytes): c0 b9 16 smoothing buffer (6 bytes): c0 02 71 c0 04 00 system clock (2 bytes): 42 3f Registration GA94 Descriptor tag 86 (134) (13 bytes): e2 65 6e 67 7e 3f ff 65 6e 67 c1 3f ff Program streams: PID 0031 ( 49) -&gt; Stream type 02 ( 2) H.262/13818-2 video (MPEG-2) or 11172-2 constrained video PID 0034 ( 52) -&gt; Stream type 81 (129) User private ES info (6 bytes): 6a 04 41 43 2d 33 DVB AC-3 (4 bytes): 41 43 2d 33 Found 14 PAT packets and 7 PMT packets in 10000 TS packets </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload