导入在Eclipse项目的一部分 [英] Importing a part of a project in Eclipse

查看:450
本文介绍了导入在Eclipse项目的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,我FFmpeg的进口作为一个项目来减少选择的视频尺寸为我的Andr​​oid应用程序。但我的apk文件大小从2MB上升到24MB。

On Eclipse, I imported FFmpeg as a project to reduce a selected video sizes for my android application. But my .apk size went up from 2MB to 24MB.

该项目包括了很多视频编辑的额外属性。不过,我只使用一个单一的命令行来减少我的视频分辨率。在code我说:

This project includes a lot of extra properties for video editing. However I use only one single command line to reduce my video resolution. The code I added:

LoadJNI vk = new LoadJNI();
                    try {
                        String workFolder = getApplicationContext()
                                .getFilesDir().getAbsolutePath();

                        String[] complexCommand = {
                                "ffmpeg",
                                "-y",
                                "-i",
                                "/storage/emulated/0/DCIM/Camera/20150224_125355.mp4",
                                "-strict", "experimental", "-s", "160x120",
                                "-r", "25", "-vcodec", "mpeg4", "-b", "150k",
                                "-ab", "48000", "-ac", "2", "-ar", "22050",
                                "/storage/emulated/0/TempFolder/out.mp4" };
                        vk.run(complexCommand, workFolder,
                                getApplicationContext());

                        Log.i("test", "ffmpeg4android finished successfully");
                    } catch (Throwable e) {
                        Log.e("test", "vk run exception.", e);
                    }

要总结起来,是有办法导入项目的一部分(作为一个模块可能)?或者我必须找到另一种方法来降低我的视频大小?

To sum up, is there a way to import a portion of a project (as a module maybe) ? or do I have to find another method to reduce my video size ?

推荐答案

你不是真的导入项目 - 您使用的是称为二进制的ffmpeg ,这是包含所有的第三方库的可执行文件,静态编译成一个包。你不能让这个文件的任何小。您只能启用较少库编译。

You're not really importing a project – you're using a binary called ffmpeg, which is an executable file that contains all of the third-party libraries statically compiled into one package. You cannot make this file any smaller. You can only compile it with fewer libraries enabled.

您的ffmpeg二进制文件,当你不带任何参数运行,显示各种 - 这是编译前设置启用选项。例如,我的ffmpeg几乎包括一切有:

Your ffmpeg binary, when you run it without any arguments, shows various --enable options that were set before compilation. For example, my ffmpeg includes almost everything there is:

configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfontconfig --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-openssl --enable-libopus --enable-frei0r --enable-libcaca --enable-libsoxr --enable-libquvi --enable-libvidstab --enable-libx265 --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda

例如,如果您有 - 启用 - libfaac 您的ffmpeg包括FAAC音频连接codeR这不是绝对必要的,并增加了二进制文件的大小。你使用任何来自 github.com/faywong/ffmpeg4android 编译二进制呢 - 所以你需要改变ffmpeg4android的方式建立FFmpeg的二进制文件包括少。

For example, if you have --enable-libfaac your ffmpeg includes an FAAC audio encoder which is not strictly necessary and increases the binary file size. You're using whatever the binary compiled from github.com/faywong/ffmpeg4android does – so you need to change the way ffmpeg4android builds the ffmpeg binary to include less.

的ffmpeg的绝对最低版本是真正有用的将包括 libx264 而已,如果你打算与AAC音频编码H.264视频。要做到这一点,你必须配置与的ffmpeg - 启用 - libx264 。但是,在你的问题,你的命令有 MPEG4 为codeC,这是一个MPEG-4视频连接内置的ffmpeg codeR,所以你在理论上可以只是坚持有了这个。请注意,MPEG-4视频不是如H.264那样有效并且将产生更大的文件为同一质量或在相同的比特率较低的质量

The absolute minimum build of ffmpeg that is actually useful would include libx264 only, if you plan on encoding H.264 video with AAC audio. To do that, you'd have to configure ffmpeg with --enable-libx264. But in your question, your command has mpeg4 as codec, which is an MPEG-4 Visual encoder built into ffmpeg, so you theoretically can just stick with this. Keep in mind that MPEG-4 Visual is not as efficient as H.264 and will yield larger files for the same quality—or lower quality at the same bitrate.

不过,这取决于你是如何构建的。如果你真的有可能从启用libx264除了没有您的构建是大的,没有太多可以做的,如果你想保留的ffmpeg。一个独立的视频连接codeR像X264可能较小,但在什么样的格式/ codeCS它可以读取和写入方面能力有限。

But it depends on how yours was built. If you really have nothing enabled apart from maybe libx264 and your build is that large, there's not much you can do about it if you want to keep ffmpeg. A standalone video encoder like x264 may be smaller, but has limited capabilities in terms of what formats/codecs it can read and write to.

这篇关于导入在Eclipse项目的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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