Ffmpeg没有正确转换为ogg [英] Ffmpeg not converting properly to ogg

查看:375
本文介绍了Ffmpeg没有正确转换为ogg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ffmpeg在我的网站上转换音频和视频。 Ffmpeg正确转换为其他格式,如mp3,mp4等,但不能正确转换为ogg。虽然ffmpeg正在创建ogg文件,但新创建的ogg文件已损坏,而且大小比原始文件大。我使用以下PHP代码转换为ogg。

  exec(/ usr / bin / ffmpeg -i$ _FILES ['thefile1'] ['tmp_name']。./ogg/$file_name\".\".ogg); 


解决方案

我会假设你在看对于ogg视频,而不是音频。如果你想要音频,只需删除vcodec的东西。



添加以下参数:

 code> vcodec libtheora 
acodec libvorbis

所以你的命令将成为: p $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ vcodec libtheora -acodec libvorbis ./ogg/$file_name\".\".ogg);

您必须确保已安装libtheora和libvorbis。如果您执行该命令并且没有安装它,ffmpeg会抛出错误。您可以使用

  ffmpeg -codecs 

并搜索libtheora和libvorbis。


I am using ffmpeg to convert audio and video on my website. Ffmpeg is properly converting to other formats like mp3, mp4, etc. but not converting properly to ogg. Although ffmpeg is creating the ogg file but the newly created ogg file is corrupted and too much bigger in size than the original one. I am using the following PHP code to convert to ogg.

exec("/usr/bin/ffmpeg -i ".$_FILES['thefile1']['tmp_name']." ./ogg/$file_name".".ogg");

解决方案

I'm going to assume that you're looking for ogg video, not audio. If you wanted audio, just remove the vcodec stuff.

Add the following parameters:

vcodec libtheora
acodec libvorbis

So your command would become:

exec("/usr/bin/ffmpeg -i ".$_FILES['thefile1']['tmp_name']." -vcodec libtheora -acodec libvorbis ./ogg/$file_name".".ogg");

You have to make sure that you have libtheora and libvorbis installed. ffmpeg will throw an error if you execute that command and you don't have them installed. You can check using

ffmpeg -codecs

and searching for libtheora and libvorbis.

这篇关于Ffmpeg没有正确转换为ogg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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