webm破折号编码...什么是正确的ffmpeg参数? [英] webm dash encoding... What are the correct ffmpeg parameters?

查看:174
本文介绍了webm破折号编码...什么是正确的ffmpeg参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将这些视频编码成符合破折号的格式。我要从.mp4到.webm



首先,我正在运行OS X和ffmpeg 2.5.4。



这是我在测试中使用的编码命令(我从 here ):

  ffmpeg -i IMG_0113.mp4 -c:v libvpx- vp9 -s 160x90 -b:v 25k -g 1 -tile-columns 4 -frame-parallel 1 -an -f webm -dash 1 video_160x90_25k.webm 

ffmpeg -i IMG_0113.mp4 -c: v libvpx-vp9 -s 160x90 -b:v 50k -g 1 -tile-columns 4 -frame-parallel 1 -an -f webm -dash 1 video_160x90_50k.webm

ffmpeg -i IMG_0113.mp4 -vn -acodec libvorbis -ab 128k -dash 1 audio_128k.webm

ffmpeg -f webm_dash_manifest -i video_160x90_25k.webm -f webm_dash_manifest -i video_160x90_50k.webm -f webm_dash_manifest -i audio_128k.webm -c copy -map 0 -map 1 -map 2 -f webm_dash_manifest -adaptation_setsid = 0,streams = 0,1 id = 1,streams = 2manifest.mpd

其次,问题不在于我的服务器,因为我已经从这里,他们工作100% dash.js播放器在从本地服务器发送时。



请问有人可以指出我的方向正确吗?或者提供用于获取输出格式正确的ffmpeg命令的示例。



谢谢
Dean。

解决方案

好的,这里,设法解决这个问题。希望这会节省别人的麻烦。



首先,这里是解决方案。



步骤1: / strong>(从视频中分离音频并创建单个音频文件)

  ffmpeg -i IMG_0113.mp4 -c:v libvpx -s 160x90 -threads 4 -b:v 25k -tile-columns 4 -frame-parallel 1 -an -keyint_min 30 -g 30 -f webm video_160x90_25k.webm 

ffmpeg -i IMG_0113.mp4 - c:v libvpx -s 160x90 -threads 4 -b:v 50k -tile-columns 4 -frame-parallel 1 -an -keyint_min 30 -g 30 -f webm video_160x90_50k.webm

ffmpeg -i IMG_0113.mp4 -vn -acodec libvorbis -ab 128k audio_128k.webm

步骤2: / strong>(使用 sample_muxer 从libwebm项目可在这里,创建视频提示点)

  sample_muxer -i video_160x90_25k.webm -o video_160x90_25k_cued.webm 

sample_muxer -i video_160x90_50k.webm -o video_160x90 _50k_cued.webm

步骤3:(使用ffmpeg创建音频提示积分)

  ffmpeg -i audio_128k.webm -vn -acodec libvorbis -ab 128k -dash 1 audio_128k_cued.webm 

步骤4:(使用ffmpeg创建webm破折号清单文件 .mpd

  ffmpeg -f webm_dash_manifest -i video_160x90_25k_cued.webm -f webm_dash_manifest -i video_160x90_50k_cued.webm -f webm_dash_manifest  - i audio_128k_cued.webm -c copy -map 0 -map 1 -map 2 -f webm_dash_manifest -adaptation_setsid = 0,streams = 0,1 id = 1,streams = 2manifest.mpd 



其次,这里是解释。



ffmpeg (我的版本至少),没有正确地创建视频文件中的提示点(添加-dash 1)参数时。我通过探测视频文件来确定这一点,并通过了解webm文件格式(阅读这个,如果你想知道更多)。



然后我从阅读此页面,并决定是否更好地处理ffmpeg没有正确的视频提示点。 Whoop Whoop,它做了!



我注意到从ffmpeg(使用-dash 1参数)提取的音频文件中的提示点正在正确创建! p>

webm破折号显示的ffmpeg一代也很好地工作!



要播放视频,我发现shaka -player最好的工作,但是我无法使用它,因为我需要从cefpython容器进行视频播放,而shaka播放器并不适用于cefpython发行版中最新的cef(chrome embedded framework)。



然后,我根据撰写自己的播放器网站从谷歌



无论如何,希望这有助于某人


I'm stumped with encoding videos into a dash compliant format. I'm going from .mp4 to .webm

Firstly, I am running OS X and ffmpeg 2.5.4.

Here's the encoding commands I am using in my test (I got these from here):

ffmpeg -i IMG_0113.mp4 -c:v libvpx-vp9 -s 160x90 -b:v 25k -g 1 -tile-columns 4 -frame-parallel 1 -an -f webm -dash 1 video_160x90_25k.webm

ffmpeg -i IMG_0113.mp4 -c:v libvpx-vp9 -s 160x90 -b:v 50k -g 1 -tile-columns 4 -frame-parallel 1 -an -f webm -dash 1 video_160x90_50k.webm

ffmpeg -i IMG_0113.mp4 -vn -acodec libvorbis -ab 128k  -dash 1 audio_128k.webm

ffmpeg -f webm_dash_manifest -i video_160x90_25k.webm -f webm_dash_manifest -i video_160x90_50k.webm -f webm_dash_manifest -i audio_128k.webm -c copy -map 0 -map 1 -map 2 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2" manifest.mpd

Secondly, the problem is not with my server, as I have downloaded the samples from here, and they work 100% on the dash.js player when served from my local server.

Please could someone out there point me in the right direction? Or provide a sample of the ffmpeg commands used to get the output format correct.

Thanks, Dean.

解决方案

Ok, here goes, managed to solve this. Hopefully this will save someone else some hassles.

Firstly, here's the solution.

Step 1: (strip audio from video, and create single audio file)

ffmpeg -i IMG_0113.mp4 -c:v libvpx -s 160x90 -threads 4 -b:v 25k -tile-columns 4 -frame-parallel 1 -an -keyint_min 30 -g 30 -f webm video_160x90_25k.webm

ffmpeg -i IMG_0113.mp4 -c:v libvpx -s 160x90 -threads 4 -b:v 50k -tile-columns 4 -frame-parallel 1 -an -keyint_min 30 -g 30 -f webm video_160x90_50k.webm

ffmpeg -i IMG_0113.mp4 -vn -acodec libvorbis -ab 128k audio_128k.webm

Step 2: (using sample_muxer from the libwebm project available here, to create the video cue points)

sample_muxer -i video_160x90_25k.webm -o video_160x90_25k_cued.webm

sample_muxer -i video_160x90_50k.webm -o video_160x90_50k_cued.webm

Step 3: (Use ffmpeg to create the audio cue points)

ffmpeg -i audio_128k.webm -vn -acodec libvorbis -ab 128k -dash 1 audio_128k_cued.webm

Step 4: (Use ffmpeg to create the webm dash manifest file .mpd)

ffmpeg -f webm_dash_manifest -i video_160x90_25k_cued.webm -f webm_dash_manifest -i video_160x90_50k_cued.webm -f webm_dash_manifest -i audio_128k_cued.webm -c copy -map 0 -map 1 -map 2 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2" manifest.mpd

Secondly, here's the explanation.

ffmpeg (my version atleast), was not creating the cue points in the video files correctly (when adding the -dash 1) param. I determined this by probing the video files, and by understanding the webm file format (read this, if you'd like to know more).

I then stumbled upon sample_muxer from reading this page, and decided to see if it would better handle the video cue points that ffmpeg wasn't getting right. Whoop Whoop, it did!

I noticed that the cue points in the extracted audio file from ffmpeg (using the -dash 1 param), were being created correctly!

The ffmpeg generation of the webm dash manifest is also working nicely!

For playing back the video, I found shaka-player worked best but I could not use it as I required video playback from a cefpython container and the shaka-player did not work on the latest cef (chromium embedded framework) included in the cefpython release.

I then wrote my own player based off of this helpful site from google

Anyway, hope this helps someone

这篇关于webm破折号编码...什么是正确的ffmpeg参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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