2013-11-01 49 views
3

首先,我是FFMPEG的初學者,請耐心等待。在ffmpeg監護人項目中使用覆蓋視頻過濾器(android)

進出口使用this庫,併成功地將音頻和視頻:d

但是,我一直未能當我試圖在視頻中插入圖像/水印。

這是使用代碼IM:

public MediaDesc combineVideoAndImage (MediaDesc videoIn, MediaDesc image, MediaDesc out, ShellCallback sc) throws Exception 
    { 
     ArrayList<String> cmd = new ArrayList<String>(); 

     cmd.add(ffmpegBin); 
     cmd.add("-i"); 
     cmd.add(new File(videoIn.path).getCanonicalPath()); 

     cmd.add("-vf"); 
     cmd.add("movie=" + new File(image.path).getAbsolutePath() + " [logo];[in][logo] overlay=10:10 [out]"); 

     cmd.add("-strict"); 
     cmd.add("-2"); 

     File fileOut = new File(out.path); 
     cmd.add(fileOut.getCanonicalPath()); 

     execFFMPEG(cmd, sc); 

     return out; 
    } 

這些代碼會產生這種CMD:

ffmpeg -i VIDEONAME.mp4 -vf "movie=LOGONAME.png [logo];[in][logo] overlay=10:10 [out]" 
-strict -2 OUTPUTNAME.MP4 

我已經測試了這個CMD在Ubuntu 13.10 64位,並安裝最新的FFMPEG和T成功。

但它不在我的android項目。它沒有捕捉/拋出任何錯誤/異常,程序正常運行,並且文件被創建但沒有任何內容(0字節)

任何幫助表示讚賞。感謝您的幫助:d

+0

up up up up up up :) –

+0

什麼ubuntu版本ffmpeg工作?注意:https://github.com/guardianproject/android-ffmpeg/tree/53fc9d4e2972792236d9e4c4c5793322947a884e監護人的外部鏈接將帶您到Android項目使用的提交版本。它的ffmpeg 0.11已經有幾年了,不會和你在ubuntu上使用的版本一樣。 –

+0

@RobertRowntree我曾嘗試使用我自己的二進制文件,這是最新版本,但仍然沒有運氣:( –

回答

0

嘗試用下面的命令

ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=10:10" -codec:a copy output.mp4 

我已經測試了Android和它的工作完美。