当前位置: 首页 > news >正文

境外网站搭建网站群建设公司

境外网站搭建,网站群建设公司,有没有做专利导航运营的网站,变装chinacd wordpress1、入坑第一步:首先集成的库必须正确。最好是有ndk的,FFmpeg有许多个版本,我才开始接触的时候随便选了一个,一般的 方法没有问题。但是涉及到需要使用libx264等条件进行编码时,老是报错,网上搜索资料也没有…

1、入坑第一步:首先集成的库必须正确。最好是有ndk的,FFmpeg有许多个版本,我才开始接触的时候随便选了一个,一般的 方法没有问题。但是涉及到需要使用libx264等条件进行编码时,老是报错,网上搜索资料也没有人说需要ndk的支持才行。这个问题困扰了好几天,怎么试不行,最后更换集成库才成功。

此为引入的库:com.github.yangfeng1994:FFmpeg-Android:v2.0.1

2、图片合成视频命令:

String[] ffmpegCommand = new String[]{"-y", // 覆盖输出文件"-framerate", 5, // 每5秒一帧,可根据需求调整"-i", dir+ "/img%04d.jpg", // 输入图片格式"-c:v", "libx264", // 视频编码器"-pix_fmt", "yuv420p", // 像素格式"-vf", "scale=" + downInfo.getSize(), // 视频分辨率"-threads", "1", // 线程数"-preset", "ultrafast", // 编码速度"-crf", "28", // 编码质量out.mp4// 输出视频路径
};

3、加入音频执行命令

String comman = " -i " + videopath+ " -i " + audioPath + " -c:v copy " + outPath;

4、多个视频拼接成一个视频

首先将多个视频文件路径写入file_list.txt

String fileListPath = dir + File.separator + "file_list.txt";
File file = new File(fileListPath);
String fileListContent = "file '" + input1 + "'\nfile '" + input2 + "'";
FileOutputStream outStream = new FileOutputStream(file); // 加上文件名
outStream.write(fileListContent.getBytes());
outStream.close();

执行命令:

String command = "-f concat -safe 0 -i " + fileListPath + " -c:a aac -c copy " + out.mp4;

5、给视频添加水印

String[] command = new String[]{"-i", srcFile, // 输入视频路径"-i", waterMark, // 水印图片路径"-filter_complex", "overlay=x=(W-w)/2:y=H-h*2", // 水印位置"-codec:a", "copy", // 音频编码//  "-codec:v", "copy", // 视频编码targetFile // 输出视频路径
};

视频制作就到此结束了。

以下是一些常用命令:

视频叠加成画中画
String reverseVideo = "-i %s -i %s -filter_complex overlay=%d:%d %s";reverseVideo = String.format(reverseVideo, inputFile1, inputFile2, x, y, targetFile);

 视频抽帧转成图片

String toImage = "-i %s -ss %s -t %s -r %s %s";
toImage = String.format(Locale.CHINESE, toImage, inputFile, startTime, duration, frameRate, targetFile);
toImage = toImage + "%3d.jpg";
视频降噪
String reverseVideo = "-i %s -nr 500 %s";
reverseVideo = String.format(reverseVideo, inputFile, targetFile);
视频反序倒播
String reverseVideo = "-i %s -filter_complex [0:v]reverse[v] -map [v] %s";//单纯视频反序
reverseVideo = String.format(reverseVideo, inputFile, targetFile);

多画面拼接视频

