Body: <p>I am recording from my Linux TV-Sat receiver in MPEG-2 transport stream (mpeg2video) format. The recording starts before the actual movie, so it usually only has a single (local) audio stream in the beginning, which is correctly detected by ffmpeg or mediainfo:</p>
  <pre><code>Input #0, mpegts, from '20131112 2012 - Sky Cinema - Django Unchained.ts':
    Duration: 02:43:02.20, start: 5841.428544, bitrate: 3898 kb/s
    Program 8 
    Program 9 
    Program 10 
      Stream #0:0[0x20](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
      Stream #0:1[0x1ff]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
      Stream #0:2[0x200](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s (clean effects)
    Program 11 
    Program 20 
    Program 43 
    Program 251 
    Program 261 
    Program 3499 
    Program 3500 
    Program 3847 
    Program 4021 
    Program 4022 
    Program 4024 
  </code></pre>
  <p>Note the value for 'start' is taken from the recording itself when no explicit start value was given to ffmpeg by means of <code>-ss</code> or <code>(a)trim=</code>.</p>
  <p>However, after some time, a second (eg english) audio stream is coming along, and it can well be used in the conversion from .ts to .mp4 (for example):</p>
  <pre><code>Input #0, mpegts, from '20131112 2012 - Sky Cinema - Django Unchained.ts':
    Duration: 02:43:02.20, start: 5841.428544, bitrate: 3898 kb/s
    Program 8 
    Program 9 
    Program 10 
      Stream #0:0[0x20](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
      Stream #0:1[0x1ff]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
      Stream #0:2[0x200](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s (clean effects)
      Stream #0:3[0x201](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, 192 kb/s (clean effects)
      Stream #0:4[0x203](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 0 channels (clean effects)
    Program 11 
    Program 20 
    Program 43 
    Program 251 
    Program 261 
    Program 3499 
    Program 3500 
    Program 3847 
    Program 4021 
    Program 4022 
    Program 4024 
  Stream mapping:
    Stream #0:1 (mpeg2video) -&gt; trim
    Stream #0:2 (mp2) -&gt; atrim
    Stream #0:3 (mp2) -&gt; atrim
    setpts -&gt; Stream #0:0 (libx264)
    asetpts -&gt; Stream #0:1 (aac)
    asetpts -&gt; Stream #0:2 (aac)
  Press [q] to stop, [?] for help
  </code></pre>
  <p>(Note: here a value for 'start' was passed to ffmpeg; the value was manually derived and supplied after looking at the recorded .ts file)</p>
  <p>Is there a way to detect audio stream(s) without supplying any 'start' value?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-13T03:53:04.370Z
Comments.Text: *a value for 'start' was passed to ffmpeg* --> what does this mean?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-13T07:33:20.280Z
Comments.Text: Sorry, I was typing too quick. I wanted to say that in the second example, I am using "-ss nnn" as prefix to the input (-i) and/or use (a)trim= in the complex filter to "position" the transcoding process to the beginning of the actual movie within the recording, say after 1 or 2 minutes.
Comments.UserDisplayName: THN
Tags: <video><ffmpeg><audio><conversion><mpeg>
Title: How to detect "late" audio streams in MPEG-2 TS (with ffmpeg, ffprobe or mediainfo)?
UserDisplayName: THN
ThreadText: # How to detect "late" audio streams in MPEG-2 TS (with ffmpeg, ffprobe or mediainfo)?
  
  (Asked by: username_0 on 2021-04-12)
  
  I am recording from my Linux TV-Sat receiver in MPEG-2 transport stream (mpeg2video) format. The recording starts before the actual movie, so it usually only has a single (local) audio stream in the beginning, which is correctly detected by ffmpeg or mediainfo:
  
  ```
  Input #0, mpegts, from '20131112 2012 - Sky Cinema - Django Unchained.ts':
    Duration: 02:43:02.20, start: 5841.428544, bitrate: 3898 kb/s
    Program 8 
    Program 9 
    Program 10 
      Stream #0:0[0x20](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
      Stream #0:1[0x1ff]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
      Stream #0:2[0x200](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s (clean effects)
    Program 11 
    Program 20 
    Program 43 
    Program 251 
    Program 261 
    Program 3499 
    Program 3500 
    Program 3847 
    Program 4021 
    Program 4022 
    Program 4024 
  
  ```
  
  Note the value for 'start' is taken from the recording itself when no explicit start value was given to ffmpeg by means of `-ss` or `(a)trim=`.
  
  However, after some time, a second (eg english) audio stream is coming along, and it can well be used in the conversion from .ts to .mp4 (for example):
  
  ```
  Input #0, mpegts, from '20131112 2012 - Sky Cinema - Django Unchained.ts':
    Duration: 02:43:02.20, start: 5841.428544, bitrate: 3898 kb/s
    Program 8 
    Program 9 
    Program 10 
      Stream #0:0[0x20](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
      Stream #0:1[0x1ff]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
      Stream #0:2[0x200](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s (clean effects)
      Stream #0:3[0x201](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, 192 kb/s (clean effects)
      Stream #0:4[0x203](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 0 channels (clean effects)
    Program 11 
    Program 20 
    Program 43 
    Program 251 
    Program 261 
    Program 3499 
    Program 3500 
    Program 3847 
    Program 4021 
    Program 4022 
    Program 4024 
  Stream mapping:
    Stream #0:1 (mpeg2video) -> trim
    Stream #0:2 (mp2) -> atrim
    Stream #0:3 (mp2) -> atrim
    setpts -> Stream #0:0 (libx264)
    asetpts -> Stream #0:1 (aac)
    asetpts -> Stream #0:2 (aac)
  Press [q] to stop, [?] for help
  
  ```
  
  (Note: here a value for 'start' was passed to ffmpeg; the value was manually derived and supplied after looking at the recorded .ts file)
  
  Is there a way to detect audio stream(s) without supplying any 'start' value?
  
  **Tags:** video, ffmpeg, audio, conversion, mpeg
  
  > **Comments:**
  > **username_1**: *a value for 'start' was passed to ffmpeg* --> what does this mean?  
  > **username_0**: Sorry, I was typing too quick. I wanted to say that in the second example, I am using "-ss nnn" as prefix to the input (-i) and/or use (a)trim= in the complex filter to "position" the transcoding process to the beginning of the actual movie within the recording, say after 1 or 2 minutes.  
  
  ---
  
  ## 0 answers
  
  