ffmpeg filter_complex 在线程有限的共享主机上

ffmpeg filter_complex 在线程有限的共享主机上

(免责声明:我擅长 PHP,但不熟悉 ffmpeg 或命令行,因此我的所有代码都是从互联网上复制的)

我正在使用启用了 ffmpeg(版本 2.6.8)的共享主机。

为了使任何 ffmpeg 命令起作用,我需要添加-threads 1到命令中。一切都运行良好,直到我需要使用filter_complex

例如,此命令:

ffmpeg -y -i "audio_1.mp3" -i "audio_2.mp3" -threads 1 -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map [a] -c:a libfdk_aac "test5.mp3" 2>&1

...应该覆盖两个 MP3 文件,但结果却是这样的输出:

Array (
    [0] => ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
    [1] =>   built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
    [2] =>   configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libdc1394 --enable-libfaac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
    [3] =>   libavutil      54. 20.100 / 54. 20.100
    [4] =>   libavcodec     56. 26.100 / 56. 26.100
    [5] =>   libavformat    56. 25.101 / 56. 25.101
    [6] =>   libavdevice    56.  4.100 / 56.  4.100
    [7] =>   libavfilter     5. 11.102 /  5. 11.102
    [8] =>   libavresample   2.  1.  0 /  2.  1.  0
    [9] =>   libswscale      3.  1.101 /  3.  1.101
    [10] =>   libswresample   1.  1.100 /  1.  1.100
    [11] =>   libpostproc    53.  3.100 / 53.  3.100
    [12] => Input #0, mp3, from 'audio_1.mp3':
    [13] =>   Metadata:
    [14] =>     encoder         : Lavf54.21.100
    [15] =>   Duration: 00:00:04.10, start: 0.023021, bitrate: 64 kb/s
    [16] =>     Stream #0:0: Audio: mp3, 48000 Hz, mono, s16p, 64 kb/s
    [17] => Input #1, mp3, from 'audio_2.mp3':
    [18] =>   Metadata:
    [19] =>     encoder         : Lavf54.21.100
    [20] =>   Duration: 00:00:10.25, start: 0.023021, bitrate: 64 kb/s
    [21] =>     Stream #1:0: Audio: mp3, 48000 Hz, mono, s16p, 64 kb/s
    [22] => [AVFilterGraph @ 0x21748a0] Error initializing threading.
    [23] => [AVFilterGraph @ 0x21748a0] Error creating filter 'amerge'
    [24] => Error configuring filters.
)

我在网上找到了一些关于和的信息-filter_threads 1-filter_complex_threads 1并试图将它们插入到命令的各个位置——错误总是

Unrecognized option 'filter_threads'.
Error splitting the argument list: Option not found

或者

Unrecognized option 'filter_complex_threads'.
Error splitting the argument list: Option not found

我与主机支持人员进行了交谈,他们说命令肯定是错误的,但是我尝试的所有操作都filter_complex因线程问题而失败。

我的过滤列表(ffmpeg -filters)显示:

Array
(
    [0] => Filters:
    [1] =>   T.. = Timeline support
    [2] =>   .S. = Slice threading
    [3] =>   ..C = Commmand support
    [4] =>   A = Audio input/output
    [5] =>   V = Video input/output
    [6] =>   N = Dynamic number and/or type of input/output
    [7] =>   | = Source or sink filter
    [8] =>  T.. adelay           A->A       Delay one or more audio channels.
    [9] =>  ... aecho            A->A       Add echoing to the audio.
    [10] =>  ... aeval            A->A       Filter audio signal according to a specified expression.
    [11] =>  T.. afade            A->A       Fade in/out input audio.
    [12] =>  ... aformat          A->A       Convert the input audio to one of the specified formats.
    [13] =>  ... ainterleave      N->A       Temporally interleave audio inputs.
    [14] =>  ... allpass          A->A       Apply a two-pole all-pass filter.
    [15] =>  ... amerge           N->A       Merge two or more audio streams into a single multi-channel stream.
    [16] =>  ... amix             N->A       Audio mixing.
    [17] =>  ... anull            A->A       Pass the source unchanged to the output.
    [18] =>  T.. apad             A->A       Pad audio with silence.
    [19] =>  ... aperms           A->A       Set permissions for the output audio frame.
    [20] =>  ... aphaser          A->A       Add a phasing effect to the audio.
    [21] =>  ... aresample        A->A       Resample audio data.
    [22] =>  ... aselect          A->N       Select audio frames to pass in output.
    [23] =>  ... asendcmd         A->A       Send commands to filters.
    [24] =>  ... asetnsamples     A->A       Set the number of samples for each output audio frames.
    [25] =>  ... asetpts          A->A       Set PTS for the output audio frame.
    [26] =>  ... asetrate         A->A       Change the sample rate without altering the data.
    [27] =>  ... asettb           A->A       Set timebase for the audio output link.
    [28] =>  ... ashowinfo        A->A       Show textual information for each audio frame.
    [29] =>  ... asplit           A->N       Pass on the audio input to N audio outputs.
    [30] =>  ... astats           A->A       Show time domain statistics about audio frames.
    [31] =>  ... astreamsync      AA->AA     Copy two streams of audio data in a configurable order.
    [32] =>  ... asyncts          A->A       Sync audio data to timestamps
    [33] =>  ..C atempo           A->A       Adjust audio tempo.
    [34] =>  ... atrim            A->A       Pick one continuous section from the input, drop the rest.
    [35] =>  ... bandpass         A->A       Apply a two-pole Butterworth band-pass filter.
    [36] =>  ... bandreject       A->A       Apply a two-pole Butterworth band-reject filter.
    [37] =>  ... bass             A->A       Boost or cut lower frequencies.
    [38] =>  ... biquad           A->A       Apply a biquad IIR filter with the given coefficients.
    [39] =>  ... channelmap       A->A       Remap audio channels.
    [40] =>  ... channelsplit     A->N       Split audio into per-channel streams.
    [41] =>  ... compand          A->A       Compress or expand audio dynamic range.
    [42] =>  T.. dcshift          A->A       Apply a DC shift to the audio.
    [43] =>  ... earwax           A->A       Widen the stereo image.
    [44] =>  ... ebur128          A->N       EBU R128 scanner.
    [45] =>  ... equalizer        A->A       Apply two-pole peaking equalization (EQ) filter.
    [46] =>  ... flanger          A->A       Apply a flanging effect to the audio.
    [47] =>  ... highpass         A->A       Apply a high-pass filter with 3dB point frequency.
    [48] =>  ... join             N->A       Join multiple audio streams into multi-channel output.
    [49] =>  ..C ladspa           N->A       Apply LADSPA effect.
    [50] =>  ... lowpass          A->A       Apply a low-pass filter with 3dB point frequency.
    [51] =>  ... pan              A->A       Remix channels with coefficients (panning).
    [52] =>  ... replaygain       A->A       ReplayGain scanner.
    [53] =>  ... resample         A->A       Audio resampling and conversion.
    [54] =>  ... silencedetect    A->A       Detect silence.
    [55] =>  ... silenceremove    A->A       Remove silence.
    [56] =>  ... treble           A->A       Boost or cut upper frequencies.
    [57] =>  T.C volume           A->A       Change input volume.
    [58] =>  ... volumedetect     A->A       Detect audio volume.
    [59] =>  ... aevalsrc         |->A       Generate an audio signal generated by an expression.
    [60] =>  ... anullsrc         |->A       Null audio source, return empty audio frames.
    [61] =>  ... sine             |->A       Generate sine wave audio signal.
    [62] =>  ... anullsink        A->|       Do absolutely nothing with the input audio.
    [63] =>  ... alphaextract     V->N       Extract an alpha channel as a grayscale image component.
    [64] =>  ... alphamerge       VV->V      Copy the luma value of the second input into the alpha channel of the first input.
    [65] =>  ... ass              V->V       Render ASS subtitles onto input video using the libass library.
    [66] =>  T.. bbox             V->V       Compute bounding box for each frame.
    [67] =>  ... blackdetect      V->V       Detect video intervals that are (almost) black.
    [68] =>  ... blackframe       V->V       Detect frames that are (almost) black.
    [69] =>  TS. blend            VV->V      Blend two video frames into each other.
    [70] =>  T.. boxblur          V->V       Blur the input.
    [71] =>  T.. codecview        V->V       Visualize information about some codecs
    [72] =>  T.. colorbalance     V->V       Adjust the color balance.
    [73] =>  T.. colorchannelmixer V->V       Adjust colors by mixing color channels.
    [74] =>  T.. colorlevels      V->V       Adjust the color levels.
    [75] =>  T.. colormatrix      V->V       Convert color matrix.
    [76] =>  ... copy             V->V       Copy the input video unchanged to the output.
    [77] =>  ... crop             V->V       Crop the input video.
    [78] =>  T.. cropdetect       V->V       Auto-detect crop size.
    [79] =>  TS. curves           V->V       Adjust components curves.
    [80] =>  TS. dctdnoiz         V->V       Denoise frames using 2D DCT.
    [81] =>  ... decimate         N->V       Decimate frames (post field matching filter).
    [82] =>  ... dejudder         V->V       Remove judder produced by pullup.
    [83] =>  T.. delogo           V->V       Remove logo from input video.
    [84] =>  ... deshake          V->V       Stabilize shaky video.
    [85] =>  T.. drawbox          V->V       Draw a colored box on the input video.
    [86] =>  T.. drawgrid         V->V       Draw a colored grid on the input video.
    [87] =>  T.C drawtext         V->V       Draw text on top of video frames using libfreetype library.
    [88] =>  T.. edgedetect       V->V       Detect and draw edge.
    [89] =>  ... elbg             V->V       Apply posterize effect, using the ELBG algorithm.
    [90] =>  ..C eq               V->V       Adjust brightness, contrast, gamma, and saturation.
    [91] =>  ... extractplanes    V->N       Extract planes as grayscale frames.
    [92] =>  .S. fade             V->V       Fade in/out input video.
    [93] =>  ... field            V->V       Extract a field from the input video.
    [94] =>  ... fieldmatch       N->V       Field matching for inverse telecine.
    [95] =>  T.. fieldorder       V->V       Set the field order.
    [96] =>  ... format           V->V       Convert the input video to one of the specified pixel formats.
    [97] =>  ... fps              V->V       Force constant framerate.
    [98] =>  ... framepack        VV->V      Generate a frame packed stereoscopic video.
    [99] =>  T.. framestep        V->V       Select one frame every N frames.
    [100] =>  T.. fspp             V->V       Apply Fast Simple Post-processing filter.
    [101] =>  T.. geq              V->V       Apply generic equation to each pixel.
    [102] =>  T.. gradfun          V->V       Debands video quickly using gradients.
    [103] =>  TS. haldclut         VV->V      Adjust colors using a Hald CLUT.
    [104] =>  .S. hflip            V->V       Horizontally flip the input video.
    [105] =>  T.. histeq           V->V       Apply global color histogram equalization.
    [106] =>  ... histogram        V->V       Compute and draw a histogram.
    [107] =>  T.. hqdn3d           V->V       Apply a High Quality 3D Denoiser.
    [108] =>  .S. hqx              V->V       Scale the input by 2, 3 or 4 using the hq*x magnification algorithm.
    [109] =>  T.C hue              V->V       Adjust the hue and saturation of the input video.
    [110] =>  ... idet             V->V       Interlace detect Filter.
    [111] =>  T.. il               V->V       Deinterleave or interleave fields.
    [112] =>  ... interlace        V->V       Convert progressive video into interlaced.
    [113] =>  ... interleave       N->V       Temporally interleave video inputs.
    [114] =>  ... kerndeint        V->V       Apply kernel deinterlacing to the input.
    [115] =>  .S. lenscorrection   V->V       Rectify the image by correcting for lens distortion.
    [116] =>  TS. lut3d            V->V       Adjust colors using a 3D LUT.
    [117] =>  T.. lut              V->V       Compute and apply a lookup table to the RGB/YUV input video.
    [118] =>  T.. lutrgb           V->V       Compute and apply a lookup table to the RGB input video.
    [119] =>  T.. lutyuv           V->V       Compute and apply a lookup table to the YUV input video.
    [120] =>  ... mcdeint          V->V       Apply motion compensating deinterlacing.
    [121] =>  ... mergeplanes      N->V       Merge planes.
    [122] =>  ... mpdecimate       V->V       Remove near-duplicate frames.
    [123] =>  T.. negate           V->V       Negate input video.
    [124] =>  ... noformat         V->V       Force libavfilter not to use any of the specified pixel formats for the input to the next filter.
    [125] =>  TS. noise            V->V       Add noise.
    [126] =>  ... null             V->V       Pass the source unchanged to the output.
    [127] =>  T.C overlay          VV->V      Overlay a video source on top of the input.
    [128] =>  T.. owdenoise        V->V       Denoise using wavelets.
    [129] =>  ... pad              V->V       Pad the input video.
    [130] =>  ... palettegen       V->V       Find the optimal palette for a given stream.
    [131] =>  ... paletteuse       VV->V      Use a palette to downsample an input video stream.
    [132] =>  ... perms            V->V       Set permissions for the output video frame.
    [133] =>  TS. perspective      V->V       Correct the perspective of video.
    [134] =>  T.. phase            V->V       Phase shift fields.
    [135] =>  ... pixdesctest      V->V       Test pixel format definitions.
    [136] =>  T.C pp               V->V       Filter video using libpostproc.
    [137] =>  T.. pp7              V->V       Apply Postprocessing 7 filter.
    [138] =>  ... psnr             VV->V      Calculate the PSNR between two video streams.
    [139] =>  ... pullup           V->V       Pullup from field sequence to frames.
    [140] =>  T.. qp               V->V       Change video quantization parameters.
    [141] =>  T.. removelogo       V->V       Remove a TV logo based on a mask image.
    [142] =>  ... repeatfields     V->V       Hard repeat fields based on MPEG repeat field flag.
    [143] =>  TSC rotate           V->V       Rotate the input image.
    [144] =>  T.. sab              V->V       Apply shape adaptive blur.
    [145] =>  ... scale            V->V       Scale the input video size and/or convert the image format.
    [146] =>  ... select           V->N       Select video frames to pass in output.
    [147] =>  ... sendcmd          V->V       Send commands to filters.
    [148] =>  ... separatefields   V->V       Split input video frames into fields.
    [149] =>  ... setdar           V->V       Set the frame display aspect ratio.
    [150] =>  ... setfield         V->V       Force field for the output video frame.
    [151] =>  ... setpts           V->V       Set PTS for the output video frame.
    [152] =>  ... setsar           V->V       Set the pixel sample aspect ratio.
    [153] =>  ... settb            V->V       Set timebase for the video output link.
    [154] =>  ... showinfo         V->V       Show textual information for each video frame.
    [155] =>  T.. showpalette      V->V       Display frame palette
    [156] =>  ... shuffleplanes    V->V       Shuffle video planes
    [157] =>  .S. signalstats      V->V       Generate statistics from video analysis.
    [158] =>  T.. smartblur        V->V       Blur the input video without impacting the outlines.
    [159] =>  ... split            V->N       Pass on the input to N video outputs.
    [160] =>  T.C spp              V->V       Apply a simple post processing filter.
    [161] =>  ... stereo3d         V->V       Convert video stereoscopic 3D view.
    [162] =>  ... subtitles        V->V       Render text subtitles onto input video using the libass library.
    [163] =>  ... super2xsai       V->V       Scale the input by 2x using the Super2xSaI pixel art algorithm.
    [164] =>  ... swapuv           V->V       Swap U and V components.
    [165] =>  .S. tblend           V->V       Blend successive frames.
    [166] =>  ... telecine         V->V       Apply a telecine pattern.
    [167] =>  ... thumbnail        V->V       Select the most representative frame in a given sequence of consecutive frames.
    [168] =>  ... tile             V->V       Tile several successive frames together.
    [169] =>  ... tinterlace       V->V       Perform temporal field interlacing.
    [170] =>  .S. transpose        V->V       Transpose input video.
    [171] =>  ... trim             V->V       Pick one continuous section from the input, drop the rest.
    [172] =>  T.. unsharp          V->V       Sharpen or blur the input video.
    [173] =>  T.. uspp             V->V       Apply Ultra Simple / Slow Post-processing filter.
    [174] =>  ... vflip            V->V       Flip the input video vertically.
    [175] =>  T.. vignette         V->V       Make or reverse a vignette effect.
    [176] =>  T.. w3fdif           V->V       Apply Martin Weston three field deinterlace.
    [177] =>  .S. xbr              V->V       Scale the input using xBR algorithm.
    [178] =>  TS. yadif            V->V       Deinterlace the input image.
    [179] =>  T.. zoompan          V->V       Apply Zoom & Pan effect.
    [180] =>  ... cellauto         |->V       Create pattern generated by an elementary cellular automaton.
    [181] =>  ..C color            |->V       Provide an uniformly colored input.
    [182] =>  ... haldclutsrc      |->V       Provide an identity Hald CLUT.
    [183] =>  ... life             |->V       Create life.
    [184] =>  ... mandelbrot       |->V       Render a Mandelbrot fractal.
    [185] =>  ... mptestsrc        |->V       Generate various test pattern.
    [186] =>  ... nullsrc          |->V       Null video source, return unprocessed video frames.
    [187] =>  ... rgbtestsrc       |->V       Generate RGB test pattern.
    [188] =>  ... smptebars        |->V       Generate SMPTE color bars.
    [189] =>  ... smptehdbars      |->V       Generate SMPTE HD color bars.
    [190] =>  ... testsrc          |->V       Generate test pattern.
    [191] =>  ... nullsink         V->|       Do absolutely nothing with the input video.
    [192] =>  ... avectorscope     A->V       Convert input audio to vectorscope video output.
    [193] =>  ... concat           N->N       Concatenate audio and video streams.
    [194] =>  ... showcqt          A->V       Convert input audio to a CQT (Constant Q Transform) spectrum video output.
    [195] =>  ... showspectrum     A->V       Convert input audio to a spectrum video output.
    [196] =>  ... showwaves        A->V       Convert input audio to a video output.
    [197] =>  ... amovie           |->N       Read audio from a movie source.
    [198] =>  ... movie            |->N       Read from a movie source.
    [199] =>  ... ffbuffersink     V->|       Buffer video frames, and make them available to the end of the filter graph.
    [200] =>  ... ffabuffersink    A->|       Buffer audio frames, and make them available to the end of the filter graph.
    [201] =>  ... abuffer          |->A       Buffer audio frames, and make them accessible to the filterchain.
    [202] =>  ... buffer           |->V       Buffer video frames, and make them accessible to the filterchain.
    [203] =>  ... abuffersink      A->|       Buffer audio frames, and make them available to the end of the filter graph.
    [204] =>  ... buffersink       V->|       Buffer video frames, and make them available to the end of the filter graph.
    [205] =>  ... afifo            A->A       Buffer input frames and send them when they are requested.
    [206] =>  ... fifo             V->V       Buffer input images and send them when they are requested.
)

... 显示amix(并且amerge我也一直在尝试)但没有显示complex(应该显示吗?我不知道)。

我现在不知道:

(a)我的命令是错误的

(b)ffmpeg 版本太旧,不支持复杂的滤镜

(c)服务器配置需要更改

帮助?!

相关内容