2016-09-20 43 views
3

半透明のh264ビデオにpng透かし(アルファチャンネル付き)を追加しようとしています。オーバーレイフィルタを使用することで、ビデオにウォーターマークを追加することができました。ffmpeg異なるサイズの半透明ウォーターマーク(png)を追加

ffmpeg -y -i input.mp4 -i watermark.png -filter_complex "[0][1] overlay=0:0" -c:v libx264 -an output.mp4 

ただし、オーバーレイフィルタは透過オプションを提供しません。だから私はブレンドフィルターを使用しようとしました。ただし、原点解像度を使用すると、エラーメッセージが表示されます。

ffmpeg -y -i input.mp4 -i watermark.png -filter_complex "[0][1]blend=all_mode=overlay:all_opacity=0.3" -c:v libx264 -an output.mp4 

出力:

libavutil  55. 28.100/55. 28.100 
    libavcodec  57. 48.101/57. 48.101 
    libavformat 57. 41.100/57. 41.100 
    libavdevice 57. 0.101/57. 0.101 
    libavfilter  6. 47.100/6. 47.100 
    libavresample 3. 0. 0/3. 0. 0 
    libswscale  4. 1.100/4. 1.100 
    libswresample 2. 1.100/2. 1.100 
    libpostproc 54. 0.100/54. 0.100 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': 
    Metadata: 
    major_brand  : isom 
    minor_version : 512 
    compatible_brands: isomiso2avc1mp41 
    encoder   : Lavf57.41.100 
    Duration: 00:00:45.08, start: 0.000000, bitrate: 1872 kb/s 
    Stream #0:0(und): Video: h264 (Baseline) (avc1/0x31637661), yuv420p, 1920x1080, 1869 kb/s, 29.72 fps, 30 tbr, 16k tbn, 32k tbc (default) 
    Metadata: 
     handler_name : VideoHandler 
Input #1, png_pipe, from 'watermark.png': 
    Duration: N/A, bitrate: N/A 
    Stream #1:0: Video: png, rgba(pc), 64x64, 25 tbr, 25 tbn, 25 tbc 
[Parsed_blend_0 @ 00750600] First input link top parameters (size 1920x1080, SAR 0:1) do not match the corresponding second input link bottom parameters (64x64, SAR 0:1) 
[Parsed_blend_0 @ 00750600] Failed to configure output pad on Parsed_blend_0 
Error configuring complex filters. 
Invalid argument 

結果は、パラメータを使用して、いくつかの解決の問題のように見えます。そこで、ブレンドする前にウォーターマークを拡大しようとしました。

ffmpeg -y -i input.mp4 -i watermark.png -filter_complex "[0:0]scale=1920x1080[a]; [1:0]scale=1920x1080[b]; [a][b]blend=all_mode=overlay:all_opacity=0.3" -c:v libx264 -an output.mp4 

FFMPEGはこれらのパラメータで動作します。しかし、ウォーターマークが引き伸ばされていたため、出力は期待していなかった。 透過性のあるビデオに伸びずに、異なる解像度の透かしを混ぜることはできますか?

ここにテストファイルがあります。 (ffmpegのバージョン3.1.2) https://drive.google.com/open?id=0B2X3VLS01TogdHVJZ2I1ZC1GUUU https://drive.google.com/open?id=0B2X3VLS01TogbjhuZTlBOFFpN1k

+0

前に、LUTフィルタを使用して、私はちょうど.PNGを編集し、50%に減少不透明度、それを.pngとして再保存して使用しました。うまくいった –

答えて

3

は私のオーバーレイ、透かしの不透明度を減らすために、他の人のためにオーバーレイ

ffmpeg -y -i input.mp4 -i watermark.png -filter_complex 
      "[1]lut=a=val*0.3[a];[0][a]overlay=0:0" 
     -c:v libx264 -an output.mp4 
+0

ありがとうございました。これは本当に私を助けます。 – Archer

関連する問題