编码的Andr​​oid视频 [英] Encoding video for Android

查看:155
本文介绍了编码的Andr​​oid视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何正确地做我的连接为Android code视频?我见过所支持的媒体格式但我不真的知道从哪里开始使用这些设置生成的视频。

How do I properly encode video for Android? I've seen the supported media formats but I don't really know where to start with producing a video with those settings.

我还没有流这些视频。这些只是对本地播放。

I'm not yet streaming these videos. These are just for local playback.

什么是正确的方法进行编码的视频在整个Android设备的兼容性最大化?

What's the correct process for encoding videos to maximize compatibility across Android devices?

推荐答案

下面是我用来转换适用于Android的视频线。我有好运气运行Android> = 4。注意,这在的推荐的视频编码的。

Here's the line that I use to convert videos suitable for Android. I've had good luck playing it on all devices running Android >= 4. Note that this matched the "high quality" parameters in the recommended video encodings.

avconv -i source.mp4 -vcodec libx264 -profile:v baseline -b 500k -r 30 -vf "setsar=1:1" -acodec libvo_aacenc -ac 2 -ar 44100 -ab 128k converted.mp4

借助 setsar 过滤器我用套样品的纵横比为1:1,这是我'已经发现是有益的,如果您还使用任何或的规模选项。

The setsar filter I use sets the sample aspect ratio to 1:1, which I've found to be helpful if you're also using any of the transpose or scale options.

例如,视频顺时针旋转,使用这样的:

For example, to rotate the video clockwise, use this:

avconv ... -vf "transpose=dir=clock, setsar=1:1" ...

有一点要记住的是,有些设备不支持播放视频的分辨率比屏幕大。也就是说,具有400x800的屏幕尺寸的手机可能很难有时间玩视频这是800×600。

One thing to keep in mind is that some devices don't support playing videos with a resolution larger than a screen. That is, a phone with a screen size of 400x800 may have a hard time playing your video that's 800x600.

要逆时针旋转和缩放你的视频,使得它的宽度是400:

To rotate counterclockwise and scale your video such that its width is 400:

avconv ... -vf "transpose=dir=cclock, scale=400:trunc(ow/a/2)*2, setsar=1:1" ...

要顺时针旋转和缩放你的视频,使得它的高度是400,使用这样的:

To rotate clockwise and scale your video such that its height is 400, use this:

avconv ... -vf "transpose=dir=clock, scale=trunc(oh*a/2)*2:400, setsar=1:1" ...

我希望这有助于!这是一个很大的试验和错误的我。

I hope this helps! It's been a lot of trial and error for me.

有关它的价值,这里是我使用的avconv:

For what it's worth, here's the avconv I'm using:

avconv version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:02:36 with gcc 4.6.3

和我已经安装了这libav-tools包和<一HREF =htt​​p://packages.ubuntu.com/$p$pcise/libav$c$cc-extra-53相对=nofollow>这个libav codeC-EXTRA-53封装。

这篇关于编码的Andr​​oid视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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