[FFmpeg-user] Speeding up a script.

DopeLabs dopelabs at dubstep.fm
Mon Aug 7 02:43:44 EEST 2017


you can search the ffmpeg-all man pages or online documentation for 'threads'

-filter_complex_threads nb_threads (global)
Defines how many threads are used to process a filter_complex graph. Similar to filter_threads but used for -filter_complex graphs only. The default is the number of available CPUs.

-filter_threads nb_threads (global)
Defines how many threads are used to process a filter pipeline. Each pipeline will produce a thread pool with this many threads available for parallel processing. The default is the number of available CPUs.

threads integer (decoding/encoding,video)
Set the number of threads to be used, in case the selected codec implementation supports multi-threading.

you can also set -preset ultrafast.

then there are the hevc threading options (man x265).

Threading, performance:
       --threads <integer>
              Number of threads for thread pool (0: detect CPU core count, default)

       -F/--frame-threads <integer>
              Number of concurrently encoded frames. 0: auto-determined by core count

       --[no-]wpp
              Enable Wavefront Parallel Processing. Default enabled

       --[no-]pmode
              Parallel mode analysis. Default disabled

       --[no-]pme
              Parallel motion estimation. Default disabled

       --[no-]asm <bool|int|string>
              Override CPU detection. Default: auto

 
> On Aug 6, 2017, at 6:16 01AM, Evert Vorster <evorster at gmail.com> wrote:
> 
> Hi there.
> I am using a quite convoluted filter in ffmpeg.
> -------------------------------------------------------------
> #!/bin/bash
> #This will split, defish, blend and re-assemble Samsung Gear 360 video
> map_dir="/data/Projects/RemapFilter"
> ffmpeg -y -i "$1" \
> -i $map_dir/lx.pgm -i $map_dir/ly.pgm -loop 1 \
> -i $map_dir/Alpha-Map.png \
> -i $map_dir/rx.pgm -i $map_dir/ry.pgm \
> -c:v hevc_nvenc -rc constqp -qp 26 -cq 26 \
> -filter_complex \
> "[0:v]eq=contrast=0.8:brightness=-0.01:gamma=0.7:saturation=0.8[bright]; \
> [bright]split=2[in1][in2]; \
> [in1]crop=in_w/2:in_h:0:in_h[l_crop];\
> [in2]crop=in_w/2:in_h:in_w/2:in_h[r_crop]; \
> [3]alphaextract[alf]; \
> [l_crop]vignette=angle=PI/4.6:mode=backward[l_vignette]; \
> [l_vignette][1][2]remap[l_remap]; \
> [r_crop]vignette=angle=PI/4.8:mode=backward[r_vignette]; \
> [r_vignette][4][5]remap[r_remap]; \
> [l_remap]crop=in_w:1920:0:(in_h-1920)/2[l_rm_crop]; \
> [r_remap]crop=in_w:1920:0:(in_h-1920)/2[r_rm_crop]; \
> [l_rm_crop][alf]alphamerge[l_rm_crop_a]; \
> [l_rm_crop_a]split=2[l_rm_crop1][l_rm_crop2]; \
> [l_rm_crop1]crop=in_w/2:in_h:0:0[l_rm_crop_l]; \
> [l_rm_crop2]crop=in_w/2:in_h:in_w/2:0[l_rm_crop_r]; \
> [0:v][r_rm_crop]overlay=(1920-(2028/2)):0[ov1]; \
> [ov1][l_rm_crop_l]overlay=((1920+2028/2)-(2028-1920)):0[ov2]; \
> [ov2][l_rm_crop_r]overlay=0:0[out]" \
> -map [out] -map 0:a "$1_Remapped.mp4"
> ---------------------------------------------------------
> 
> When this runs, only one of my CPU is showing any activity.
> Is there a way of telling ffmpeg to process these steps in the filter in
> parallel?
> 
> Kind regards,
> Evert Vorster
> 
> Isometrix Acquistion Superchief
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://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