[FFmpeg-user] High memory usage when merging videos

Jonathan Girven jonathan.girven at trickbook.com
Mon Dec 19 16:54:07 EET 2016


>>   configuration:
>
>> --target-os=linux
>
> I guess this is wrong.

Thanks for all those useful tips on my configuration, I believe I have
implemented the improvements.

>> --extra-cflags='-I/home/jon/workspace/ffmpeg/ffmpeg-android/ffmpeg-build/armeabi-v7a/include
>
>> -O3 -fPIE -pie -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
>
> Why?
> If this is useful, it should probably be added to our configure script
> by default.
> If it is not useful, you should remove it.

This is not my area of expertise ... I have removed it.

>> --disable-outdevs --disable-decoders
>
> You may want to look at --disable-everything
> Its definition is something like "allow ffmpeg cli compilation but
> disable as many optional parts as possible".

I have experienced difficulties with --disable-everything before, but
no doubt because of being careless / lack of experience. I will look
into it again.

Just for reference, not because we were necessarily expecting a fix,
the new configuration has the same issue described previously:

ffmpeg -y -i new_f2f63d36-4d99-4b61-a212-7cf25bb9c45e_0_14300.mp4 -i
new_aa8ab6af-fa88-4026-9e09-8aff1b59174b_0_5910.mp4 -i
video_stamp_720.png -f lavfi -i color=black:s=1280x720
-filter_complex
"[0:v]setpts=PTS-STARTPTS[v0_trim0];[0:a]asetpts=PTS-STARTPTS[a0_trim0];[v0_trim0]fade=t=in:st=0:d=0.4:alpha=1,fade=t=out:st=13.900000184774399:d=0.4:alpha=1,format=pix_fmts=yuva420p[v0];[a0_trim0]afade=t=in:st=0:d=0.4,afade=t=out:st=13.900000184774399:d=0.4[a0];[1:v]setpts=PTS-STARTPTS[v1_trim1];[1:a]asetpts=PTS-STARTPTS[a1_trim1];[v1_trim1]fade=t=in:st=0:d=0.4:alpha=1,fade=t=out:st=5.509999841451645:d=0.4:alpha=1,format=pix_fmts=yuva420p,setpts=expr=PTS-STARTPTS+13.900000184774399/TB,fifo[v1];[a1_trim1]afade=t=in:st=0:d=0.4,afade=t=out:st=5.509999841451645:d=0.4[a_fade1];aevalsrc=0:d=13.900000184774399[na1];[na1][a_fade1]concat=n=2:v=0:a=1[a1];[a0][a1]amix=inputs=2[complete_audio];[complete_audio]volume=1.0[audio_vol];[3:v]trim=duration=19.81[over0];[over0][v0]overlay=eof_action=pass[over1];[over1][v1]overlay=eof_action=pass[over2];[over2][2:v]overlay=0:0,format=yuva420p[over3]"
-vcodec libx264 -preset faster -map [over3] -map [audio_vol] -acodec
aac -ac 2 -b:a 128k -strict -2
new_572e1912-b147-4448-b6ab-757c6027ca0c.mp4
ffmpeg version N-82880-g02aa070 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9 (GCC) 20140827 (prerelease)
  configuration: --target-os=android
--prefix=/home/jon/workspace/ffmpeg/ffmpeg-android/ffmpeg-build/armeabi-v7a
--arch=arm --cpu=armv7-a
--cross-prefix=/home/jon/Development/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
--sysroot=/home/jon/Development/android-ndk-r10e/platforms/android-5/arch-arm/
--extra-ldflags='-L/home/jon/workspace/ffmpeg/ffmpeg-android/ffmpeg-build/armeabi-v7a/lib
-fPIE -pie' --enable-gpl --enable-libx264 --enable-pic
--enable-version3 --disable-debug --disable-doc --disable-outdevs
--disable-programs --enable-ffmpeg --disable-decoders
--enable-decoder='mpeg4,aac,h264,mpegvideo,mpeg1video,mpeg2video,png,mjpeg,rawvideo,mp3,pcm_f64le,pcm_s16le,pcm_u8,flv,amrnb,svq1'
--disable-encoders
--enable-encoder='mpeg4,aac,h264,libx264,mpeg1video,mpeg2video,png,mjpeg,rawvideo,pcm_s16le,wrapped_avframe'
--disable-parsers
--enable-parser='aac,mpeg4video,ac3,h261,h264,vc1,mpegvideo'
--disable-demuxers
--enable-demuxer='aac,h264,mpegvideo,m4v,mov,vc1,mp4,concat,image2,mpegts,mp3,pcm_s16le,flv,matroska,avi,mov'
--disable-muxers
--enable-muxer='h264,mpeg1video,mpeg2video,m4v,mov,vc1,md5,mp4,image2,mpegts,segment,null'
--disable-filters
--enable-filter='aresample,scale,movie,overlay,color,fade,afade,pad,asetpts,amerge,aevalsrc,concat,amix,colorchannelmixer,eq,hue,atempo,hflip,vflip,transpose,volume,anullsrc'
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 68.100 / 57. 68.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'app_local_videos/new_f2f63d36-4d99-4b61-a212-7cf25bb9c45e_0_14300.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.61.100
  Duration: 00:00:14.34, start: 0.000000, bitrate: 874 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 741 kb/s, 16.67 fps, 16.67 tbr, 12800
tbn, 33.33 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from
'app_local_videos/new_aa8ab6af-fa88-4026-9e09-8aff1b59174b_0_5910.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.61.100
  Duration: 00:00:05.94, start: 0.000000, bitrate: 964 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 828 kb/s, 17.17 fps, 17.17 tbr, 13184
tbn, 34.33 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 131 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #2, image2, from 'app_images/video_stamp_720.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 478 kb/s
    Stream #2:0: Video: png, pal8(pc), 1280x720, 25 tbr, 25 tbn, 25 tbc
Input #3, lavfi, from 'color=black:s=1280x720':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #3:0: Video: rawvideo (I420 / 0x30323449), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0xb7deac50] using SAR=1/1
[libx264 @ 0xb7deac50] using cpu capabilities: ARMv6 NEON
[libx264 @ 0xb7deac50] profile High, level 3.1
[libx264 @ 0xb7deac50] 264 - core 148 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2016 - http://www.videolan.org/x264.html - options:
cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=4 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0
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=1 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=20 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to 'app_movies/new_572e1912-b147-4448-b6ab-757c6027ca0c.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.61.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25
tbc (default)
    Metadata:
      encoder         : Lavc57.68.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      encoder         : Lavc57.68.100 aac
Stream mapping:
  Stream #0:0 (h264) -> setpts
  Stream #0:1 (aac) -> asetpts
  Stream #1:0 (h264) -> setpts
  Stream #1:1 (aac) -> asetpts
  Stream #2:0 (png) -> overlay:overlay
  Stream #3:0 (rawvideo) -> trim
  format -> Stream #0:0 (libx264)
  volume -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
frame=  356 fps=5.2 q=28.0 size=    2215kB time=00:00:14.15
bitrate=1282.0kbits/s speed=0.206x


More information about the ffmpeg-user mailing list