我在使用 AWS MediaConvert 转换和打包文件时遇到一个奇怪的问题。我有一个工作流程,可以将任何媒体上传到 S3 存储桶。接下来,Lambda 脚本将文件移交给 MediaConvert。我正在尝试使用
MPEG-Dash
和 VP9
作为编解码器转换为 AAC
。最终,视频被写入目标Bucket。
问题:当我尝试在浏览器中使用
Shaka Player
或 Dash.js
播放已完成的 Dash 文件之一(我使用 AWS CLI 在本地下载了所有资源)时,我在 JavaScript 控制台中收到一条奇怪的消息(在两个框架上):
Jumping forward 3.0016669999999976 seconds because of gap starting at 84.118 and ending at 87.087
例如。从视频开始到结束都是如此。在我的屏幕上,看起来我正在快进整个视频。而这种情况只发生在 Firefox 中。 Chrome 和 Safari 都很好。我在 Mac 和 Linux 上测试了 Firefox。两者均为 Firefox 版本 121.0。
我对 Shaka Player 使用了以下代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.7.1/shaka-player.compiled.debug.min.js"></script>
<title>VP9Test</title>
</head>
<body>
<h1>VP9 Test</h1>
<video id="video" width="720" controls></video>
<script>
const manifestUri = 'http://host/video/master.mpd';
function initApp() {
// Install built-in polyfills to patch browser incompatibilities.
shaka.polyfill.installAll();
// Check to see if the browser supports the basic APIs Shaka needs.
if (shaka.Player.isBrowserSupported()) {
// Everything looks good!
initPlayer();
} else {
// This browser does not have the minimum set of APIs we need.
console.error('Browser not supported!');
}
}
async function initPlayer() {
// Create a Player instance.
const video = document.getElementById('video');
const player = new shaka.Player();
await player.attach(video);
// Attach player to the window to make it easy to access in the JS console.
window.player = player;
// Listen for error events.
player.addEventListener('error', onErrorEvent);
// Try to load a manifest.
// This is an asynchronous process.
try {
await player.load(manifestUri);
// This runs if the asynchronous load is successful.
console.log('The video has now been loaded!');
} catch (e) {
// onError is executed if the asynchronous load fails.
onError(e);
}
}
function onErrorEvent(event) {
// Extract the shaka.util.Error object from the event.
onError(event.detail);
}
function onError(error) {
// Log the error.
console.error('Error code', error.code, 'object', error);
}
document.addEventListener('DOMContentLoaded', initApp);
</script>
</body>
</html>
这几乎是文档中的代码。
我有3项资产:
要测试的所有资产:
MediaConvert 之前:https://drive.google.com/file/d/1zpGWAsufb3X33n3UTJdLI01pbKVJfVvX/view MediaConvert 后:https://drive.google.com/file/d/1eswBTSJBEFFyW4kgTP9w2i4c_S96Ku5E/view
这是我的 MediaConvert 设置:
{
"Queue": "arn:aws:mediaconvert:us-east-1:694531566426:queues/Default",
"UserMetadata": {
"assetID": "ffb4b4a5-6746-42e3-bccb-e57a04bc4832"
},
"Role": "arn:aws:iam::694531566426:role/MediaConvertRole",
"Settings": {
"TimecodeConfig": {
"Source": "ZEROBASED"
},
"OutputGroups": [
{
"Name": "DASH ISO",
"Outputs": [
{
"ContainerSettings": {
"Container": "MPD"
},
"VideoDescription": {
"Width": 1920,
"Height": 1080,
"CodecSettings": {
"Codec": "VP9",
"Vp9Settings": {
"RateControlMode": "VBR",
"Bitrate": 4000000
}
}
},
"NameModifier": "_v1"
},
{
"ContainerSettings": {
"Container": "MPD"
},
"VideoDescription": {
"Width": 1600,
"Height": 900,
"CodecSettings": {
"Codec": "VP9",
"Vp9Settings": {
"RateControlMode": "VBR",
"Bitrate": 2600000
}
}
},
"NameModifier": "_v2"
},
{
"ContainerSettings": {
"Container": "MPD"
},
"VideoDescription": {
"Width": 1280,
"Height": 720,
"CodecSettings": {
"Codec": "VP9",
"Vp9Settings": {
"RateControlMode": "VBR",
"Bitrate": 1800000
}
}
},
"NameModifier": "_v3"
},
{
"ContainerSettings": {
"Container": "MPD"
},
"VideoDescription": {
"Width": 960,
"Height": 540,
"CodecSettings": {
"Codec": "VP9",
"Vp9Settings": {
"RateControlMode": "VBR",
"Bitrate": 1200000
}
}
},
"NameModifier": "_v4"
},
{
"ContainerSettings": {
"Container": "MPD"
},
"AudioDescriptions": [
{
"AudioSourceName": "Audio Selector 1",
"CodecSettings": {
"Codec": "AAC",
"AacSettings": {
"Bitrate": 192000,
"CodingMode": "CODING_MODE_2_0",
"SampleRate": 48000
}
}
}
],
"NameModifier": "_a1"
}
],
"OutputGroupSettings": {
"Type": "DASH_ISO_GROUP_SETTINGS",
"DashIsoGroupSettings": {
"SegmentLength": 30,
"Destination": "s3://bucket-dest/assets/ffb4b4a5-6746-42e3-bccb-e57a04bc4832/dash/amv",
"FragmentLength": 2,
"SegmentControl": "SEGMENTED_FILES"
}
}
}
],
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
},
"VideoSelector": {},
"TimecodeSource": "ZEROBASED",
"FileInput": "s3://bucket-src/amv.mp4"
}
]
},
"BillingTagsSource": "JOB",
"AccelerationSettings": {
"Mode": "DISABLED"
},
"StatusUpdateInterval": "SECONDS_60",
"Priority": 0
}
此时此刻,我实在是无能为力。我希望有人能帮助我。
您提到“这只发生在 Firefox 中”,其他播放器都没有问题。这指出了一个特定于玩家的问题。每个播放器的缓冲和解码都略有不同。您也可以尝试 bitmovin 播放器或 jwplayer 的演示版本。
对于特定于玩家的问题,建议的下一步是查看该玩家的支持论坛;或者也许使用不同的 Firefox 播放器插件。一旦您知道某个玩家喜欢什么“食谱”,您很可能会改变您的工作设置以更好地适合该玩家。这需要对您选择的播放器进行一些研究和实验。
关于输出 - 应在指定时间检查输出清单是否有间隙或新周期 - 清单是否指定任何跳转?
仅供参考,您可以使用以下验证工具之一来验证 DASH 清单:https://dashif.org/tools/validators/
其他有用的提示:
a.应检查源资产是否有多个 ELST 原子,这些原子用于在文件中的特定时间开始播放音频或视频 - 基本上跳过源文件的一部分。
b.如果可能,请使用具有恒定帧速率的源文件。