在Android中如何使用ffmpeg在已录制的视频上添加水印文字?

时间:2016-07-22 12:28:47

标签: android video ffmpeg watermark drawtext

我正在尝试将文字设置为已录制视频的水印,但它无效。当我尝试将image.png作为水印时,按照此网址http://androidwarzone.blogspot.in/2011/12/ffmpeg4android.html

进行操作

在已录制视频上将图像应用为水印的命令:

String[] complexCommand = {"ffmpeg","-y" ,"-i", videoPathHere,"-strict",
"experimental", "-vf", "movie=" 
+ Environment.getExternalStorageDirectory().getAbsolutePath() 
+ "/watermarkImg.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]",
"-s", "160x120","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", 
"-ac", "2", "-ar", "22050", 
Environment.getExternalStorageDirectory().getAbsolutePath()+"/watermark.mp4"}; 

但是当我尝试将文本作为水印实现时,它无效:

String[] complexCommand = {"ffmpeg", "-y" , "-i", videoPathHere, "-strict", "experimental", 
"-vf", "drawtext=fontfile=" + file + ":text=TestText", "-s", "160x120", "-r", "30", 
"-b", "15496k", "-vcodec", "mpeg4", "-ab", "48000", "-ac", "2", "-ar", "22050", 
Environment.getExternalStorageDirectory().getAbsolutePath()+"/watermark.mp4"}; 

即使我也试过这个 https://video.stackexchange.com/questions/15551/ffmpeg-drawtext-filter-create-transparent-background-with-text

但它在我的情况下也不起作用。

那么,将文本添加为​​水印会出现什么问题?

我在commenad中进行了更改; text = TestText到:text = TestText然后显示给定的错误。

07-23 10:58:07.595:I / Videokit(28832):libvideokit.so已加载 07-23 10:58:07.595:I / Videokit(28832):args不是NULL 07-23 10:58:07.595:I / Videokit(28832):超过一个arg 07-23 10:58:07.595:I / Videokit(28832):找到功能符号 07-23 10:58:07.595:D / Videokit(28832):通过装载机调用视频 07-23 10:58:07.595:I / Videokit(28832):vk ffmpeg sdcardPath:/data/user/0/valamovie.com/files/ 07-23 10:58:07.595:D / Videokit(28832):致电licenseCheckComplex 07-23 10:58:07.595:I / Videokit(28832):licenseCheck in path:/data/user/0/valamovie.com/files/ 07-23 10:58:07.595:I / Videokit(28832):isLicExistsComplex ... 07-23 10:58:07.595:I / Videokit(28832):尝试打开/data/user/0/valamovie.com/files//ffmpeglicense.lic 07-23 10:58:07.595:I / Videokit(28832):找到许可证文件... 07-23 10:58:07.596:I / Videokit(28832):您在15个试用日中使用了0个。 07-23 10:58:07.596:D / Videokit(28832):许可证检查rc:0 07-23 10:58:07.596:D / Videokit(28832):run()调用 07-23 10:58:07.670:A / libc(28832):致命信号11(SIGSEGV),代码1,故障地址0x10 in tid 28832(valamovie.com) 07-23 10:58:07.771:A / DEBUG(152): * < / strong> < em> * 07-23 10:58:07.771:A / DEBUG(152):构建指纹:&#39; Lava / PixelV1 / PixelV1_sprout:6.0 / MRA58V / eng.admin.20160419.120644:user / release-keys&#39; 07-23 10:58:07.771:A / DEBUG(152):修订:&#39; 0&#39; 07-23 10:58:07.771:A / DEBUG(152):ABI:&#39; arm&#39; 07-23 10:58:07.771:A / DEBUG(152):pid:28832,tid:28832,name:valamovie.com&gt;&gt;&gt; valamovie.com&lt;&lt;&lt; 07-23 10:58:07.772:A / DEBUG(152):信号11(SIGSEGV),代码1(SEGV_MAPERR),故障地址0x10 07-23 10:58:07.789:A / DEBUG(152):r0 00000000 r1 00000001 r2 0000001e r3 00000000 07-23 10:58:07.789:A / DEBUG(152):r4 b8ae87c0 r5 b8ae7fb0 r6 00000000 r7 b8b22500 07-23 10:58:07.789:A / DEBUG(152):r8 9ee64cc4 r9 b8a1fad0 sl b8b625d0 fp 00000000 07-23 10:58:07.789:A / DEBUG(152):ip b6d875dc sp bea3e340 lr 9e3969ac pc 9e395bb8 cpsr 600f0010 07-23 10:58:07.791:A / DEBUG(152):回溯: 07-23 10:58:07.791:A / DEBUG(152):#00 pc 0007cbb8 /data/app/valamovie.com-1/lib/arm/libvideokit.so 07-23 10:58:08.503:W / ActivityManager(557):强制完成活动valamovie.com/.Ui.addNewProject 07-23 10:58:08.504:A / DEBUG(152):墓碑写到:/ data / tombstones / tombstone_00 07-23 10:58:08.504:E / DEBUG(152):AM写入失败:管道损坏 07-23 10:58:08.505:I / BootReceiver(557):将/ data / tombstones / tombstone_00复制到DropBox(SYSTEM_TOMBSTONE) 07-23 10:58:08.527:W / InputDispatcher(557):channel&#39; 86e38ae valamovie.com/valamovie.com.Ui.MainActivity(server)&#39; 〜消费者关闭输入通道或发生错误。事件= 0x9 07-23 10:58:08.528:E / InputDispatcher(557):channel&#39; 86e38ae valamovie.com/valamovie.com.Ui.MainActivity(server)&#39; 〜频道不可挽回地被打破,将被处置! 07-23 10:58:08.529:W / InputDispatcher(557):channel&#39; e50713f valamovie.com/valamovie.com.Ui.addNewProject(server)&#39; 〜消费者关闭输入通道或发生错误。事件= 0x9 07-23 10:58:08.529:E / InputDispatcher(557):channel&#39; e50713f valamovie.com/valamovie.com.Ui.addNewProject(server)&#39; 〜频道不可挽回地被打破,将被处置! 07-23 10:58:08.531:W / ActivityManager(557):暂停期间抛出异常

1 个答案:

答案 0 :(得分:0)

这个 - ";text=TestText"应为":text=TestText"