String multiVideo = "-i %s -i %s -filter_complex hstack %s";//hstack:水平拼接,默认if (videoLayout == LAYOUT_VERTICAL) {//vstack:垂直拼接multiVideo = multiVideo.replace("hstack", "vstack");
}
multiVideo = String.format(multiVideo, input1, input2, targetFile);
音频编码
String combineVideo = "-f s16le -ar %d -ac %d -i %s %s";
combineVideo = String.format(combineVideo, sampleRate, channel, srcFile, targetFile);
视频转成Gif动图
String screenShotCmd = "-i %s -ss %d -t %d -s 320x240 -f gif %s";
screenShotCmd = String.format(screenShotCmd, srcFile, startTime, duration, targetFile);
视频截图
String screenShotCmd = "-i %s -f image2 -t 0.001 -s %s %s";
screenShotCmd = String.format(screenShotCmd, srcFile, size, targetFile);
视频剪切
String cutVideoCmd = "-ss %s -t %s -i %s -c:v libx264 -c:a aac -strict experimental -b:a 98k %s";
cutVideoCmd = String.format(cutVideoCmd, startTime, endTime, srcFile, targetFile);
视频转码
String transformVideoCmd = "-i %s -vcodec copy -acodec copy %s";
transformVideoCmd = String.format(transformVideoCmd, srcFile, targetFile);
抽取视频
String mixAudioCmd = "-i %s -vcodec copy -an %s";
mixAudioCmd = String.format(mixAudioCmd, srcFile, targetFile);
抽取音频
String mixAudioCmd = "-i %s -acodec copy -vn %s";
mixAudioCmd = String.format(mixAudioCmd, srcFile, targetFile);
音频混合
String mixAudioCmd = "-i %s -i %s -filter_complex amix=inputs=2:duration=first -strict -2 %s";
mixAudioCmd = String.format(mixAudioCmd, srcFile, mixFile, targetFile);
音频合并
String concatAudioCmd = "-i concat:%s|%s -acodec copy %s";
concatAudioCmd = String.format(concatAudioCmd, srcFile, appendFile, targetFile);
音频剪切
String cutAudioCmd = "-i %s -ss %d -t %d %s";
cutAudioCmd = String.format(cutAudioCmd, srcFile, startTime, duration, targetFile);
音频转码
String transformAudioCmd = "-i %s %s";
transformAudioCmd = String.format(transformAudioCmd, srcFile, targetFile);

注意踩坑:1、如果需要使用libx264等硬件编码,一定需要引入支持ndk的依赖库。

                  2、图片合成视频过程中,发现部分图片无法合成视频或者合成视频报错,这也是一处坑,当我的图片的分辨率是830x1080,在将图片动画合成视频时,始终报错,最后经过各种尝试得出一下结论。请检查图片的分辨率是否符合1:1,3:4,4:3,16:9,9:16等比例,如果不是常用的分辨率就会报错。

经过一个多月的研究,FFmpeg已经应用比较熟悉了,如果大家有什么问题或者发现我的方法没有用可以和我交流。大家一起学习一起进步

 

http://www.yayakq.cn/news/609056/

相关文章:

  • 浙江省工程建设监理管理协会网站科协网站建设的意见
  • 阿里云怎么部署网站北滘网站设计
  • 禹城网站制作wordpress美化文章内相册
  • dedecms做电商网站汽油价格网
  • 建设银行社保卡查询网站如何在阿里云云服务器上搭建网站
  • 网站首页设计有限公司免费自助在线公司起名
  • 什么是网站跳出率wordpress分类目录添加报错_标签不能添加
  • gta5手机网站大全阿里云1m 宽带做网站服务器
  • a做爰视频免费网站国外著名网站建设公司
  • 品牌vi设计设计生成佛山网站搜索优化
  • 自建网站成都企业网站建设合同应注意什么
  • 如何购买域名建网站江西省农村公路建设举报网站
  • 3d标签 wordpressseo入门讲解
  • 辽宁省品牌建设促进会网站asp做网站 的pdf教程
  • 站内推广的方式有哪些东莞公司官网建站
  • 网站被k怎么西安建设厅网站首页
  • 上海cms网站建设手机端原神
  • wordpress woocommerce西宁网站seo
  • 网站制作开发平台企业网络营销成功案例
  • 论网站建设的重要性网站建设的ci设计指的是什么
  • 网站排名稳定后后期如何优化新网站如何做排在前面
  • 高考志愿网站开发网站建设免费制作
  • 两学一做微网站交流南昌网站建设公司资讯
  • 开通网站的会计科目怎么做怎么重新装电脑的wordpress
  • 四川信德建设有限公司网站克隆网站怎么导入wordpress
  • 专门做衣服的网站快速提高网站排名
  • 找考卷做要去哪个网站北京软件开发公司哪家专业
  • 贵州网站推广襄阳网站seo厂家
  • 智冠宝企业网站管理系统优秀网页设计网站
  • 差旅网站建设个人做外贸网站平台有哪些