Answers.Body: <p>You can use <a href="http://www.videohelp.com/tools/tsMuxeR" rel="nofollow">tsMuxer</a> to add the audio stream from one .ts file into the .ts file containing the video or vice versa. This is called muxing and doesn't affect the quality of the audio or video in any way.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-03T23:03:39.180Z
Answers.LastActivityDate: 2014-06-03T23:03:39.180Z
Answers.UserDisplayName: timonsku
Answers.Body: <p>Do you have a <a href="https://en.wikipedia.org/wiki/M3U" rel="nofollow"><code>m3u8</code></a> file? If so, I assume you can just do </p>
  
  <pre><code>ffmpeg -i indexfile.m3u8 -acodec copy -vcodec copy output.ts
  </code></pre>
  
  <p>You could also convert it directly into the mp4 container:</p>
  
  <pre><code>ffmpeg -i indexfile.m3u8 -acodec copy -vcodec copy output.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-04T20:40:06.810Z
Answers.Text: This does not work when the indexfile.m3u8 has a separate url for audio and a seperate url for video_01.m3u8
Answers.UserDisplayName: chovy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-06T01:08:51.890Z
Answers.Text: @chovy: Can you show me that file? I think it should possibly work with option `-map` and maybe a second option `-i` which takes the same inputfile (in your case `video_01.m3u8`).
Answers.UserDisplayName: erik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-07T02:07:55.177Z
Answers.Text: it works if i do `ffmpeg -i <audio-stream> -i <video-stream> -async 1 -c copy test.m3u8`
Answers.UserDisplayName: chovy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-21T17:51:44.440Z
Answers.LastActivityDate: 2016-04-21T17:51:44.440Z
Answers.UserDisplayName: erik
Body: <p>Apple HLS streams MPEG-2 TS files containing video and audio data in packetized elementary stream format. These segments (<code>.ts</code> files) can be joined in order to build final video.</p>
  
  <p>Recent version of HLS can now produce segments with video data only in TS files, and audio data only in another TS files. This is used to serve multilanguages video.</p>
  
  <p>Regardless of HLS itself, how can I process to remux TS files containing video data, and audio data, in one TS file? Joining TS files together doesn't work; I get data from first TS file combined with the same type of data from next TS files (only video or audio).</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-14T03:02:11.523Z
Comments.Text: I don't know enough to give an actual solution, but some reading seems to indicate that FFMPEG may be able to deal with this.
Comments.UserDisplayName: AJ Henderson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-14T16:47:47.407Z
Comments.Text: I just checked and yes, you are right. FFmpeg handles HLS with multiple audio tracks. I will take a look at source now.
Comments.UserDisplayName: Velcro
Tags: <streaming><transcoding><mpeg>
Title: Combine video and audio TS segments coming from HLS stream
UserDisplayName: Velcro
ThreadText: # Combine video and audio TS segments coming from HLS stream
  
  (Asked by: username_0 on 2014-05-13)
  
  Apple HLS streams MPEG-2 TS files containing video and audio data in packetized elementary stream format. These segments (`.ts` files) can be joined in order to build final video.
  
  Recent version of HLS can now produce segments with video data only in TS files, and audio data only in another TS files. This is used to serve multilanguages video.
  
  Regardless of HLS itself, how can I process to remux TS files containing video data, and audio data, in one TS file? Joining TS files together doesn't work; I get data from first TS file combined with the same type of data from next TS files (only video or audio).
  
  **Tags:** streaming, transcoding, mpeg
  
  > **Comments:**
  > **username_1**: I don't know enough to give an actual solution, but some reading seems to indicate that FFMPEG may be able to deal with this.  
  > **username_0**: I just checked and yes, you are right. FFmpeg handles HLS with multiple audio tracks. I will take a look at source now.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-03. Score: 3
  
  You can use [tsMuxer](http://www.videohelp.com/tools/tsMuxeR) to add the audio stream from one .ts file into the .ts file containing the video or vice versa. This is called muxing and doesn't affect the quality of the audio or video in any way.
  
  
  ---
  
  ### Answer by username_3 on 2016-04-21. Score: 1
  
  Do you have a [`m3u8`](https://en.wikipedia.org/wiki/M3U) file? If so, I assume you can just do
  
  ```
  ffmpeg -i indexfile.m3u8 -acodec copy -vcodec copy output.ts
  
  ```
  
  You could also convert it directly into the mp4 container:
  
  ```
  ffmpeg -i indexfile.m3u8 -acodec copy -vcodec copy output.mp4
  
  ```
  
  > **Comments:**
  > **username_4**: This does not work when the indexfile.m3u8 has a separate url for audio and a seperate url for video_01.m3u8  
  > **username_3**: @username_4: Can you show me that file? I think it should possibly work with option `-map` and maybe a second option `-i` which takes the same inputfile (in your case `video_01.m3u8`).  
  > **username_4**: it works if i do `ffmpeg -i <audio-stream> -i <video-stream> -async 1 -c copy test.m3u8`  
  
  ---
  
  