使用halfninja ffmpeg的Andr​​oid中并置的MP4文件 [英] Concatenate mp4 files in Android using halfninja ffmpeg

查看:308
本文介绍了使用halfninja ffmpeg的Andr​​oid中并置的MP4文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法编译 halfninja ffmpeg的脚本了解采用Android NDK NDK版本R5C。 (不幸的是任何试图编译与早期的NDK产生了一些错误),也我不是很懂行对整个NDK的过程中,所以这是一个有点打正想念我。

他的脚本编译的ffmpeg版本N-30996-gf925b24(具体承诺他做的脚本)

展望未来,以我的实际应用程序。 我设法修剪影片没有问题,现在我需要加入/将它们连接起来,但任何学尝试在使用这些3个环节中的命令的任何和几种组合(的链接1 链接2 ,<一个href="http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files">link3)产生的错误,例如猫是无效&gt;的undefinined 未知的选项filter_complex 或试图覆盖某些输入文件。

有谁知道这是可能的,(该怎么做),加入/串连MP4视频(所有相同的codeC,大小,质量等),使用的ffmpeg对Android或半忍者编译如何编译/采用最新的源$ C ​​$ CS获得的ffmpeg为Android?

我也给了一个快速的尝试在 mp4Parser 但没有成功。

最后,我试图让这个伪方式工作:

 公共静态文件串连(串[] inputPaths,字符串outputPath){

    // ...做的东西都产生ffmpeg的命令....
    VideoKit V =新VideoKit();
    v.run(CMDS);

    文件F =新的文件(outputPath);
    返回F;
}
 

解决方案

由LordNeckbeard提供的答案是真的要走的路。

如何连接FLV文件转换成一个?

你限制工作

  • 没有 -f CONCAT
  • 没有 -c
  • 没有 -bsf

的ffmpeg -i q.mp4 -v codeC副本-a codeC副本-vbsf h264_mp4toannexb Q值。 TS 的ffmpeg -i r.mp4 -v codeC副本-a codeC副本-vbsf h264_mp4toannexb r.ts 的ffmpeg -iCONCAT:q.ts | r.ts'-v codeC副本-a codeC副本-absf aac_adtstoasc qr.mp4

加入H264 *不*重编码

I've manage to compile halfninja ffmpeg scripts for Android NDK using NDK version r5c. (Unfortunately any attempt to compile with earlier NDK generated some error), also I'm not very knowledgeable on the whole NDK process, so it's a bit hit-n-miss for me.

His scripts are compiling ffmpeg version N-30996-gf925b24 (the specific commit he did the scripts for)

Moving forward to my actual app. I manage to trim videos without problems, now I need to join/concatenate them but any attemp at using any and several combinations of the commands found on those 3 links (link1, link2, link3) generate errors such as cat is not valid, > is undefinined, unknown option filter_complex or trying to override some of the input files.

Does anyone know if it's possible and (how to do it), to join/concatenate mp4 videos (all same codec, size, quality, etc) using half-ninja compile of ffmpeg on Android, or how to compile/get a ffmpeg for Android using latest source codes?

I've also gave a quick try on the mp4Parser without much success.

ultimately I was trying to get this pseudo-method to work:

public static File concatenate(String[] inputPaths, String outputPath){

    // ... do stuff do generate ffmpeg commands....
    VideoKit v = new VideoKit();
    v.run(cmds);

    File f = new File(outputPath);
    return f;
}

解决方案

The answer provided by LordNeckbeard is really the way to go.

How to concatenate flv file into one?

Working with your restrictions

  • no -f concat
  • no -c
  • no -bsf

ffmpeg -i q.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb q.ts
ffmpeg -i r.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb r.ts
ffmpeg -i 'concat:q.ts|r.ts' -vcodec copy -acodec copy -absf aac_adtstoasc qr.mp4

Joining H264 *without* re-encoding

这篇关于使用halfninja ffmpeg的Andr​​oid中并置的MP4文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