Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8
@malikkurosaki
Copy link

malikkurosaki commented Apr 15, 2019

good job

@erfg12
Copy link

erfg12 commented Jun 24, 2019

This is a very fast method, and it keeps the files around the size of the original.

@Animatr
Copy link

Animatr commented Mar 22, 2020

Thanks, that was very useful for me

@ToshY
Copy link

ToshY commented Apr 6, 2020

Thanks, its fast and indeed roughly same size (1.03/1.04 times the original size)

@fabiotnt
Copy link

fabiotnt commented Apr 9, 2020

Awesome recipe! Very fast! Thanks

@mindjek07
Copy link

mindjek07 commented Aug 26, 2020

Awesome thanks bro

@vikinsa
Copy link

vikinsa commented Sep 3, 2020

well done!

@PatrissolJuns
Copy link

PatrissolJuns commented Jan 26, 2021

It saved my day. Well done!

@IBST-yoonSangHyeon
Copy link

IBST-yoonSangHyeon commented Mar 29, 2021

Thanks , So fast !

@llBiu
Copy link

llBiu commented Jun 5, 2021

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

is there how to use this setting to make a 720 and 480p playlist ?? how would she be? '' I'm new to coder I don't know much yet!

@kevin4dhd
Copy link

kevin4dhd commented Aug 16, 2021

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

is there how to use this setting to make a 720 and 480p playlist ?? how would she be? '' I'm new to coder I don't know much yet!

Any solution?

@lukebussey
Copy link
Author

lukebussey commented Aug 18, 2021

No, changing resolution would require re-encoding the file.

@M2G
Copy link

M2G commented Sep 20, 2021

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8
is there how to use this setting to make a 720 and 480p playlist ?? how would she be? '' I'm new to coder I don't know much yet!

Any solution?

like this ? ffmpeg -i input.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 -hls_time 10 -hls_list_size 0 -f hls index.m3u8

@ciniexpress
Copy link

ciniexpress commented Feb 10, 2022

I was looking for a code to convert video files in a directory where it has multiple subfolder for each video file. I want to run a batch code so it can convert the video files and save them where the original file was there.

Example:

Main folder : Movies

---> Subfolder1 : movie1.mp4

---> subfolder2 : movie2.mp4

---> subfolder3 : movie3.mkv

And so on.

I want the output to be same as the my main structure but in . m3u8 format.

I have used a code where it can convert each movie manually but for some reason I can use the .m3u8 file or link only in that server i can't make it work all over the internet.

for i in .mp4; do ffmpeg -i "$i" -c copy -map 0 -hls_time 3 -hls_list_size 0 -f hls "${i%.}.hls"; done

Thanks

@SilipTv5
Copy link

SilipTv5 commented Mar 2, 2022

what is main benefit of to use m3u8 instead of mp4?

@MLutt
Copy link

MLutt commented May 16, 2022

what is main benefit of to use m3u8 instead of mp4?

In short: If you need to ask, there won't be any.

In long: m3u8 is a HLS Index and widely used for streaming. E.g. transfering the least data possible to provide what is necessary for playback. Though I really do not understand how you didn't get that as literally a first google result... - https://en.wikipedia.org/wiki/HTTP_Live_Streaming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment