我已经在我的Android Studio上编译了https://github.com/WritingMinds/ffmpeg-android-java,它运行正常,我已经成功执行了这3个命令:
添加文字:
new String[]={"-i",file1.toString(), "-i", water,"-filter_complex","drawtext=fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=AAAA:x=(w-tw)/2:y=(50-th)/2", final_output}
添加水印:
new String[]{"-i",inputVideoFilePath, "-i",overlayImagePath,"-preset", "ultrafast","-filter_complex", "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2", "-codec:a", "copy", outputVideoFilePath
添加填充:
new String[]{"-i",file1.toString(), "-i", water,"-filter_complex","[0:v]pad=iw:ih+100:0:(oh-ih)/2:color=white", final_output2};
现在我想结合这三个我如何实现这一目标?到目前为止,我已尝试使用文本填充:
new String[]{"-i",file1.toString(), "-i", water,"-filter_complex","[0:v]pad=iw:ih+100:0:(oh-ih)/2:color=white","drawtext=fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=AAAA:x=(w-tw)/2:y=(50-th)/2", final_output2};
但是我收到了这个错误:
Input #1, png_pipe, from '/storage/emulated/0/watermark.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgb24(pc), 200x125, 25 tbr, 25 tbn, 25 tbc
[NULL @ 0xb5c9fc00] Unable to find a suitable output format for
'drawtext=fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text AAAA:x=(w-tw)/2:y=(50-th)/2'
drawtext=fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=AAAA:x=(w-tw)/2:y=(50-th)/2: Invalid argument
任何形式的帮助都会很棒!
答案 0 :(得分:0)
您可以使用以下命令添加文本,水印和填充: -
" -i "+VideoPathonSdCard+" -i "+ImagePath+" -metadata:s:v rotate=0 -filter_complex vflip,transpose=0,overlay=(W-w)/2:(H-h)/2,pad=iw:ih+100:0:(oh-ih)/2:color=white,drawtext=fontsize="+TextSize+":fontfile=/system/fonts/DroidSans.ttf:fontcolor="+hexColor+":text="+ Text+":x="+x+":y="+y+"+40 -y -preset ultrafast -strict -2 "+VideoAfterEdit_Path;
答案 1 :(得分:0)
我能够自己解决这个问题,因为人们想知道同样的问题,因为这是一个复杂的问题,这里有:
def youtube_search(q, max_results): # old version: def youtube_search(options):
youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,
developerKey=DEVELOPER_KEY)
# Call the search.list method to retrieve results matching the specified
# query term.
search_response = youtube.search().list(
q=q, # old version: q=options.q,
part="id,snippet",
maxResults=max_results # old version: maxResults=options.max_results
).execute()