HTML5视频的多个音轨 [英] Multiple audio tracks for HTML5 video

查看:103
本文介绍了HTML5视频的多个音轨的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTML5为我的网站制作视频.理想情况下,我将只有一个无声视频文件,以及五个与视频同步的不同语言的音轨.

I'm building a video for my website with HTML5. Ideally, I'd have only one silent video file, and five different audio tracks in different languages that sync up with the video.

然后,我将有一个按钮,即使在播放视频时,该按钮也允许用户在音轨之间切换;这样,正确的音轨就会变得栩栩如生(无需暂停视频或重新开始播放视频,就像DVD音轨选择一样).

Then I'd have a button that allows users to switch between audio tracks, even as the video is playing; and the correct audio track would come to life (without the video pausing or starting over or anything; much like a DVD audio track selection).

我可以在Flash中非常简单地执行此操作,但是我不想这样做.必须有一种在纯HTML5或HTML5 + jQuery中执行此操作的方法.我想您会以0的音量播放所有音频文件,而只会增加活动音轨的音量...但是我什至不知道该怎么做,更不用说在用户暂停或倒带时处理它了视频...

I can do this quite simply in Flash, but I don't want to. There has to be a way to do this in pure HTML5 or HTML5+jQuery. I'm thinking you'd play all the audio files at 0 volume, and only increase the volume of the active track... but I don't know how to even do that, let alone handle it when the user pauses or rewinds the video...

提前谢谢!

推荐答案

如果您愿意下载所有五首曲目,为什么不将它们混音到视频中呢?视频不限于单个音轨(甚至AVI也可以创建多个音轨).然后应该为您处理同步.您只需根据需要启用/禁用音轨.

If you're willing to let all five tracks download, why not just mux them into the video? Videos are not limited to a single audio track (even AVI could do multiple audio tracks). Then syncing should be handled for you. You'd just enable/disable the audio tracks as needed.

这篇关于HTML5视频的多个音轨的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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