FFMPEG Command to Convert MP4 to HLS Streaming Format with .m3u8 Playlist and .ts Video Segments
Jun 3, 2025
ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8
Show More Show Less View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you how to
0:04
convert a MP4 file into a live streaming
0:08
file HLS format so we have a very simple
0:12
MP4 file here you can see that 2 minute
0:15
10-second long video uh so I will show
0:18
you a very popular ffmpg command which
0:21
will actually convert this video file
0:23
and split it into different parts for
0:26
live streaming it so if you want to live
0:28
stream any MP4 video this command will
0:31
be very much helpful so I have given
0:34
this command in the description of this
0:36
video so what this command does it
0:38
actually converts the file into this
0:41
format which is
0:43
MME3008 playlist and then it converts it
0:47
to the HLS format which is useful if you
0:50
want to do HTTP live streaming so first
0:54
of all this command actually takes the
0:56
MP4 file and then it applies the codec
0:59
here by this dash codec colon and then
1:03
we copy the encoding settings and then
1:07
dash start number zero hls time so here
1:10
we are cutting and splitting the video
1:12
by 10 seconds so we are providing this
1:15
number right here which is 10 you can
1:18
change this number accordingly so at
1:20
after 10 seconds a new video will be
1:23
created and then hls list zero so this
1:28
is actually the command so if I just
1:30
enter
1:31
it so just make sure that you provide
1:33
the input file name so in this case the
1:36
file name is name is 1.mpp4 so let me
1:39
replace it so as soon as you do this you
1:42
will see it will actually split the
1:44
entire video into different chunks or se
1:48
segments which is TS file you will see
1:51
that
1:52
so this is file name zero file name
1:56
one so it has splitted the entire video
2:00
each video is taking 10 seconds so you
2:03
can
2:03
see the extension is TS if I go to the
2:07
properties you will see this is a TS
2:09
file
2:11
so if you want to live stream any kind
2:13
of MP4 video uh this is really helpful
2:17
because these chunks or segments can be
2:20
easily live streamed hello so this is
2:23
you can see exactly the length of this
2:25
video is 10 second the next part is this
2:27
one you can see this will contain the
2:29
next 10
2:30
seconds so if you are trying to live
2:33
stream a particular MP4 video then this
2:36
will be very helpful so it actually
2:40
converts your file into this playlist
2:43
M3 08 which is a very popular format
2:47
here which is used to HLS player you
2:50
will see it's a HLS stands for HTTP live
2:55
streaming so it converts
2:57
this MP4 video to this protocol which
3:00
allows you to deliver this video over
3:03
HTTP live streaming so you can actually
3:06
use this inside OBS Studio as well so
3:08
once you convert this video so this
3:11
command is really useful uh I've given
3:13
this command in the description of this
3:15
video you can do this with any kind of
3:17
video and also check out my website
3:21
freemediattools.com
3:22
uh which contains thousands of tools
#Online Video
#Consumer Electronics
#Software
#Multimedia Software
#Media Streaming Devices
#Video Sharing
