MPEG-DASH - 多路表示问题

MPEG-DASH - Multiplexed Representations Issue

我正在尝试学习 ffmpeg、MP4Box 和 MPEG-DASH,但我 运行遇到了我正在使用的 .mp4 的问题。我正在使用 ffmpeg 通过以下命令解复用 mp4:

ffmpeg -i test.mp4 -c:v copy -g 72 -an video.mp4 -c:a copy audio.mp4

创建两个文件后,我使用 MP4Box 使用以下命令为 dash 播放器分割文件:

MP4Box -dash 4000 -frag 1000 -rap -segment-name segment_ output.mp4

它创建了我认为我需要的所有文件。然后我将播放器指向 output_dash.mpd,除了控制台中的大量消息外什么都没有发生:

[8] EME detected on this user agent! (ProtectionModel_21Jan2015) 
[11] Playback Initialized 
[21] [dash.js 2.3.0] MediaPlayer has been initialized 
[64] Parsing complete: ( xml2json: 3.42ms, objectiron: 2.61ms, total: 0.00603s) 
[65] Manifest has been refreshed at Wed Apr 12 2017 12:16:52 GMT-0600 (MDT)[1492021012.196]  
[72] MediaSource attached to element.  Waiting on open... 
[77] MediaSource is open! 
[77] Duration successfully set to: 148.34 
[78] Added 0 inline events 
[78] No video data. 
[79] No audio data. 
[79] No text data. 
[79] No fragmentedText data. 
[79] No embeddedText data. 
[80] Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines 
[81] No streams to play.

这是我正在使用的视频中的 MP4Box 信息:

* Movie Info *
    Timescale 1000 - Duration 00:02:28.336
    Fragmented File no - 2 track(s)
    File suitable for progressive download (moov before mdat)
    File Brand mp42 - version 512
    Created: GMT Wed Feb  6 06:28:16 2036

File has root IOD (9 bytes)
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: Not part of MPEG-4 Visual profiles (0xfe)
Audio PL: Not part of MPEG-4 audio profiles (0xfe)
No streams included in root OD

iTunes Info:
    Name: Rogue One - A Star Wars Story
    Artist: Lucasfilm
    Genre: Trailer
    Created: 2016
    Encoder Software: HandBrake 0.10.2 2015060900
    Cover Art: JPEG File

Track # 1 Info - TrackID 1 - TimeScale 90000 - Duration 00:02:28.335
Media Info: Language "Undetermined" - Type "vide:avc1" - 3552 samples
Visual Track layout: x=0 y=0 width=1920 height=816
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1920 x 816
    AVC Info: 1 SPS - 1 PPS - Profile High @ Level 4.1
    NAL Unit length bits: 32
    Pixel Aspect Ratio 1:1 - Indicated track size 1920 x 816
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 44100 - Duration 00:02:28.305
Media Info: Language "English" - Type "soun:mp4a" - 6387 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
Synchronized on stream 1
Alternate Group ID 1

我知道我需要将视频和音频分开,我想这就是我的问题所在。我正在使用的命令可能没有做正确的事情。

是否有更好的命令来解复用我的 mp4? 我使用的 MP4Box 命令是否最适合分割文件? 如果我使用不同的文件,它们是否总是需要分离?

有一件事要提一下,如果我使用以下命令一切正常,但没有音频,因为 -an 这意味着它只有视频:

ffmpeg -i test.mp4 -c:v copy -g 72 -an output.mp4

MP4Box -dash 4000 -frag 1000 -rap -segment-name segment_ output.mp4

更新

我注意到视频没有音频流,但音频有视频流,这就是我收到多路复用器错误的原因。我认为这可能是个问题,所以我 运行 使用此命令将不需要的流排除在输出之外:

ffmpeg -i test.mp4 -c:v copy -g 72 -an video.mp4 -c:a copy -vn audio.mp4

然后我运行:

MP4Box -dash 4000 -frag 1000 -rap -segment-name segment_ video.mp4 audio.mp4

现在我不再收到 Multiplexed representations are intentionally not supported... 消息,但现在我收到:

[122] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED 
[123] [object MediaError] 
[125] Schedule controller stopping for audio 
[126] Caught pending play exception - continuing (NotSupportedError: Failed to load because no supported source was found.)

我尝试通过 Chrome 独立播放视频和音频,它们都有效,只是没有通过 dash 播放器。呃,这个学起来很痛苦,但我觉得我在进步。

我最终选择了 Bento4。我不确定为什么我不能让 MP4Box 工作,但 Bento4 工作起来非常简单,让我在几个小时内就可以开始工作了。

您没有使用好的配置文件。考虑到日志,我想您正在使用 dash-if 播放器。在这种情况下,您需要使用此命令:

MP4Box -dash 4000 -frag 1000 -profile dashavc264:onDemand -rap -segment-name segment_output.mp4