我正在使用cordova-plugin-video-editor库的一个分支:
https://github.com/jbavari/cordova-plugin-video-editor/pull/13
它在这里使用android-ffmpeg-java库:
File tempFile = File.createTempFile("ffmpeg", null, appContext.getCacheDir());
FfmpegController ffmpegController = new FfmpegController(appContext, tempFile);
TranscodeCallback tcCallback = new TranscodeCallback();
Clip clipIn = new Clip(videoSrcPath);
Clip clipOut = new Clip(outputFilePath);
clipOut.videoCodec = "libx264";
clipOut.videoFps = "24"; // tailor this to your needs
clipOut.videoBitrate = 512; // 512 kbps - tailor this to your needs
clipOut.audioChannels = 1;
clipOut.width = outputWidth;
clipOut.height = outputHeight;
clipOut.duration = videoDuration;
ffmpegController.processVideo(clipIn, clipOut, true, tcCallback);
这里有一个多文件concat测试示例:
https://github.com/guardianproject/android-ffmpeg-java/blob/master/src/org/ffmpeg/android/test/concattest.java#l16
因此,我修改了cordova插件代码以匹配示例:
ArrayList<Clip> listVideos = new ArrayList<Clip>();
Clip clip = new Clip();
clip.path = new File(videoSrcPath).getCanonicalPath();
ffmpegController.getInfo(clip);
clip.duration = 5;
listVideos.add(clip);
Clip clip2 = new Clip();
clip2.path = new File(videoSrcPath2).getCanonicalPath();
ffmpegController.getInfo(clip2);
clip2.duration = 5;
listVideos.add(clip2);
Clip clipOut = new Clip();
clipOut.path = new File(outputFilePath).getCanonicalPath();
ffmpegController.concatAndTrimFilesMP4Stream(listVideos, clipOut, false, false, new ShellUtils.ShellCallback() {
@Override
public void shellOut(String shellLine) {
System.out.println("fc>" + shellLine);
}
@Override
public void processComplete(int exitValue) {
if (exitValue < 0)
System.err.println("concat non-zero exit: " + exitValue);
}
});
23:15:08.498 3218-3293/com.example.hello D/VideoEditor﹕ execute method starting
07-10 23:15:08.498 3218-3293/com.example.hello D/VideoEditor﹕ transcodeVideo firing
07-10 23:15:08.499 3218-3293/com.example.hello D/VideoEditor﹕ options: {"fileUri":"content:\/\/com.android.providers.media.documents\/document\/video%3A23389","fileUri2":"content:\/\/com.android.providers.media.documents\/document\/video%3A23390","outputFileName":"1436584506888","quality":2,"outputFileType":1,"optimizeForNetworkUse":1,"duration":2}
07-10 23:15:08.615 3218-3293/com.example.hello D/VideoEditor﹕ videoSrcPath: /storage/emulated/0/Movies/-a.mp4
07-10 23:15:08.615 3218-3293/com.example.hello D/VideoEditor﹕ videoSrcPath2: /storage/emulated/0/Movies/-b.mp4
07-10 23:15:08.618 3218-3293/com.example.hello V/VideoEditor﹕ outputFilePath: /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
07-10 23:15:08.618 3218-3293/com.example.hello W/PluginManager﹕ THREAD WARNING: exec() call to VideoEditor.transcodeVideo blocked the main thread for 121ms. Plugin should use CordovaInterface.getThreadPool().
07-10 23:15:09.126 3742-3742/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.506 3750-3750/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.836 3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -t 0 0 : 0 0 : 5.000000 -i /storage/emulated/0/Movies/-a.mp4 -f mpegts -c copy -an -bsf:v h264_mp4toannexb /storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts
07-10 23:15:09.864 3758-3758/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.865 3218-3759/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.869 3218-3759/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavutil 51. 54.100 / 51. 54.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavcodec 54. 23.100 / 54. 23.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavformat 54. 6.100 / 54. 6.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavdevice 54. 0.100 / 54. 0.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavfilter 2. 77.100 / 2. 77.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libswscale 2. 1.100 / 2. 1.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libswresample 0. 15.100 / 0. 15.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libpostproc 52. 0.100 / 52. 0.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc>[NULL @ 0xb6421100] Unable to find a suitable output format for '0'
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc>0: Invalid argument
07-10 23:15:09.891 3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -t 0 0 : 0 0 : 5.000000 -i /storage/emulated/0/Movies/-b.mp4 -f mpegts -c copy -an -bsf:v h264_mp4toannexb /storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts
07-10 23:15:09.912 3762-3762/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.913 3218-3763/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.917 3218-3763/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
07-10 23:15:09.917 3218-3763/com.example.hello I/System.out﹕ fc> built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavutil 51. 54.100 / 51. 54.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavcodec 54. 23.100 / 54. 23.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavformat 54. 6.100 / 54. 6.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavdevice 54. 0.100 / 54. 0.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavfilter 2. 77.100 / 2. 77.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libswscale 2. 1.100 / 2. 1.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libswresample 0. 15.100 / 0. 15.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libpostproc 52. 0.100 / 52. 0.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc>[NULL @ 0xb6321100] Unable to find a suitable output format for '0'
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc>0: Invalid argument
07-10 23:15:09.940 3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -i concat:/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts|/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts -c copy -an /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
07-10 23:15:09.963 3766-3766/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.964 3218-3767/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.971 3218-3767/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
07-10 23:15:09.972 3218-3767/com.example.hello I/System.out﹕ fc> built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
07-10 23:15:09.972 3218-3767/com.example.hello I/System.out﹕ fc> configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
07-10 23:15:09.973 3218-3767/com.example.hello I/System.out﹕ fc> libavutil 51. 54.100 / 51. 54.100
07-10 23:15:09.973 3218-3767/com.example.hello I/System.out﹕ fc> libavcodec 54. 23.100 / 54. 23.100
07-10 23:15:09.974 3218-3767/com.example.hello I/System.out﹕ fc> libavformat 54. 6.100 / 54. 6.100
07-10 23:15:09.974 3218-3767/com.example.hello I/System.out﹕ fc> libavdevice 54. 0.100 / 54. 0.100
07-10 23:15:09.974 3218-3767/com.example.hello I/System.out﹕ fc> libavfilter 2. 77.100 / 2. 77.100
07-10 23:15:09.975 3218-3767/com.example.hello I/System.out﹕ fc> libswscale 2. 1.100 / 2. 1.100
07-10 23:15:09.976 3218-3767/com.example.hello I/System.out﹕ fc> libswresample 0. 15.100 / 0. 15.100
07-10 23:15:09.976 3218-3767/com.example.hello I/System.out﹕ fc> libpostproc 52. 0.100 / 52. 0.100
07-10 23:15:09.976 3218-3767/com.example.hello I/System.out﹕ fc>concat:/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts|/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts: Not a directory
07-10 23:15:09.981 3218-3264/com.example.hello D/VideoEditor﹕ transcode exception
java.lang.Exception: There was a problem rendering the video: /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
at org.ffmpeg.android.FfmpegController.concatAndTrimFilesMP4Stream(FfmpegController.java:1272)
at org.apache.cordova.videoeditor.VideoEditor$1.run(VideoEditor.java:257)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
我不知道为什么上面写着“不是目录”?它肯定是有效的,因为文件是在前一步创建的?
好的,我有一个使用以下代码的工作版本:
videoeditor.java第10行
import java.util.ArrayList;
videoeditor.java第22行
import org.ffmpeg.android.ShellUtils;
// intro
final File inFile = this.resolveLocalFileSystemURI(options.getString("fileUri"));
if (!inFile.exists()) {
Log.d(TAG, "input file does not exist");
callback.error("input video does not exist.");
return;
}
// recording
final File inFile2 = this.resolveLocalFileSystemURI(options.getString("fileUri2"));
if (!inFile2.exists()) {
Log.d(TAG, "input file2 does not exist");
callback.error("input video2 does not exist.");
return;
}
// outro
final File inFile3 = this.resolveLocalFileSystemURI(options.getString("fileUri3"));
if (!inFile3.exists()) {
Log.d(TAG, "input file3 does not exist");
callback.error("input video3 does not exist.");
return;
}
// overlay
final File inFile4 = this.resolveLocalFileSystemURI(options.getString("fileUri4"));
if (!inFile4.exists()) {
Log.d(TAG, "input file4 does not exist");
callback.error("input video4 does not exist.");
return;
}
final String videoSrcPath = inFile.getAbsolutePath();
final String videoSrcPath2 = inFile2.getAbsolutePath();
final String videoSrcPath3 = inFile3.getAbsolutePath();
final String videoSrcPath4 = inFile4.getAbsolutePath();
FfmpegController ffmpegController = new FfmpegController(appContext, appContext.getCacheDir());
TranscodeCallback tcCallback = new TranscodeCallback();
ArrayList<Clip> listVideos = new ArrayList<Clip>();
Clip clip = new Clip();
clip.path = new File(videoSrcPath).getCanonicalPath();
ffmpegController.getInfo(clip);
clip.duration = 5;
listVideos.add(clip);
Clip clip2 = new Clip();
clip2.path = new File(videoSrcPath2).getCanonicalPath();
ffmpegController.getInfo(clip2);
clip2.duration = 5;
listVideos.add(clip2);
Clip clip3 = new Clip();
clip3.path = new File(videoSrcPath3).getCanonicalPath();
ffmpegController.getInfo(clip3);
clip3.duration = 5;
listVideos.add(clip3);
Clip clipOut = new Clip();
clipOut.path = new File(outputFilePath).getCanonicalPath();
ffmpegController.concatAndTrimFilesMP4Stream(listVideos, clipOut, false, false, new ShellUtils.ShellCallback() {
@Override
public void shellOut(String shellLine) {
System.out.println("fc>" + shellLine);
}
@Override
public void processComplete(int exitValue) {
if (exitValue < 0)
System.err.println("concat non-zero exit: " + exitValue);
}
});
/*
double dValue = mediaIn.duration;
int hours = (int)(dValue/3600f);
dValue -= (hours*3600);
cmd.add("0");
cmd.add(String.format(Locale.US,"%s",hours));
cmd.add(":");
int min = (int)(dValue/60f);
dValue -= (min*60);
cmd.add("0");
cmd.add(String.format(Locale.US,"%s",min));
cmd.add(":");
cmd.add(String.format(Locale.US,"%f",dValue));
*/
cmd.add(Double.toString(mediaIn.duration));
我用的是Android Studio 1.2 我创建了一个私人库,希望在另一个应用程序中使用该库。 为了使用它,我创建了一个AAR文件,但这个AAR不起作用。我的库中有一个AAR文件的依赖项。 谢了。
egg 多文件上传 >[danger] 如果要获取同时上传的多个文件,不能通过ctx.getFileStream()来获取 > 需要通过 ctx.multipart({ autoFields:true }) 获取 > autoFields: true 表示获取除了文件字段以外的其他信息字段 用户可以通过在config/config.default.js中配置来新增支持的文件扩展名,或者重写整个白名
多文件配置 自版本4.23.0起,v2ray程序支持使用多个配置文件。 多配置文件的主要作用在于分散不同作用模块配置,便于管理和维护。该功能主要考虑是为了丰富v2ray生态链,比如对于GUI的客户端,一般只实现节点选择等固定的功能,对于太复杂的配置难以图形化实现;只需留一个confdir的自定义配置目录供配置复杂的功能;对于服务器的部署脚本,只需往confdir添加文件即可实现配置多种协议...等
我正在尝试使用@Controller和@Request estMap使用Spring 3.1.2上传多个文件。 下面是我做的和我的配置。 格式 : 控制器方法: 我的会议: 提交表单确实会转到添加文件系统映像方法。locId 参数的数据位于此处,但“文件”参数未绑定。无论我尝试过什么参数/字段名称/参数类型的组合,它都是系统性的空值。 HttpServletRequest参数是一个org.spri
问题内容: 我正在使用标准的join命令来连接基于column1的两个排序文件。命令是简单的连接文件1文件2>输出文件。 但是,如何使用相同的技术加入3个或更多文件?join file1 file2 file3> output_file上面的命令给了我一个空文件。我认为sed可以帮助我,但我不太确定该怎么做? 问题答案: : 它仅适用于 两个 文件。 如果您需要加入三个,也许您可以先加入前两个
嗨,我正在尝试使用多部分表单上传多个文件 我使用这个,但我得到了错误的请求状态,我如何上传多个文件?
多重文件接口(MDI)是Microsoft Windows文件处理应用程序的一种规范,该规范描述了窗口结构和允许使用者在单个应用程序中使用多个文件的使用者接口(如文书处理程序中的文字文件和电子表格程序中的电子表格)。简单地说,就像Windows在一个屏幕上维护多个应用程序窗口一样,MDI应用程序在一个显示区域内维护多个文件窗口。Windows中的第一个MDI应用程序是Windows下的Micros
本文向大家介绍java 文件上传(单文件与多文件),包括了java 文件上传(单文件与多文件)的使用技巧和注意事项,需要的朋友参考一下 java 文件上传(单文件与多文件) 一、简述 一个javaWeb项目中,文件上传功能几乎是必不可少的,本人在项目开发中也时常会遇到,以前也没怎么去理它,今天有空学习了一下这方面的知识,于是便将本人学到的SpringMVC中单文件与多文件上传这部分知识做下笔记。