FFMPEG Re-encode video after concatenation with complex filters












1














I have a bash script for FFMPEG which accepts two inputs Awoo.mkv and Awoo1.mkv.



./ffmpeg -y 
-i Awoo.mkv
-i Awoo2.mkv


These two files are concatenated using a complex filter, this is because in the future files with different codecs will be concatenated as well. Two outputs from this filter are created [outv] and [outa].



-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" 
-map '[outv]' -map '[outa]'


The video is then re-encoded with various settings into two separate streams. Stream v:0 and a:0 is in 1080, stream v:1 and a:1 is in 720.



-c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k 
-c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k


The final output is in HLS so some details for that are included



-hls_time 6 
-hls_list_size 2
-hls_flags delete_segments
-f hls -master_pl_name "${name}.m3u8"


The re-encoded output streams are then mapped, at this point there are two outputs for the different quality settings.



-map 0:v -map 0:a -map 0:v -map 0:a 


A variant stream mapping is then defined to include both output streams into the m3u8 playlist.



-var_stream_map "v:0,a:0 v:1,a:1" 


And finally some extra details for HLS.



-hls_segment_filename "sequence/${name}_%v-%d.ts" 
"sequence/${name}_%v.m3u8"


The is the entire script.



name=gw

./ffmpeg -y
-i Awoo.mkv
-i Awoo2.mkv
-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]"
-map '[outv]' -map '[outa]'
-c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
-c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
-hls_time 6
-hls_list_size 2
-hls_flags delete_segments
-f hls -master_pl_name "${name}.m3u8"
-map 0:v -map 0:a -map 0:v -map 0:a
-var_stream_map "v:0,a:0 v:1,a:1"
-hls_segment_filename "sequence/${name}_%v-%d.ts"
"sequence/${name}_%v.m3u8"


I know that without the concatenation filter and a single input this script works fine, i'm having trouble working out how exactly I can work the concatenation filter into it, especially with the mapping command and how it works.



If I try to run this script in it's current state I get the error:



[hls @ 0x6a30180] Unable to find mapping variant stream
av_interleaved_write_frame(): Cannot allocate memory


This is the entire output:



