2016-01-18 270 views
2

我想一個MOV與Alpha透明度轉換爲WEBM與Alpha透明度,如圖here。我按照here解釋的步驟無濟於事。轉換MOV與阿爾法VP9的WebM使用Alpha使用的ffmpeg

this answer我能夠刪除視頻中的所有黑色,從而使之透明,但是這不是我所需要的,因爲我已經有一個透明MOV,並想將其轉換成透明WEBM格式。

ffmpeg -i input.mp4 -c:v libvpx -vf "colorkey=0x000000:0.1:0.1,format=yuva420p" out.webm 

這是視頻的ffprobe輸出我想轉換與透明度的WebM。

built with Apple LLVM version 7.0.2 (clang-700.1.81) 
    configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda 
    libavutil  54. 31.100/54. 31.100 
    libavcodec  56. 60.100/56. 60.100 
    libavformat 56. 40.101/56. 40.101 
    libavdevice 56. 4.100/56. 4.100 
    libavfilter  5. 40.101/5. 40.101 
    libavresample 2. 1. 0/2. 1. 0 
    libswscale  3. 1.101/3. 1.101 
    libswresample 1. 2.101/1. 2.101 
    libpostproc 53. 3.100/53. 3.100 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov': 
    Metadata: 
    major_brand  : qt 
    minor_version : 0 
    compatible_brands: qt 
    creation_time : 2016-01-17 16:04:07 
    encoder   : Mac OS X v? (AVF 1046.9.1, CM 1731.15.20, x86_64) 
    encoder-eng  : Mac OS X v? (AVF 1046.9.1, CM 1731.15.20, x86_64) 
    Duration: 00:00:06.63, start: 0.000000, bitrate: 63966 kb/s 
    Stream #0:0(eng): Video: prores (ap4h/0x68347061), yuva444p10le(bt470bg/smpte240m/bt709), 1920x1080, 63963 kb/s, 25.03 fps, 25 tbr, 600 tbn, 600 tbc (default) 
    Metadata: 
     creation_time : 2016-01-17 16:04:07 
     handler_name : Core Media Data Handler 
     encoder   : Apple ProRes 4444 

我也試過下面的命令,這對我也不起作用。

ffmpeg -y -i input.mov -c:v libvpx-vp9 -b:v 2000k -pass 1 -an -f webm output.webm 

我在Mac上使用ffmpeg的2.8.4版本,安裝了brew。 2.8.5是最新版本。

回答

5

嘗試

ffmpeg -i input.mov -c:v libvpx -pix_fmt yuva420p out.webm 
+0

我該如何設置一個比特率呢? – Enijar

+1

爲2mbps的平均速率添加'-b:v 2000k'。 – Mulvya

2

WebM-alpha僅針對VP8定義。目前它對於VP9根本不起作用。

+1

又一個鏈接https://github.com/fnordware/AdobeWebM/issues/17 – user2683246

6

由於2016-07-13,有可能以編碼VP9/WEBM alpha通道(VP9a)視頻。但是,您在此處使用的命令將創建一個視頻。假設您在該日期之後編譯了ffmpeg,則只需將libvpx更改爲libvpx-vp9即可。您不需要yuva420p轉換(默認選擇)。