[FFmpeg-user] How to merge the segmented video files into one .MP4 video file?

Moritz Barsnick barsnick at gmx.net
Tue Mar 10 14:51:11 EET 2020

> I installed an app with Android Tablet, and then downloaded a video
> through this app. Actually the app download a  .m3u8 file and several
> .ts files. The file list picture and  .m3u8 files See Attachment. How
> can I merge these files to generate an mp4 video file?

Usually, just
$ ffmpeg -i 1053645342_1.m3u8 -c copy output.mp4
should be sufficient.

In this case, the m3u8 "playlist" refernces a crypto key:


I don't know whether the Android app inserted or modified this line.
You will have to get hold of that key file, and modify that line to
point to its location.

Or better: Just use the original video location with ffmpeg:

$ ffmpeg -i http://server.example.com/path/to/1053645342_1.m3u8 -c copy output.mp4

ffmpeg will then pick up the key file and decrypt the video for you.


More information about the ffmpeg-user mailing list