0

I have a video I'd like to convert to HLS, however, when I run the command, it only records the last few segments to the master manifest. How can I get all of the fragments and their associated data into the same manifest?

Output manifest:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:16
#EXTINF:4.800000,
out-316.ts
#EXTINF:7.000000,
out-317.ts
#EXTINF:4.800000,
out-318.ts
#EXTINF:6.360000,
out-319.ts
#EXTINF:1.920000,
out-320.ts
#EXT-X-ENDLIST

Command and output:

$ ffmpeg -i segment-3.mp4 -c copy -copyts -hls_time 6 out-3.m3u8
ffmpeg version N-90649-g9825f77ac7 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 13.100 / 56. 13.100
  libavcodec     58. 17.100 / 58. 17.100
  libavformat    58. 11.101 / 58. 11.101
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 14.100 /  7. 14.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'segment-3.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.11.101
  Duration: 00:02:03.18, start: 39.915011, bitrate: 188 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 111 kb/s, 24.98 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 72 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[hls @ 0000028f6faf5380] Opening 'out-30.ts' for writing
Output #0, hls, to 'out-3.m3u8':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.11.101
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 111 kb/s, 24.98 fps, 25 tbr, 90k tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 72 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hls @ 0000028f6faf5380] Opening 'out-31.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-32.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-33.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-34.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-35.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-36.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-37.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-38.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-39.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-310.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-311.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-312.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-313.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-314.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-315.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-316.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-317.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-318.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-319.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-320.ts' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
[hls @ 0000028f6faf5380] Opening 'out-3.m3u8.tmp' for writing
frame= 3076 fps=0.0 q=-1.0 Lsize=N/A time=00:02:43.07 bitrate=N/A speed= 696x
video:1674kB audio:1083kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
1

Add -hls_playlist_type vod to the output parameters.

Doing this will write all the fragments to the same manifest, as well as add a #EXT-X-PLAYLIST-TYPE:VOD tag to the manifest.

You can also do -hls_list_size 0. The default for this is 5, which means the output manifest will contain up to 5 segments by default. Setting it to 0 will tell ffmpeg to contain all the fragments

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy