Ffmpeg not converting properly to ogg [closed]

社会主义新天地 提交于 2019-12-07 15:08:27

问题


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");

回答1:


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.



来源:https://stackoverflow.com/questions/6863445/ffmpeg-not-converting-properly-to-ogg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!