ffmpeg version 4.0.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, matroska,webm, from 'Awoo.mkv':
Metadata:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
ENCODER : Lavf56.40.101
Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
Stream #0:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
Metadata:
CREATION_TIME : 2017-01-27 05:02:53
LANGUAGE : und
HANDLER_NAME : VideoHandler
DURATION : 00:02:24.310000000
Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
Metadata:
LANGUAGE : eng
DURATION : 00:02:24.348000000
Input #1, matroska,webm, from 'Awoo2.mkv':
Metadata:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
ENCODER : Lavf56.40.101
Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
Stream #1:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
Metadata:
CREATION_TIME : 2017-01-27 05:02:53
LANGUAGE : und
HANDLER_NAME : VideoHandler
DURATION : 00:02:24.310000000
Stream #1:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
Metadata:
LANGUAGE : eng
DURATION : 00:02:24.348000000
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0 (graph 0)
Stream #0:1 (vorbis) -> concat:in0:a0 (graph 0)
Stream #1:0 (h264) -> concat:in1:v0 (graph 0)
Stream #1:1 (vorbis) -> concat:in1:a0 (graph 0)
concat:out:v0 (graph 0) -> Stream #0:0 (libx264)
concat:out:a0 (graph 0) -> Stream #0:1 (aac)
Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:3 (vorbis (native) -> aac (native))
Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:5 (vorbis (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x6a35bc0] using SAR=1/1
[libx264 @ 0x6a35bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x6a35bc0] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x6a35bc0] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=2500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x6a02980] using SAR=1/1
[libx264 @ 0x6a02980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x6a02980] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x6a02980] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x6b72640] using SAR=1/1
[libx264 @ 0x6b72640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x6b72640] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x6b72640] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=4000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[hls @ 0x6a30180] Opening 'sequence/gw_0-0.ts' for writing
[hls @ 0x6a30180] Opening 'sequence/gw_1-0.ts' for writing
Output #0, hls, to 'sequence/gw_%v.m3u8':
Metadata:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 4000 kb/s, 30 fps, 90k tbn, 30 tbc
Metadata:
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/4000000 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 512 kb/s
Metadata:
encoder : Lavc58.18.100 aac
Stream #0:2(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2500 kb/s, 30 fps, 90k tbn, 30 tbc (default)
Metadata:
CREATION_TIME : 2017-01-27 05:02:53
LANGUAGE : und
HANDLER_NAME : VideoHandler
DURATION : 00:02:24.310000000
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 0 vbv_delay: -1
Stream #0:3(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
LANGUAGE : eng
DURATION : 00:02:24.348000000
encoder : Lavc58.18.100 aac
Stream #0:4(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 29 fps, 29 tbn, 29 tbc (default)
Metadata:
CREATION_TIME : 2017-01-27 05:02:53
LANGUAGE : und
HANDLER_NAME : VideoHandler
DURATION : 00:02:24.310000000
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:5(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
LANGUAGE : eng
DURATION : 00:02:24.348000000
encoder : Lavc58.18.100 aac
frame= 41 fps=0.0 q=18.0 q=17.0 q=0.0 size=N/A time=00:00:01.46 bitrate=N/A du
[hls @ 0x6a30180] Unable to find mapping variant stream
av_interleaved_write_frame(): Cannot allocate memory









share|improve this question





























    1














    I have a bash script for FFMPEG which accepts two inputs Awoo.mkv and Awoo1.mkv.



    ./ffmpeg -y 
    -i Awoo.mkv
    -i Awoo2.mkv


    These two files are concatenated using a complex filter, this is because in the future files with different codecs will be concatenated as well. Two outputs from this filter are created [outv] and [outa].



    -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" 
    -map '[outv]' -map '[outa]'


    The video is then re-encoded with various settings into two separate streams. Stream v:0 and a:0 is in 1080, stream v:1 and a:1 is in 720.



    -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k 
    -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k


    The final output is in HLS so some details for that are included



    -hls_time 6 
    -hls_list_size 2
    -hls_flags delete_segments
    -f hls -master_pl_name "${name}.m3u8"


    The re-encoded output streams are then mapped, at this point there are two outputs for the different quality settings.



    -map 0:v -map 0:a -map 0:v -map 0:a 


    A variant stream mapping is then defined to include both output streams into the m3u8 playlist.



    -var_stream_map "v:0,a:0 v:1,a:1" 


    And finally some extra details for HLS.



    -hls_segment_filename "sequence/${name}_%v-%d.ts" 
    "sequence/${name}_%v.m3u8"


    The is the entire script.



    name=gw

    ./ffmpeg -y
    -i Awoo.mkv
    -i Awoo2.mkv
    -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]"
    -map '[outv]' -map '[outa]'
    -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
    -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
    -hls_time 6
    -hls_list_size 2
    -hls_flags delete_segments
    -f hls -master_pl_name "${name}.m3u8"
    -map 0:v -map 0:a -map 0:v -map 0:a
    -var_stream_map "v:0,a:0 v:1,a:1"
    -hls_segment_filename "sequence/${name}_%v-%d.ts"
    "sequence/${name}_%v.m3u8"


    I know that without the concatenation filter and a single input this script works fine, i'm having trouble working out how exactly I can work the concatenation filter into it, especially with the mapping command and how it works.



    If I try to run this script in it's current state I get the error:



    [hls @ 0x6a30180] Unable to find mapping variant stream
    av_interleaved_write_frame(): Cannot allocate memory


    This is the entire output:



    ffmpeg version 4.0.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
    built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
    libavutil 56. 14.100 / 56. 14.100
    libavcodec 58. 18.100 / 58. 18.100
    libavformat 58. 12.100 / 58. 12.100
    libavdevice 58. 3.100 / 58. 3.100
    libavfilter 7. 16.100 / 7. 16.100
    libswscale 5. 1.100 / 5. 1.100
    libswresample 3. 1.100 / 3. 1.100
    libpostproc 55. 1.100 / 55. 1.100
    Input #0, matroska,webm, from 'Awoo.mkv':
    Metadata:
    COMPATIBLE_BRANDS: iso6avc1mp41
    MAJOR_BRAND : dash
    MINOR_VERSION : 0
    ENCODER : Lavf56.40.101
    Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
    Stream #0:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
    Metadata:
    CREATION_TIME : 2017-01-27 05:02:53
    LANGUAGE : und
    HANDLER_NAME : VideoHandler
    DURATION : 00:02:24.310000000
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
    LANGUAGE : eng
    DURATION : 00:02:24.348000000
    Input #1, matroska,webm, from 'Awoo2.mkv':
    Metadata:
    COMPATIBLE_BRANDS: iso6avc1mp41
    MAJOR_BRAND : dash
    MINOR_VERSION : 0
    ENCODER : Lavf56.40.101
    Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
    Stream #1:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
    Metadata:
    CREATION_TIME : 2017-01-27 05:02:53
    LANGUAGE : und
    HANDLER_NAME : VideoHandler
    DURATION : 00:02:24.310000000
    Stream #1:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
    LANGUAGE : eng
    DURATION : 00:02:24.348000000
    Stream mapping:
    Stream #0:0 (h264) -> concat:in0:v0 (graph 0)
    Stream #0:1 (vorbis) -> concat:in0:a0 (graph 0)
    Stream #1:0 (h264) -> concat:in1:v0 (graph 0)
    Stream #1:1 (vorbis) -> concat:in1:a0 (graph 0)
    concat:out:v0 (graph 0) -> Stream #0:0 (libx264)
    concat:out:a0 (graph 0) -> Stream #0:1 (aac)
    Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:3 (vorbis (native) -> aac (native))
    Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:5 (vorbis (native) -> aac (native))
    Press [q] to stop, [?] for help
    [libx264 @ 0x6a35bc0] using SAR=1/1
    [libx264 @ 0x6a35bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x6a35bc0] profile High, level 4.0, 4:2:0, 8-bit
    [libx264 @ 0x6a35bc0] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=2500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [libx264 @ 0x6a02980] using SAR=1/1
    [libx264 @ 0x6a02980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x6a02980] profile High, level 3.1, 4:2:0, 8-bit
    [libx264 @ 0x6a02980] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [libx264 @ 0x6b72640] using SAR=1/1
    [libx264 @ 0x6b72640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x6b72640] profile High, level 4.0, 4:2:0, 8-bit
    [libx264 @ 0x6b72640] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=4000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [hls @ 0x6a30180] Opening 'sequence/gw_0-0.ts' for writing
    [hls @ 0x6a30180] Opening 'sequence/gw_1-0.ts' for writing
    Output #0, hls, to 'sequence/gw_%v.m3u8':
    Metadata:
    COMPATIBLE_BRANDS: iso6avc1mp41
    MAJOR_BRAND : dash
    MINOR_VERSION : 0
    encoder : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 4000 kb/s, 30 fps, 90k tbn, 30 tbc
    Metadata:
    encoder : Lavc58.18.100 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/4000000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 512 kb/s
    Metadata:
    encoder : Lavc58.18.100 aac
    Stream #0:2(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2500 kb/s, 30 fps, 90k tbn, 30 tbc (default)
    Metadata:
    CREATION_TIME : 2017-01-27 05:02:53
    LANGUAGE : und
    HANDLER_NAME : VideoHandler
    DURATION : 00:02:24.310000000
    encoder : Lavc58.18.100 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 0 vbv_delay: -1
    Stream #0:3(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
    LANGUAGE : eng
    DURATION : 00:02:24.348000000
    encoder : Lavc58.18.100 aac
    Stream #0:4(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 29 fps, 29 tbn, 29 tbc (default)
    Metadata:
    CREATION_TIME : 2017-01-27 05:02:53
    LANGUAGE : und
    HANDLER_NAME : VideoHandler
    DURATION : 00:02:24.310000000
    encoder : Lavc58.18.100 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:5(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
    LANGUAGE : eng
    DURATION : 00:02:24.348000000
    encoder : Lavc58.18.100 aac
    frame= 41 fps=0.0 q=18.0 q=17.0 q=0.0 size=N/A time=00:00:01.46 bitrate=N/A du
    [hls @ 0x6a30180] Unable to find mapping variant stream
    av_interleaved_write_frame(): Cannot allocate memory









    share|improve this question



























      1












      1








      1







      I have a bash script for FFMPEG which accepts two inputs Awoo.mkv and Awoo1.mkv.



      ./ffmpeg -y 
      -i Awoo.mkv
      -i Awoo2.mkv


      These two files are concatenated using a complex filter, this is because in the future files with different codecs will be concatenated as well. Two outputs from this filter are created [outv] and [outa].



      -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" 
      -map '[outv]' -map '[outa]'


      The video is then re-encoded with various settings into two separate streams. Stream v:0 and a:0 is in 1080, stream v:1 and a:1 is in 720.



      -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k 
      -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k


      The final output is in HLS so some details for that are included



      -hls_time 6 
      -hls_list_size 2
      -hls_flags delete_segments
      -f hls -master_pl_name "${name}.m3u8"


      The re-encoded output streams are then mapped, at this point there are two outputs for the different quality settings.



      -map 0:v -map 0:a -map 0:v -map 0:a 


      A variant stream mapping is then defined to include both output streams into the m3u8 playlist.



      -var_stream_map "v:0,a:0 v:1,a:1" 


      And finally some extra details for HLS.



      -hls_segment_filename "sequence/${name}_%v-%d.ts" 
      "sequence/${name}_%v.m3u8"


      The is the entire script.



      name=gw

      ./ffmpeg -y
      -i Awoo.mkv
      -i Awoo2.mkv
      -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]"
      -map '[outv]' -map '[outa]'
      -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
      -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
      -hls_time 6
      -hls_list_size 2
      -hls_flags delete_segments
      -f hls -master_pl_name "${name}.m3u8"
      -map 0:v -map 0:a -map 0:v -map 0:a
      -var_stream_map "v:0,a:0 v:1,a:1"
      -hls_segment_filename "sequence/${name}_%v-%d.ts"
      "sequence/${name}_%v.m3u8"


      I know that without the concatenation filter and a single input this script works fine, i'm having trouble working out how exactly I can work the concatenation filter into it, especially with the mapping command and how it works.



      If I try to run this script in it's current state I get the error:



      [hls @ 0x6a30180] Unable to find mapping variant stream
      av_interleaved_write_frame(): Cannot allocate memory


      This is the entire output:



      ffmpeg version 4.0.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
      configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
      libavutil 56. 14.100 / 56. 14.100
      libavcodec 58. 18.100 / 58. 18.100
      libavformat 58. 12.100 / 58. 12.100
      libavdevice 58. 3.100 / 58. 3.100
      libavfilter 7. 16.100 / 7. 16.100
      libswscale 5. 1.100 / 5. 1.100
      libswresample 3. 1.100 / 3. 1.100
      libpostproc 55. 1.100 / 55. 1.100
      Input #0, matroska,webm, from 'Awoo.mkv':
      Metadata:
      COMPATIBLE_BRANDS: iso6avc1mp41
      MAJOR_BRAND : dash
      MINOR_VERSION : 0
      ENCODER : Lavf56.40.101
      Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
      Stream #0:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      Input #1, matroska,webm, from 'Awoo2.mkv':
      Metadata:
      COMPATIBLE_BRANDS: iso6avc1mp41
      MAJOR_BRAND : dash
      MINOR_VERSION : 0
      ENCODER : Lavf56.40.101
      Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
      Stream #1:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      Stream #1:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      Stream mapping:
      Stream #0:0 (h264) -> concat:in0:v0 (graph 0)
      Stream #0:1 (vorbis) -> concat:in0:a0 (graph 0)
      Stream #1:0 (h264) -> concat:in1:v0 (graph 0)
      Stream #1:1 (vorbis) -> concat:in1:a0 (graph 0)
      concat:out:v0 (graph 0) -> Stream #0:0 (libx264)
      concat:out:a0 (graph 0) -> Stream #0:1 (aac)
      Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
      Stream #0:1 -> #0:3 (vorbis (native) -> aac (native))
      Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
      Stream #0:1 -> #0:5 (vorbis (native) -> aac (native))
      Press [q] to stop, [?] for help
      [libx264 @ 0x6a35bc0] using SAR=1/1
      [libx264 @ 0x6a35bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      [libx264 @ 0x6a35bc0] profile High, level 4.0, 4:2:0, 8-bit
      [libx264 @ 0x6a35bc0] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=2500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
      [libx264 @ 0x6a02980] using SAR=1/1
      [libx264 @ 0x6a02980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      [libx264 @ 0x6a02980] profile High, level 3.1, 4:2:0, 8-bit
      [libx264 @ 0x6a02980] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
      [libx264 @ 0x6b72640] using SAR=1/1
      [libx264 @ 0x6b72640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      [libx264 @ 0x6b72640] profile High, level 4.0, 4:2:0, 8-bit
      [libx264 @ 0x6b72640] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=4000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
      [hls @ 0x6a30180] Opening 'sequence/gw_0-0.ts' for writing
      [hls @ 0x6a30180] Opening 'sequence/gw_1-0.ts' for writing
      Output #0, hls, to 'sequence/gw_%v.m3u8':
      Metadata:
      COMPATIBLE_BRANDS: iso6avc1mp41
      MAJOR_BRAND : dash
      MINOR_VERSION : 0
      encoder : Lavf58.12.100
      Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 4000 kb/s, 30 fps, 90k tbn, 30 tbc
      Metadata:
      encoder : Lavc58.18.100 libx264
      Side data:
      cpb: bitrate max/min/avg: 0/0/4000000 buffer size: 0 vbv_delay: -1
      Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 512 kb/s
      Metadata:
      encoder : Lavc58.18.100 aac
      Stream #0:2(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2500 kb/s, 30 fps, 90k tbn, 30 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      encoder : Lavc58.18.100 libx264
      Side data:
      cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 0 vbv_delay: -1
      Stream #0:3(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 256 kb/s (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      encoder : Lavc58.18.100 aac
      Stream #0:4(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 29 fps, 29 tbn, 29 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      encoder : Lavc58.18.100 libx264
      Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
      Stream #0:5(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      encoder : Lavc58.18.100 aac
      frame= 41 fps=0.0 q=18.0 q=17.0 q=0.0 size=N/A time=00:00:01.46 bitrate=N/A du
      [hls @ 0x6a30180] Unable to find mapping variant stream
      av_interleaved_write_frame(): Cannot allocate memory









      share|improve this question















      I have a bash script for FFMPEG which accepts two inputs Awoo.mkv and Awoo1.mkv.



      ./ffmpeg -y 
      -i Awoo.mkv
      -i Awoo2.mkv


      These two files are concatenated using a complex filter, this is because in the future files with different codecs will be concatenated as well. Two outputs from this filter are created [outv] and [outa].



      -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" 
      -map '[outv]' -map '[outa]'


      The video is then re-encoded with various settings into two separate streams. Stream v:0 and a:0 is in 1080, stream v:1 and a:1 is in 720.



      -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k 
      -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k


      The final output is in HLS so some details for that are included



      -hls_time 6 
      -hls_list_size 2
      -hls_flags delete_segments
      -f hls -master_pl_name "${name}.m3u8"


      The re-encoded output streams are then mapped, at this point there are two outputs for the different quality settings.



      -map 0:v -map 0:a -map 0:v -map 0:a 


      A variant stream mapping is then defined to include both output streams into the m3u8 playlist.



      -var_stream_map "v:0,a:0 v:1,a:1" 


      And finally some extra details for HLS.



      -hls_segment_filename "sequence/${name}_%v-%d.ts" 
      "sequence/${name}_%v.m3u8"


      The is the entire script.



      name=gw

      ./ffmpeg -y
      -i Awoo.mkv
      -i Awoo2.mkv
      -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]"
      -map '[outv]' -map '[outa]'
      -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
      -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
      -hls_time 6
      -hls_list_size 2
      -hls_flags delete_segments
      -f hls -master_pl_name "${name}.m3u8"
      -map 0:v -map 0:a -map 0:v -map 0:a
      -var_stream_map "v:0,a:0 v:1,a:1"
      -hls_segment_filename "sequence/${name}_%v-%d.ts"
      "sequence/${name}_%v.m3u8"


      I know that without the concatenation filter and a single input this script works fine, i'm having trouble working out how exactly I can work the concatenation filter into it, especially with the mapping command and how it works.



      If I try to run this script in it's current state I get the error:



      [hls @ 0x6a30180] Unable to find mapping variant stream
      av_interleaved_write_frame(): Cannot allocate memory


      This is the entire output:



      ffmpeg version 4.0.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
      configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
      libavutil 56. 14.100 / 56. 14.100
      libavcodec 58. 18.100 / 58. 18.100
      libavformat 58. 12.100 / 58. 12.100
      libavdevice 58. 3.100 / 58. 3.100
      libavfilter 7. 16.100 / 7. 16.100
      libswscale 5. 1.100 / 5. 1.100
      libswresample 3. 1.100 / 3. 1.100
      libpostproc 55. 1.100 / 55. 1.100
      Input #0, matroska,webm, from 'Awoo.mkv':
      Metadata:
      COMPATIBLE_BRANDS: iso6avc1mp41
      MAJOR_BRAND : dash
      MINOR_VERSION : 0
      ENCODER : Lavf56.40.101
      Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
      Stream #0:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      Input #1, matroska,webm, from 'Awoo2.mkv':
      Metadata:
      COMPATIBLE_BRANDS: iso6avc1mp41
      MAJOR_BRAND : dash
      MINOR_VERSION : 0
      ENCODER : Lavf56.40.101
      Duration: 00:02:24.35, start: 0.000000, bitrate: 1114 kb/s
      Stream #1:0(und): Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29 fps, 29 tbr, 1k tbn, 58 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      Stream #1:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      Stream mapping:
      Stream #0:0 (h264) -> concat:in0:v0 (graph 0)
      Stream #0:1 (vorbis) -> concat:in0:a0 (graph 0)
      Stream #1:0 (h264) -> concat:in1:v0 (graph 0)
      Stream #1:1 (vorbis) -> concat:in1:a0 (graph 0)
      concat:out:v0 (graph 0) -> Stream #0:0 (libx264)
      concat:out:a0 (graph 0) -> Stream #0:1 (aac)
      Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
      Stream #0:1 -> #0:3 (vorbis (native) -> aac (native))
      Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
      Stream #0:1 -> #0:5 (vorbis (native) -> aac (native))
      Press [q] to stop, [?] for help
      [libx264 @ 0x6a35bc0] using SAR=1/1
      [libx264 @ 0x6a35bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      [libx264 @ 0x6a35bc0] profile High, level 4.0, 4:2:0, 8-bit
      [libx264 @ 0x6a35bc0] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=2500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
      [libx264 @ 0x6a02980] using SAR=1/1
      [libx264 @ 0x6a02980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      [libx264 @ 0x6a02980] profile High, level 3.1, 4:2:0, 8-bit
      [libx264 @ 0x6a02980] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
      [libx264 @ 0x6b72640] using SAR=1/1
      [libx264 @ 0x6b72640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      [libx264 @ 0x6b72640] profile High, level 4.0, 4:2:0, 8-bit
      [libx264 @ 0x6b72640] 264 - core 157 r2935 545de2f - 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=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=90 keyint_min=9 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=4000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
      [hls @ 0x6a30180] Opening 'sequence/gw_0-0.ts' for writing
      [hls @ 0x6a30180] Opening 'sequence/gw_1-0.ts' for writing
      Output #0, hls, to 'sequence/gw_%v.m3u8':
      Metadata:
      COMPATIBLE_BRANDS: iso6avc1mp41
      MAJOR_BRAND : dash
      MINOR_VERSION : 0
      encoder : Lavf58.12.100
      Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 4000 kb/s, 30 fps, 90k tbn, 30 tbc
      Metadata:
      encoder : Lavc58.18.100 libx264
      Side data:
      cpb: bitrate max/min/avg: 0/0/4000000 buffer size: 0 vbv_delay: -1
      Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 512 kb/s
      Metadata:
      encoder : Lavc58.18.100 aac
      Stream #0:2(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2500 kb/s, 30 fps, 90k tbn, 30 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      encoder : Lavc58.18.100 libx264
      Side data:
      cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 0 vbv_delay: -1
      Stream #0:3(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 256 kb/s (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      encoder : Lavc58.18.100 aac
      Stream #0:4(und): Video: h264 (libx264), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 29 fps, 29 tbn, 29 tbc (default)
      Metadata:
      CREATION_TIME : 2017-01-27 05:02:53
      LANGUAGE : und
      HANDLER_NAME : VideoHandler
      DURATION : 00:02:24.310000000
      encoder : Lavc58.18.100 libx264
      Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
      Stream #0:5(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
      LANGUAGE : eng
      DURATION : 00:02:24.348000000
      encoder : Lavc58.18.100 aac
      frame= 41 fps=0.0 q=18.0 q=17.0 q=0.0 size=N/A time=00:00:01.46 bitrate=N/A du
      [hls @ 0x6a30180] Unable to find mapping variant stream
      av_interleaved_write_frame(): Cannot allocate memory






      ffmpeg






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago







      Hugo

















      asked 2 days ago









      HugoHugo

      1063




      1063






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I think I've found a solution, I added an extra filter that does the exact same thing and only mapped the filter outputs:



          name=gw

          ./ffmpeg -y
          -i Awoo.mkv
          -i Awoo2.mkv
          -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
          -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
          -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
          -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
          -map [outv] -map [outa] -map [outv] -map [outa]
          -hls_time 6
          -hls_list_size 2
          -hls_flags delete_segments
          -hls_segment_filename "sequence/${name}_%v-%d.ts"
          -master_pl_name "${name}.m3u8"
          -var_stream_map "v:0,a:0 v:1,a:1"
          -f hls "sequence/${name}_%v.m3u8"


          If anyone knows any issues that this will cause, potential overhead, or any improvements what-so-ever I'd be happy to hear it.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390723%2fffmpeg-re-encode-video-after-concatenation-with-complex-filters%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I think I've found a solution, I added an extra filter that does the exact same thing and only mapped the filter outputs:



            name=gw

            ./ffmpeg -y
            -i Awoo.mkv
            -i Awoo2.mkv
            -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
            -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
            -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
            -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
            -map [outv] -map [outa] -map [outv] -map [outa]
            -hls_time 6
            -hls_list_size 2
            -hls_flags delete_segments
            -hls_segment_filename "sequence/${name}_%v-%d.ts"
            -master_pl_name "${name}.m3u8"
            -var_stream_map "v:0,a:0 v:1,a:1"
            -f hls "sequence/${name}_%v.m3u8"


            If anyone knows any issues that this will cause, potential overhead, or any improvements what-so-ever I'd be happy to hear it.






            share|improve this answer




























              0














              I think I've found a solution, I added an extra filter that does the exact same thing and only mapped the filter outputs:



              name=gw

              ./ffmpeg -y
              -i Awoo.mkv
              -i Awoo2.mkv
              -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
              -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
              -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
              -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
              -map [outv] -map [outa] -map [outv] -map [outa]
              -hls_time 6
              -hls_list_size 2
              -hls_flags delete_segments
              -hls_segment_filename "sequence/${name}_%v-%d.ts"
              -master_pl_name "${name}.m3u8"
              -var_stream_map "v:0,a:0 v:1,a:1"
              -f hls "sequence/${name}_%v.m3u8"


              If anyone knows any issues that this will cause, potential overhead, or any improvements what-so-ever I'd be happy to hear it.






              share|improve this answer


























                0












                0








                0






                I think I've found a solution, I added an extra filter that does the exact same thing and only mapped the filter outputs:



                name=gw

                ./ffmpeg -y
                -i Awoo.mkv
                -i Awoo2.mkv
                -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
                -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
                -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
                -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
                -map [outv] -map [outa] -map [outv] -map [outa]
                -hls_time 6
                -hls_list_size 2
                -hls_flags delete_segments
                -hls_segment_filename "sequence/${name}_%v-%d.ts"
                -master_pl_name "${name}.m3u8"
                -var_stream_map "v:0,a:0 v:1,a:1"
                -f hls "sequence/${name}_%v.m3u8"


                If anyone knows any issues that this will cause, potential overhead, or any improvements what-so-ever I'd be happy to hear it.






                share|improve this answer














                I think I've found a solution, I added an extra filter that does the exact same thing and only mapped the filter outputs:



                name=gw

                ./ffmpeg -y
                -i Awoo.mkv
                -i Awoo2.mkv
                -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
                -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1:unsafe=1:[outv][outa]"
                -c:v:0 libx264 -b:v:0 4000k -s:v:0 1920x1080 -r:v:0 30 -g:v:0 90 -preset:v:0 superfast -tune:v:0 zerolatency -level:v:0 4 -pix_fmt:v:0 yuv420p -c:a:0 aac -b:a:0 512k
                -c:v:1 libx264 -b:v:1 2500k -s:v:1 1280x720 -r:v:1 30 -g:v:1 90 -preset:v:1 superfast -tune:v:1 zerolatency -level:v:1 4 -pix_fmt:v:1 yuv420p -c:a:1 aac -b:a:1 256k
                -map [outv] -map [outa] -map [outv] -map [outa]
                -hls_time 6
                -hls_list_size 2
                -hls_flags delete_segments
                -hls_segment_filename "sequence/${name}_%v-%d.ts"
                -master_pl_name "${name}.m3u8"
                -var_stream_map "v:0,a:0 v:1,a:1"
                -f hls "sequence/${name}_%v.m3u8"


                If anyone knows any issues that this will cause, potential overhead, or any improvements what-so-ever I'd be happy to hear it.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited yesterday

























                answered yesterday









                HugoHugo

                1063




                1063






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390723%2fffmpeg-re-encode-video-after-concatenation-with-complex-filters%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to make a Squid Proxy server?

                    Is this a new Fibonacci Identity?

                    19世紀