使用LibVLC在Android上进行视频旋转 [英] Video rotation on android using LibVLC

查看:93
本文介绍了使用LibVLC在Android上进行视频旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用LibVLC来显示视频文件.到目前为止,尽管方向明确,但仍能正常工作.我能够从元数据中获得方向信息,但是我真的不知道如何强制LibVLC将其从横向旋转为纵向.

I'm using LibVLC to display video files. It's working fine so far, despite of the orientation. I'm able to get the orientation out of meta-data but don't really know how to force LibVLC to rotate it from landscape to portrait.

很高兴获得解决方法的提示.

It would be nice to get a hint for a workaround.

谢谢!

推荐答案

我遇到了类似的问题.不幸的是,Android的LibVLC并未公开所有功能,因此我不得不在jni层中更改代码以使其正常运行.这是操作方法:

I had a similar problem. Unfortunately LibVLC for android does not expose all features, so I had to change code in the jni layer to get it working. Here is how to do it:

编辑libvlcjni.c,然后找到函数:Java_org_videolan_libvlc_LibVLC_nativeInit.查找本地varibale argv数组,并将以下内容添加到其中:

Edit libvlcjni.c, and find the function : Java_org_videolan_libvlc_LibVLC_nativeInit. Look for the local varibale argv array and add the following to items to it:

-video-filter = transform""--transform-type ="

"--video-filter=transform" "--transform-type="

其中转换类型是以下类型之一:90、180、270,hfilp,vfilp.

Where transform type is one of the following: 90, 180, 270, hfilp, vfilp.

如果省略--transform-type,则默认情况下会旋转90度.

If you omit --transform-type you'l get a 90 degree rotation by default.

此修改的作用是加载转换过滤器,然后设置转换.您可以使用--rotation-angle进行更细粒度的旋转,但是必须首先加载适当的滤镜.

What this modifications does, is it loads the transform filter and then sets the transformation. You can do more fine grained rotation using --rotation-angle, but you'll have to load the appropriate filter first.

希望这会有所帮助.

这篇关于使用LibVLC在Android上进行视频旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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