2

I download a lot of streams since the internet speed is too slow to watch high definition. When I download a stream I find the .m3u8 file which points to the TS files. Then I use the following command:

ffmpeg -i stream.m3u8 vid.mp4

This works. But it takes a really long time because it basically reëncodes everything, even though it's already the right format. To avoid reëncoding I can use this command:

ffmpeg -i stream.m3u8 -vcodec copy -acodec copy vid.mp4

This works fine when I play from start to end without interuption. But When I skip back or forward, vlc has trouble creating an image. It can't properly display for a few seconds. This is very annoying.

My question: How Can I create the video without complete reëncoding, but WITH good vlc rendering at any point?

3 Answers3

4

You're asking ffmpeg to encode the files into mp4 instead joining them into a single stream. You need to concatenate into temp.ts and then convert that into .mp4 with -codec copy.

Also, I believe you need to convert adts to aac in the second step -bsf:a aac_adtstoasc.

llogan
  • 63,280
hdezela
  • 151
1

If you do not re-encode, you might not be able to change the key frames etc of the video, resulting to the behavior you describe.

You could try however something like:

ffmpeg -i stream.m3u8 -codec:v "libx264" "-preset" "ultrafast" output.mp4

Keep in mind that what you gain in speed you lose in quality, so "fast" might be better...

ntg
  • 230
0

See my variant with ffmpeg mp4joiner

Screenshot

Journeyman Geek
  • 133,878
Bogdik
  • 11