段持续时间变化高于DASH-IF允许的+/- 50%

时间:2016-03-21 17:08:17

标签: ffmpeg mpeg-dash mp4box

我使用DASH实现了一个带有视频播放器的概念验证页面。我很难获得正确的视频,我不确定这是编码问题还是MP4Box问题。

由于我正在使用Ubuntu,我不得不为ffmpeg更改一些参数,但根据我的阅读,这应该没问题:

~/ffmpeg/ffmpeg -c:a aac -ar 44100 -ac 1 -codec:v libx264 \
  -profile:v baseline -level 13 -b:v 2000k video_transcoded.mp4 -i video.mp4

然后创建MPD我正在运行:

MP4Box -dash 10000 -dash-profile live \
  -segment-name video_transcoded video_transcoded.mp4

我最后得到了这个回复,这可能就是为什么没有玩家会播放我的视频的原因:

  [DASH] two languages in adaptation set: und will be kept eng will be ignored
  DASHing file video_transcoded.mp4
  [DASH]: Segment duration variation is higher than the +/- 50% allowed by DASH-IF (min 1.044, max 10.448) - please reconsider encoding

这是ffmpeg的输出:

    ffmpeg version N-53477-g689211d-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 5.3.1 (Debian 5.3.1-10) 20160224
      configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc
      libavutil      55. 19.100 / 55. 19.100
      libavcodec     57. 28.100 / 57. 28.100
      libavformat    57. 28.100 / 57. 28.100
      libavdevice    57.  0.101 / 57.  0.101
      libavfilter     6. 39.102 /  6. 39.102
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gladiator.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 1
        compatible_brands: isomavc1
        creation_time   : 2013-02-12 19:14:56
      Duration: 02:50:56.98, start: 0.000000, bitrate: 923 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x544 [SAR 1:1 DAR 40:17], 823 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
        Metadata:
          creation_time   : 2013-02-12 19:14:56
          handler_name    : 2000.Extended.Remastered.720p.BluRay.x264-HDEVO.mkv.264#trackID=1:fps=23.976@GPAC0.5.1-DEV-rev4283
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 95 kb/s (default)
        Metadata:
          creation_time   : 2013-02-12 15:32:26
          handler_name    : Sound Media Handler
    [libx264 @ 0xaf12920] using SAR=1/1
    [libx264 @ 0xaf12920] frame MB size (80x34) > level limit (396)
    [libx264 @ 0xaf12920] DPB size (3 frames, 8160 mbs) > level limit (0 frames, 2376 mbs)
    [libx264 @ 0xaf12920] MB rate (65214) > level limit (11880)
    [libx264 @ 0xaf12920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0xaf12920] profile Constrained Baseline, level 1.3
    [libx264 @ 0xaf12920] 264 - core 148 r236 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'gladiator2.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 1
        compatible_brands: isomavc1
        encoder         : Lavf57.28.100
        Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x544 [SAR 1:1 DAR 40:17], q=-1--1, 2000 kb/s, 23.98 fps, 24k tbn, 23.98 tbc (default)
        Metadata:
          creation_time   : 2013-02-12 19:14:56
          handler_name    : 2000.Extended.Remastered.720p.BluRay.x264-HDEVO.mkv.264#trackID=1:fps=23.976@GPAC0.5.1-DEV-rev4283
          encoder         : Lavc57.28.100 libx264
        Side data:
          cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: -1
        Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, mono, fltp, 69 kb/s (default)
        Metadata:
          creation_time   : 2013-02-12 15:32:26
          handler_name    : Sound Media Handler
          encoder         : Lavc57.28.100 aac
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
      Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help

转码完成后,我明白了:

frame=  132 fps= 15 q=25.0 Lsize=    1112kB time=00:00:05.31 bitrate=1713.0kbits/s speed=0.603x    
video:1062kB audio:45kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.414602%
[libx264 @ 0xab63de0] frame I:1     Avg QP:21.29  size:121187
[libx264 @ 0xab63de0] frame P:131   Avg QP:23.40  size:  7372
[libx264 @ 0xab63de0] mb I  I16..4:  9.2%  0.0% 90.8%
[libx264 @ 0xab63de0] mb P  I16..4:  0.9%  0.0%  0.3%  P16..4: 37.2%  7.0%  1.8%  0.0%  0.0%    skip:52.7%
[libx264 @ 0xab63de0] final ratefactor: 21.58
[libx264 @ 0xab63de0] coded y,uvDC,uvAC intra: 48.8% 72.2% 30.7% inter: 8.9% 14.6% 0.8%
[libx264 @ 0xab63de0] i16 v,h,dc,p: 28% 33% 18% 21%
[libx264 @ 0xab63de0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 16% 15%  8%  7%  8%  6% 12%  6%
[libx264 @ 0xab63de0] i8c dc,h,v,p: 52% 21% 19%  8%
[libx264 @ 0xab63de0] ref P L0: 92.9%  5.2%  1.8%
[libx264 @ 0xab63de0] kb/s:1646.80
[aac @ 0xab64c40] Qavg: 112.650

我可以做些什么来完成这项工作?

1 个答案:

答案 0 :(得分:0)

您需要在ffmpeg命令中设置gop大小:

-g NUMBER_OF_FRAMES

示例ffmpeg命令可能如下所示:

  

ffmpeg -i input_video.mp4 -c:libfaac -ar 48000 -b:128k -c:v   libx264 -preset slow -sc_threshold 0 -r 24 -g 96 -s 1280x720 -b:v   2000k output.mp4

此博客文章中还介绍了编码,打包和播放的完整工作流程:mpeg-dash content generation using x264 and mp4box

另一种选择是您使用服务对您的测试内容进行编码,例如bitmovin encoding service(具有2.5GB的免费计划)。