[FFmpeg-user] multiple HLS outputs with different stream maps
Viorel Dehelean
synologic at gmail.com
Wed Jul 24 20:31:14 EEST 2019
Well, the problem with TEE remains, codec information is not saved into the
playlist.
Using -f hls does so i suspect there's something wrong with passing the
codec information downstream ?
Viorel
On Wed, Jul 24, 2019 at 4:09 PM andrei ka <andrei.k.gml at gmail.com> wrote:
> ok, -f tee was missing, this command works :
>
> ffmpeg.new -ignore_unknown -async 1 -probesize 1M -analyzeduration 1000000
> \
> -i $1 -threads 0 -fflags +genpts -filter_complex \
>
> "[0:v]yadif=0:-1:0[deinterlaced];[deinterlaced]split=4[v1][v2][v3][v4];[v1]copy[v1out];\
>
> [v2]scale=w=1280:h=720:force_original_aspect_ratio=disable[v2scale];[v2scale]pad=width=1280:height=720:x=(ow-iw)/2:y=0:color=black[v2out];\
>
> [v3]scale=w=800:h=450:force_original_aspect_ratio=disable[v3scale];[v3scale]pad=width=800:height=450:x=(ow-iw)/2:y=0:color=black[v3out];\
>
> [v4]scale=w=480:h=270:force_original_aspect_ratio=disable[v4scale];[v4scale]pad=width=480:height=270:x=(ow-iw)/2:y=0:color=black[v4out]"
> \
> -map [v1out] -x264opts:v:0 keyint=15:min-keyint=15:no-scenecut -flags:v:0
> +cgop -c:v:0 libx264 -profile:v:0 high -preset superfast \
> -b:v:0 8000k -maxrate:v:0 10000k -minrate:v:0 4000k -bufsize:v:0 8000k
> -level:v:0 4.1 \
> -map [v2out] -x264opts:v:1 keyint=15:min-keyint=15:no-scenecut -flags:v:1
> +cgop -c:v:1 libx264 -profile:v:1 high -preset superfast \
> -b:v:1 3000k -maxrate:v:1 3000k -minrate:v:1 1350k -bufsize:v:1 3000k
> -level:v:1 4.0 \
> -map [v3out] -x264opts:v:2 keyint=15:min-keyint=15:no-scenecut -flags:v:2
> +cgop -c:v:2 libx264 -profile:v:2 main -preset superfast \
> -b:v:2 900k -maxrate:v:2 900k -minrate:v:2 450k -bufsize:v:2 900k
> -level:v:2 3.1 \
> -map [v4out] -x264opts:v:3 keyint=15:min-keyint=15:no-scenecut -flags:v:3
> +cgop -c:v:3 libx264 -profile:v:3 baseline -preset superfast \
> -b:v:3 450k -maxrate:v:3 450k -minrate:v:3 150k -bufsize:v:3 450k
> -level:v:3 3.0 \
> -map a:0 -c:a:0 libfdk_aac -b:a:0 128k -metadata:s:a:0 language=eng \
> -map a:0 -c:a:1 libfdk_aac -b:a:1 128k -metadata:s:a:1 language=eng \
> -map a:0 -c:a:2 libfdk_aac -b:a:2 128k -metadata:s:a:2 language=eng \
> -map a:0 -c:a:3 libfdk_aac -b:a:3 128k -metadata:s:a:3 language=eng
> -shortest \
> -f tee \
>
> "[select=\'v:0,v:1,v:2,v:3,a:0\':f=hls:onfail=ignore:var_stream_map=\'v:0,agroup:audio
> v:1,agroup:audio v:2,agroup:audio v:3,agroup:audio a:0,agroup:audio\':\
>
> use_localtime=1:hls_allow_cache=0:hls_flags=discont_start+delete_segments+omit_endlist+second_level_segment_index+second_level_segment_size+second_level_segment_duration+program_date_time:\
>
> hls_start_number_source=datetime:hls_time=6:hls_list_size=10:hls_segment_filename=%v_stream_%%04d_%%08s_%%013t.ts:\
> master_pl_name=playlist.m3u8]variant_%v_manifest.m3u8|\
> [select=\'v:0,v:1,v:2,v:3,a:0,a:1,a:2,a:3\':f=hls:var_stream_map=\'v:0,a:0
> v:1,a:1 v:2,a:2 v:3,a:3\':\
>
> use_localtime=1:hls_allow_cache=0:hls_flags=discont_start+temp_file+delete_segments+omit_endlist+second_level_segment_index+second_level_segment_size+second_level_segment_duration+program_date_time:\
>
> hls_start_number_source=datetime:hls_time=6:hls_list_size=10:hls_segment_filename=%v_stream2_%Y%m%d%H%M%S_%%04d_%%08s_%%013t.ts:master_pl_name=playlist2.m3u8]ariant2_%v_manifest.m3u8"
>
> On Tue, Jul 23, 2019 at 4:50 PM andrei ka <andrei.k.gml at gmail.com> wrote:
>
> > i tried :
> >
> > ffmpeg -ignore_unknown -async 1 -probesize 1M -analyzeduration 1000000 \
> > -i src.ts -threads 0 -fflags +genpts \
> > -filter_complex
> > "[0:v]split=4[v1][v2][v3][v4];[v1]copy[v1out];[v2]scale=w=1280:h=720:\
> >
> >
> force_original_aspect_ratio=disable[v2scale];[v2scale]pad=width=1280:height=720:x=(ow-iw)/2:y=0:color=black[v2out];\
> >
> >
> [v3]scale=w=800:h=450:force_original_aspect_ratio=disable[v3scale];[v3scale]pad=width=800:height=450:x=(ow-iw)/2:\
> >
> y=0:color=black[v3out];[v4]scale=w=480:h=270:force_original_aspect_ratio=disable[v4scale];[v4scale]pad=width=480:height=270:x=(ow-iw)/2:y=0:color=black[v4out]"
> > \
> > -map [v1out] -x264opts:v:0 keyint=15:min-keyint=15:no-scenecut -flags:v:0
> > +cgop -c:v:0 libx264 -profile:v:0 high -level 4.0 -preset superfast
> -b:v:0
> > 8000k \
> > -maxrate:v:0 10000k -bufsize:v:0 4000k -minrate:v:0 4000k \
> > -map [v2out] -x264opts:v:1 keyint=15:min-keyint=15:no-scenecut -flags:v:1
> > +cgop -c:v:1 libx264 -profile:v:1 high -level 4.0 -preset superfast
> -b:v:1
> > 3000k \
> > -maxrate:v:1 3000k -bufsize:v:1 1350k -minrate:v:1 1350k \
> > -map [v3out] -x264opts:v:2 keyint=15:min-keyint=15:no-scenecut -flags:v:2
> > +cgop -c:v:2 libx264 -profile:v:2 main -level 3.1 -preset superfast
> -b:v:2
> > 900k \
> > -maxrate:v:2 900k -bufsize:v:2 450k -minrate:v:2 450k \
> > -map [v4out] -x264opts:v:3 keyint=15:min-keyint=15:no-scenecut -flags:v:3
> > +cgop -c:v:3 libx264 -profile:v:3 baseline -level 3.0 -preset superfast
> > -b:v:3 450k \
> > -maxrate:v:3 450k -bufsize:v:3 150k -minrate:v:3 150k \
> > -map a:0 -c:a:0 libfdk_aac -b:a:0 128k -metadata:s:a:0 language=ron \
> > -map a:0 -c:a:1 libfdk_aac -b:a:1 128k -metadata:s:a:1 language=ron \
> > -map a:0 -c:a:2 libfdk_aac -b:a:2 128k -metadata:s:a:2 language=ron \
> > -map a:0 -c:a:3 libfdk_aac -b:a:3 128k -metadata:s:a:3 language=ron \
> > -f hls -var_stream_map "v:0,a:0 v:1,a:0 v:2,a:2 v:3,a:0" \
> > -use_localtime 1 -hls_allow_cache 0 -hls_flags
> >
> discont_start+delete_segments+omit_endlist+second_level_segment_index+second_level_segment_size+second_level_segment_duration+program_date_time
> > \
> > -hls_start_number_source datetime -hls_time 6 -hls_list_size 10
> > -hls_segment_filename '%v_stream_%%04d_%%08s_%%013t.ts' -master_pl_name
> > playlist.m3u8 variant_%v_manifest.m3u8
> >
> > and i get :
> >
> > ffmpeg version N-91266-g8c20ea8 Copyright (c) 2000-2018 the FFmpeg
> > developers
> > built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
> > configuration: --enable-libass --prefix=/usr/local --enable-libfdk-aac
> > --enable-libfontconfig --enable-libfreetype --enable-libmp3lame
> > --enable-libopencv --enable-librtmp --enable-libsrt --enable-libvpx
> > --enable-libx264 --enable-libx265 --enable-libxml2 --enable-openssl
> > --enable-gpl --enable-nonfree
> > libavutil 56. 18.102 / 56. 18.102
> > libavcodec 58. 20.101 / 58. 20.101
> > libavformat 58. 17.100 / 58. 17.100
> > libavdevice 58. 4.100 / 58. 4.100
> > libavfilter 7. 25.100 / 7. 25.100
> > libswscale 5. 2.100 / 5. 2.100
> > libswresample 3. 2.100 / 3. 2.100
> > libpostproc 55. 2.100 / 55. 2.100
> > Input #0, mpegts, from 'src.ts':
> > Duration: 00:44:01.28, start: 1.437333, bitrate: 2159 kb/s
> > Program 1
> > Metadata:
> > service_name : Service01
> > service_provider: FFmpeg
> > Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
> > yuv420p(progressive), 1024x576 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k
> tbn,
> > 50 tbc
> > Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F),
> > 48000 Hz, stereo, fltp, 135 kb/s
> > Stream mapping:
> > Stream #0:0 (h264) -> split (graph 0)
> > copy (graph 0) -> Stream #0:0 (libx264)
> > pad (graph 0) -> Stream #0:1 (libx264)
> > pad (graph 0) -> Stream #0:2 (libx264)
> > pad (graph 0) -> Stream #0:3 (libx264)
> > Stream #0:1 -> #0:4 (aac (native) -> aac (libfdk_aac))
> > Stream #0:1 -> #0:5 (aac (native) -> aac (libfdk_aac))
> > Stream #0:1 -> #0:6 (aac (native) -> aac (libfdk_aac))
> > Stream #0:1 -> #0:7 (aac (native) -> aac (libfdk_aac))
> > Press [q] to stop, [?] for help
> > -async is forwarded to lavfi similarly to -af
> > aresample=async=1:min_hard_comp=0.100000:first_pts=0.
> > Last message repeated 3 times
> > [libx264 @ 0x27d0800] using SAR=1/1
> > [libx264 @ 0x27d0800] frame MB size (64x36) > level limit (1620)
> > [libx264 @ 0x27d0800] DPB size (4 frames, 9216 mbs) > level limit (3
> > frames, 8100 mbs)
> > [libx264 @ 0x27d0800] MB rate (57600) > level limit (40500)
> > [libx264 @ 0x27d0800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> > [libx264 @ 0x27d0800] profile High, level 3.0
> > [libx264 @ 0x27d0800] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC
> > codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
> options:
> > cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1
> > psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
> > cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
> > lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
> > bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
> > b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=15 keyint_min=8
> > scenecut=0 intra_refresh=0 rc_lookahead=0 rc=abr mbtree=0 bitrate=8000
> > ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=10000
> > vbv_bufsize=4000 nal_hrd=none filler=0 ip_ratio=1.40 pb_ratio=1.30
> aq=1:1.00
> > [libx264 @ 0x27d4440] using SAR=1/1
> > [libx264 @ 0x27d4440] frame MB size (80x45) > level limit (1620)
> > [libx264 @ 0x27d4440] DPB size (4 frames, 14400 mbs) > level limit (2
> > frames, 8100 mbs)
> > [libx264 @ 0x27d4440] MB rate (90000) > level limit (40500)
> > [libx264 @ 0x27d4440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> > [libx264 @ 0x27d4440] profile High, level 3.0
> > [libx264 @ 0x27d4440] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC
> > codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
> options:
> > cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1
> > psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
> > cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
> > lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
> > bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
> > b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=15 keyint_min=8
> > scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0 bitrate=3000
> > ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3000
> > vbv_bufsize=1350 nal_hrd=none filler=0 ip_ratio=1.40 pb_ratio=1.30
> aq=1:1.00
> > [libx264 @ 0x27d6800] using SAR=1/1
> > [libx264 @ 0x27d6800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> > [libx264 @ 0x27d6800] profile Main, level 3.0
> > [libx264 @ 0x27d6800] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC
> > codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
> options:
> > cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x1 me=dia subme=1 psy=1
> > psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
> > cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
> > lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
> > bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
> > b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=15 keyint_min=8
> > scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0 bitrate=900
> > ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=900
> > vbv_bufsize=450 nal_hrd=none filler=0 ip_ratio=1.40 pb_ratio=1.30
> aq=1:1.00
> > [libx264 @ 0x27d90c0] using SAR=1/1
> > [libx264 @ 0x27d90c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> > [libx264 @ 0x27d90c0] profile Constrained Baseline, level 3.0
> > [libx264 @ 0x27d90c0] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC
> > codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
> options:
> > cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0x1 me=dia subme=1 psy=1
> > psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
> > cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=8
> > lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
> > bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=15
> > keyint_min=8 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0
> > bitrate=450 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
> > vbv_maxrate=450 vbv_bufsize=150 nal_hrd=none filler=0 ip_ratio=1.40
> > aq=1:1.00
> > [hls @ 0x27cefc0] Opening
> > '0_stream_20190723164844_00000000_0000000000000.ts' for writing
> > [hls @ 0x27cefc0] Opening
> > '1_stream_20190723164844_00000000_0000000000000.ts' for writing
> > [hls @ 0x27cefc0] Opening
> > '2_stream_20190723164844_00000000_0000000000000.ts' for writing
> > [hls @ 0x27cefc0] Opening
> > '3_stream_20190723164844_00000000_0000000000000.ts' for writing
> > Output #0, hls, to 'variant_%v_manifest.m3u8':
> > Metadata:
> > encoder : Lavf58.17.100
> > Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 1024x576
> > [SAR 1:1 DAR 16:9], q=-1--1, 8000 kb/s, 25 fps, 90k tbn, 25 tbc
> > Metadata:
> > encoder : Lavc58.20.101 libx264
> > Side data:
> > cpb: bitrate max/min/avg: 10000000/0/8000000 buffer size: 4000000
> > vbv_delay: -1
> > Stream #0:1: Video: h264 (libx264), yuv420p(progressive), 1280x720
> > [SAR 1:1 DAR 16:9], q=-1--1, 3000 kb/s, 25 fps, 90k tbn, 25 tbc
> > Metadata:
> > encoder : Lavc58.20.101 libx264
> > Side data:
> > cpb: bitrate max/min/avg: 3000000/0/3000000 buffer size: 1350000
> > vbv_delay: -1
> > Stream #0:2: Video: h264 (libx264), yuv420p(progressive), 800x450
> [SAR
> > 1:1 DAR 16:9], q=-1--1, 900 kb/s, 25 fps, 90k tbn, 25 tbc
> > Metadata:
> > encoder : Lavc58.20.101 libx264
> > Side data:
> > cpb: bitrate max/min/avg: 900000/0/900000 buffer size: 450000
> > vbv_delay: -1
> > Stream #0:3: Video: h264 (libx264), yuv420p, 480x270 [SAR 1:1 DAR
> > 16:9], q=-1--1, 450 kb/s, 25 fps, 90k tbn, 25 tbc
> > Metadata:
> > encoder : Lavc58.20.101 libx264
> > Side data:
> > cpb: bitrate max/min/avg: 450000/0/450000 buffer size: 150000
> > vbv_delay: -1
> > Stream #0:4(ron): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 128
> > kb/s
> > Metadata:
> > encoder : Lavc58.20.101 libfdk_aac
> > Stream #0:5(ron): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 128
> > kb/s
> > Metadata:
> > encoder : Lavc58.20.101 libfdk_aac
> > Stream #0:6(ron): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 128
> > kb/s
> > Metadata:
> > encoder : Lavc58.20.101 libfdk_aac
> > Stream #0:7(ron): Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 128
> > kb/s
> > Metadata:
> > encoder : Lavc58.20.101 libfdk_aac
> > [hls @ 0x27cefc0] Unable to find mapping variant streamime=00:00:00.78
> > bitrate=N/A dup=4 drop=0 speed=0.76x
> > av_interleaved_write_frame(): Cannot allocate memory
> > [hls @ 0x27cefc0] Unable to find mapping variant stream
> > av_interleaved_write_frame(): Cannot allocate memory
> > [hls @ 0x27cefc0] Unable to find mapping variant stream
> > [hls @ 0x27cefc0] Opening 'variant_0_manifest.m3u8.tmp' for writing
> > [hls @ 0x27cefc0] Opening 'variant_1_manifest.m3u8.tmp' for writing
> > [hls @ 0x27cefc0] Opening 'variant_2_manifest.m3u8.tmp' for writing
> > [hls @ 0x27cefc0] Opening 'variant_3_manifest.m3u8.tmp' for writing
> > [hls @ 0x27cefc0] Opening 'playlist.m3u8' for writing
> > Segmentation fault
> >
> > On Tue, Jul 23, 2019 at 3:43 PM andrei ka <andrei.k.gml at gmail.com>
> wrote:
> >
> >>
> >> It's really hard for anyone to help if you don't show us the errors.
> >>> ;-) Preferably the complete, uncut console output.
> >>>
> >>> Moritz
> >>>
> >>
> >> it was the question for Vorlel, his scrip which he sez (in prevous msg)
> >> might be useful for some doesn't work
> >>
> >>
> >> _______________________________________________
> >>> ffmpeg-user mailing list
> >>> ffmpeg-user at ffmpeg.org
> >>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >>>
> >>> To unsubscribe, visit link above, or email
> >>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> >>
> >>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list