[FFmpeg-user] apad in pipe

Jonathan Baecker jonbae77 at gmail.com
Mon Jun 24 14:41:46 EEST 2019


Hello Everybody,

I have here clips with different length (more the 20 seconds) of audio 
and video line. For this clips I need to use apad filter.

But when I want to pipe the result, the pipe breaks exactly on that 
point when the apad filter should add silence.

When I encode the clip with apid first and then pipe that file again, it 
works.

Here are my command:

    ffmpeg -nostats -v error -ss 4999.0 -i "input.mp4" -filter_complex
    "[0:a]apad=whole_dur=41.11999999999989[a]" -map '0:v' -map '[a]'
    -c:v mpeg2video -c:a s302m -strict -2 -ac 2 -ar 48000 -f mpegts - |
    ffmpeg -i - -c:v libx264 -crf 23 -x264-params
    keyint=50:min-keyint=50:no-scenecut -maxrate 1300k -bufsize 2600k
    -preset medium -profile:v Main -level 3.1 -refs 3 -c:a libfdk_aac
    -ar 44100 -b:a 128k -f flv rtmp://example.org/live/stream


I know in that example the pipe makes no sense - please ignore this 
fact, it is just for explanation.

Here are the output:

    ffmpeg version N-45928-g2c5f6354c Copyright (c) 2000-2019 the FFmpeg
    developers
       built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
       configuration: --arch=x86_64 --disable-debug --disable-shared
    --disable-doc --enable-gpl --enable-version3
    --enable-runtime-cpudetect --enable-avfilter --enable-zlib
    --enable-opencl --enable-opengl --enable-fontconfig
    --enable-libfreetype --enable-libass --enable-libbluray
    --enable-libsrt --enable-libzimg --enable-libtwolame
    --enable-libmp3lame --enable-libopus --enable-libsoxr
    --enable-libaom --enable-libvpx --enable-libx264 --enable-libx265
    --enable-nonfree --enable-libfdk-aac --enable-decklink
    --enable-pocketsphinx
       libavutil      56. 28.100 / 56. 28.100
       libavcodec     58. 52.102 / 58. 52.102
       libavformat    58. 27.103 / 58. 27.103
       libavdevice    58.  7.100 / 58.  7.100
       libavfilter     7. 55.100 /  7. 55.100
       libswscale      5.  4.101 /  5.  4.101
       libswresample   3.  4.100 /  3.  4.100
       libpostproc    55.  4.100 / 55.  4.100
    Input #0, mpegts, from 'pipe:':
       Duration: N/A, start: 1.440000, bitrate: N/A
       Program 1
         Metadata:
           service_name    : Service01
           service_provider: FFmpeg
         Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] /
    0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 25
    fps, 25 tbr, 90k tbn, 50 tbc
         Stream #0:1[0x101]: Audio: s302m (BSSD / 0x44535342), 48000 Hz,
    stereo, s32 (24 bit), 2689 kb/s
    Stream mapping:
       Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
       Stream #0:1 -> #0:1 (s302m (native) -> aac (libfdk_aac))
    [libx264 @ 0x7fc5fb805e00] using SAR=1/1
    [libx264 @ 0x7fc5fb805e00] using cpu capabilities: MMX2 SSE2Fast
    SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x7fc5fb805e00] profile Main, level 3.1, 4:2:0, 8-bit
    [libx264 @ 0x7fc5fb805e00] 264 - core 157 r2935 545de2f -
    H.264/MPEG-4 AVC codec - Copyleft 2003-2019 -
    http://www.videolan.org/x264.html - options: cabac=1 ref=3
    deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1
    psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
    8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
    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=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 vbv_maxrate=1300 vbv_bufsize=2600 crf_max=0.0 nal_hrd=none
    filler=0 ip_ratio=1.40 aq=1:1.00
    Output #0, flv, to 'rtmp://example.org/live/stream':
       Metadata:
         encoder         : Lavf58.27.103
         Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007),
    yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc
         Metadata:
           encoder         : Lavc58.52.102 libx264
         Side data:
           cpb: bitrate max/min/avg: 1300000/0/0 buffer size: 2600000
    vbv_delay: -1
         Stream #0:1: Audio: aac (libfdk_aac) ([10][0][0][0] / 0x000A),
    44100 Hz, stereo, s16, 128 kb/s
         Metadata:
           encoder         : Lavc58.52.102 libfdk_aac
    [flv @ 0x7fc5fb802c00] Failed to update header with correct
    duration.931.1kbits/s speed=4.54x
    [flv @ 0x7fc5fb802c00] Failed to update header with correct filesize.
    frame= 1028 fps=113 q=-1.0 Lsize=    4785kB time=00:00:41.12
    bitrate= 953.3kbits/s speed= 4.5x
    video:4092kB audio:643kB subtitle:0kB other streams:0kB global
    headers:0kB muxing overhead: 1.054264%
    [libx264 @ 0x7fc5fb805e00] frame I:6     Avg QP:13.29  size: 22264
    [libx264 @ 0x7fc5fb805e00] frame P:833   Avg QP:18.44  size: 4611
    [libx264 @ 0x7fc5fb805e00] frame B:189   Avg QP:23.88  size: 1137
    [libx264 @ 0x7fc5fb805e00] consecutive B-frames: 69.7% 16.1% 3.2% 10.9%
    [libx264 @ 0x7fc5fb805e00] mb I  I16..4: 77.2%  0.0% 22.8%
    [libx264 @ 0x7fc5fb805e00] mb P  I16..4:  4.0%  0.0%  1.8% P16..4:
    11.9%  2.7%  1.6%  0.0%  0.0%    skip:78.0%
    [libx264 @ 0x7fc5fb805e00] mb B  I16..4:  1.0%  0.0%  0.1% B16..8:
    16.9%  0.8%  0.1%  direct: 0.6%  skip:80.5%  L0:70.8% L1:26.2% BI: 3.0%
    [libx264 @ 0x7fc5fb805e00] coded y,uvDC,uvAC intra: 21.8% 35.1% 2.8%
    inter: 2.7% 1.6% 0.1%
    [libx264 @ 0x7fc5fb805e00] i16 v,h,dc,p: 50% 35% 13%  1%
    [libx264 @ 0x7fc5fb805e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 45% 28%
    18%  2%  1%  2%  1%  2%  2%
    [libx264 @ 0x7fc5fb805e00] i8c dc,h,v,p: 53% 26% 20%  2%
    [libx264 @ 0x7fc5fb805e00] Weighted P-Frames: Y:1.1% UV:1.1%
    [libx264 @ 0x7fc5fb805e00] ref P L0: 78.7%  4.8% 11.4%  5.0% 0.0%
    [libx264 @ 0x7fc5fb805e00] ref B L0: 77.2% 21.2%  1.6%
    [libx264 @ 0x7fc5fb805e00] ref B L1: 91.8%  8.2%
    [libx264 @ 0x7fc5fb805e00] kb/s:815.12


Have you an idea why this is happen, and what I can do?

A good day to you!

Jonathan



More information about the ffmpeg-user mailing list