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
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
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
what is main benefit of to use m3u8 instead of mp4?
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
man ..this code is amaizing..i can do both hls to mp4 and reverse.Thanks much
-codec: copy this is a very fast .but -hls_time not working. default every ts file time always it's 8s. how to do can change ts time, for example 4s or shorter time.
-codec: copy this is a very fast .but -hls_time not working. default every ts file time always it's 8s. how to do can change ts time, for example 4s or shorter time.
... https://ffmpeg.org/ffmpeg-formats.html#hls-2
Please, just read the docs? It's not that hard.
-codec: copy this is a very fast .but -hls_time not working. default every ts file time always it's 8s. how to do can change ts time, for example 4s or shorter time.
... https://ffmpeg.org/ffmpeg-formats.html#hls-2
Please, just read the docs? It's not that hard.
sorry.I read already.But still no answer why -hls_time 2 not work. this is my command.
ffmpeg -i file.mp4 -codec: copy -start_number 0 -hls_time 4 -hls_list_size 0 -f hls m3u8/file.m3u8.
but in the m3u8 file always is #EXTINF:8.341667. then I try
ffmpeg -i file.mp4 -force_key_frames "expr:gte(t,n_forced*4)" -codec: copy -start_number 0 -hls_time 4 -hls_list_size 0 -f hls m3u8/file.m3u8.
Same result.
then I use other command.
ffmpeg -i file.mp4 -codec: copy -map 0 -f segment -segment_list file.m3u8 -segment_time 00:00:04 file%03d.ts.
in the m3u8 file also is #EXTINF:8.341667. this -segment_time 00:00:04 also not work.
but when I not use -codec: copy this command can work normal.
ffmpeg -i file.mp4 -start_number 0 -hls_time 4 -hls_list_size 0 -f hls m3u8/file.m3u8. or
ffmpeg -i file.mp4 -map 0 -f segment -segment_list file.m3u8 -segment_time 00:00:04 file%03d.ts.
in the m3u8 file #EXTINF:4.004000. time change already. but it's very slow not with -codec: copy.
I don't why -codec: copy can't use -segment_time or -hls_time?
if anyone have answer plases tell me.
Thanks for good experience.
After conversion, It works good in Safari , but not in Chrome.
Is this Chrome's bug ?
how to make any m3u8 source use to own m3u8 make
Thanx!
Doesn't work with a HEVC unfortunately - audio only, no video
Great for me
I can't imagine developer burden without FFMPEG
-codec: copy this is a very fast .but -hls_time not working. default every ts file time always it's 8s. how to do can change ts time, for example 4s or shorter time.
... https://ffmpeg.org/ffmpeg-formats.html#hls-2
Please, just read the docs? It's not that hard.sorry.I read already.But still no answer why -hls_time 2 not work. this is my command.
ffmpeg -i file.mp4 -codec: copy -start_number 0 -hls_time 4 -hls_list_size 0 -f hls m3u8/file.m3u8. but in the m3u8 file always is #EXTINF:8.341667. then I try ffmpeg -i file.mp4 -force_key_frames "expr:gte(t,n_forced*4)" -codec: copy -start_number 0 -hls_time 4 -hls_list_size 0 -f hls m3u8/file.m3u8. Same result.
then I use other command. ffmpeg -i file.mp4 -codec: copy -map 0 -f segment -segment_list file.m3u8 -segment_time 00:00:04 file%03d.ts. in the m3u8 file also is #EXTINF:8.341667. this -segment_time 00:00:04 also not work.
but when I not use -codec: copy this command can work normal. ffmpeg -i file.mp4 -start_number 0 -hls_time 4 -hls_list_size 0 -f hls m3u8/file.m3u8. or ffmpeg -i file.mp4 -map 0 -f segment -segment_list file.m3u8 -segment_time 00:00:04 file%03d.ts. in the m3u8 file #EXTINF:4.004000. time change already. but it's very slow not with -codec: copy.
I don't why -codec: copy can't use -segment_time or -hls_time? if anyone have answer plases tell me.
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