0
votes

I try this command using ffmpeg for converting mp4 to hls

ffmpeg -i test_video.mp4 -y
-preset veryslow -keyint_min 100 -g 100 -sc_threshold 0 -r 25 -c:v libx264 -pix_fmt yuv420p
-map v:0 -s:0 960x540 -b:v:0 2M -maxrate:0 2.14M -bufsize:0 3.5M
-map v:0 -s:1 416x234 -b:v:1 145k -maxrate:1 155k -bufsize:1 220k
-map v:0 -s:2 640x360 -b:v:2 365k -maxrate:2 390k -bufsize:2 640k
-map v:0 -s:3 $768x432 -b:v:3 730k -maxrate:3 781k -bufsize:3 1278k
-map v:0 -s:4 768x432 -b:v:4 1.1M -maxrate:4 1.17M -bufsize:4 2M
-map v:0 -s:5 1280x720 -b:v:5 3M -maxrate:5 3.21M -bufsize:5 5.5M
-map v:0 -s:6 1280x720 -b:v:6 4.5M -maxrate:6 4.8M -bufsize:6 8M
-map v:0 -s:7 1920x1080 -b:v:7 6M -maxrate:7 6.42M -bufsize:7 11M
-map v:0 -s:8 1920x1080 -b:v:8 7.8M -maxrate:8 8.3M -bufsize:8 14M
-map a:0 -map a:0 -map a:0 -map a:0 -map a:0 -map a:0 -map a:0 -map a:0 -map a:0 -c:a aac -b:a 128k -ac 1 -ar 44100
-f hls -hls_time 4 -hls_playlist_type vod -hls_flags independent_segments
-master_pl_name hls_multi/hls.m3u8
-hls_segment_filename hls_multi/stream_%v/s%06d.ts
-strftime_mkdir 1
-var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 v:3,a:3 v:4,a:4 v:5,a:5 v:6,a:6 v:7,a:7 v:8,a:8" hls_multi/stream_%v.m3u8

but I got this message

Stream map 'a:0' matches no streams. To ignore this, add a trailing '?' to the map.

so I tried to do it with the command:

ffmpeg -i test_video.mp4 -y
-preset veryslow -keyint_min 100 -g 100 -sc_threshold 0 -r 25 -c:v libx264 -pix_fmt yuv420p
-map v:0 -s:0 960x540 -b:v:0 2M -maxrate:0 2.14M -bufsize:0 3.5M
-map v:0 -s:1 416x234 -b:v:1 145k -maxrate:1 155k -bufsize:1 220k
-map v:0 -s:2 640x360 -b:v:2 365k -maxrate:2 390k -bufsize:2 640k
-map v:0 -s:3 $768x432 -b:v:3 730k -maxrate:3 781k -bufsize:3 1278k
-map v:0 -s:4 768x432 -b:v:4 1.1M -maxrate:4 1.17M -bufsize:4 2M
-map v:0 -s:5 1280x720 -b:v:5 3M -maxrate:5 3.21M -bufsize:5 5.5M
-map v:0 -s:6 1280x720 -b:v:6 4.5M -maxrate:6 4.8M -bufsize:6 8M
-map v:0 -s:7 1920x1080 -b:v:7 6M -maxrate:7 6.42M -bufsize:7 11M
-map v:0 -s:8 1920x1080 -b:v:8 7.8M -maxrate:8 8.3M -bufsize:8 14M
-map a:0? -map a:0? -map a:0? -map a:0? -map a:0? -map a:0? -map a:0? -map a:0? -map a:0? -c:a aac -b:a 128k -ac 1 -ar 44100
-f hls -hls_time 4 -hls_playlist_type vod -hls_flags independent_segments
-master_pl_name hls_multi/hls.m3u8
-hls_segment_filename hls_multi/stream_%v/s%06d.ts
-strftime_mkdir 1
-var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 v:3,a:3 v:4,a:4 v:5,a:5 v:6,a:6 v:7,a:7 v:8,a:8" hls_multi/stream_%v.m3u8

and got this message:

[hls @ 0x7f9e59808200] Unable to map stream at a:0 [hls @ 0x7f9e59808200] Variant stream info update failed with status ffffffea Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:8 --

the command:

ffprobe -i test_video.mp4

gave me this output:

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
built with Apple clang version 11.0.3 (clang-1103.0.32.62)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_video.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42mp41isomavc1 creation_time : 2016-10-29T07:22:11.000000Z Duration: 00:01:00.12, start: 0.000000, bitrate: 2394 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 2392 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default) Metadata: creation_time : 2016-10-29T07:22:11.000000Z handler_name : L-SMASH Video Handler encoder : AVC Coding

any suggestions? thanks

1
Share the full output of ffprobe -i test_video.mp4Gyan
Ok I edited the postADL

1 Answers

0
votes

If that's the full output, then there's no audio stream. Remove all references to audio streams from -var_stream_map.