不支持的演示文稿(0x20400003)

时间:2017-03-04 23:05:10

标签: azure live-streaming azure-media-services

所以我试图通过Azure Media Services运行一个非常简单的直播系统。我已经在带有USB摄像头的Raspberry Pi上安装了ffmpeg,我只是想通过Azure接收摄像头,因此我可以开始修改媒体播放器。 ffmpeg命令似乎没有故障,但每当我尝试预览流时,都会出现以下错误:

  

“由于损坏问题导致视频播放中止,或者视频使用了浏览器不支持的功能.0x20400003”

代码的0x0400003部分列在文档中(http://amp.azure.net/libs/amp/latest/docs/index.html#error-codes) 因为不支持视频的呈现,但我无法找到真正意味着什么是错误的。

我正在使用以下ffmpeg命令进行编码,

ffmpeg -v verbose -framerate 30 -r 30 -i /dev/video0 -vcodec libx264 -preset ultrafast -acodec libfdk-aac -ab 48k -b:v 500k -maxrate 500k -bufsize 500k -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -f flv rtmp://{Azure channel address}/channel5

导致以下输出:

ffmpeg version N-83743-gd757ddb Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --enable-gpl --enable-libx264 --enable-nonfree --enable-libfdk-aac
  libavutil      55. 47.101 / 55. 47.101
  libavcodec     57. 82.100 / 57. 82.100
  libavformat    57. 66.103 / 57. 66.103
  libavdevice    57.  3.100 / 57.  3.100
  libavfilter     6. 74.100 /  6. 74.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[video4linux2,v4l2 @ 0x1f7a430] fd:3 capabilities:84200001
[video4linux2,v4l2 @ 0x1f7a430] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x1f7a430] Setting frame size to 640x480
[video4linux2,v4l2 @ 0x1f7a430] The driver changed the time per frame from 1/30 to 1/15
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 169752.581724, bitrate: 73728 kb/s
    Stream #0:0: Video: rawvideo, 1 reference frame (YUY2 / 0x32595559), yuyv422, 640x480, 73728 kb/s, 15 fps, 15 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x1f89eb0] w:640 h:480 pixfmt:yuyv422 tb:1/30 fr:30/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x1f8a9c0] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x1f8a040] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[graph 0 input from stream 0:0 @ 0x1f89eb0] TB:0.033333 FRAME_RATE:30.000000 SAMPLE_RATE:nan
[auto_scaler_0 @ 0x1f8a9c0] w:640 h:480 fmt:yuyv422 sar:0/1 -> w:640 h:480 fmt:yuv422p sar:0/1 flags:0x4
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1f7d650] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x1f7d650] profile High 4:2:2, level 3.0, 4:2:2 8-bit
[libx264 @ 0x1f7d650] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=60 keyint_min=31 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=cbr mbtree=0 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=500 vbv_bufsize=500 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
Output #0, flv, to 'rtmp://{Azure Channel Address}/channel5':
  Metadata:
    encoder         : Lavf57.66.103
    Stream #0:0: Video: h264 (libx264), 1 reference frame ([7][0][0][0] / 0x0007), yuv422p, 640x480, q=-1--1, 500 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.82.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 500000/0/500000 buffer size: 500000 vbv_delay: -1
[flv @ 0x1f7c1c0] Failed to update header with correct duration.ate= 501.5kbits/s speed=0.25x
[flv @ 0x1f7c1c0] Failed to update header with correct filesize.
frame= 2155 fps=7.5 q=-1.0 Lsize=    4392kB time=00:01:11.80 bitrate= 501.1kbits/s speed=0.25x
video:4350kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.974120%

我不确定标头错误是否有意义,因为程序继续按预期运行,但请告诉我这里是否存在明显问题,或者对于演示文稿问题是否有任何有意义的解释

1 个答案:

答案 0 :(得分:1)

好的,这是Raspberry PI Live流媒体到Azure媒体服务的快速帮助,对我来说非常好。

你可以在这里做一些技巧,让它更好地运作。问题主要在于FFMPEG命令,但您也可以通过使用PI上的硬件加速支持来优化编码(如果您有2或更高)。

我最初遵循本指南来构建FFMPEG。 https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

  1. 我必须先编译x264编解码器。
  2. 在编译FFMPEG时,我必须使用“make -j4”在最新的Raspberry PI B +或3.0的所有4个内核上进行编译。使编译速度更快。
  3. 编辑在PI上花了很长时间,所以我让它在一夜之间运行。
  4. 一旦我编译了FFMPEG,我就使用了新的H264 Open Max(OMX)加速功能。

    一旦我开始工作,我做了一个快速测试,以确保我能成功捕获MP4文件

    ffmpeg -framerate 30 -r 30 -s 640x360 -i /dev/video0 -vcodec h264_omx -preset ultrafast -acodec libfaac -ab 48k -b:v 2000k -bufsize 500k -g 60 -keyint_min 60 -sc_threshold 0 out.mp4
    

    最后,我使用了Smooth Streaming协议支持(比RTMP更可靠)。

    ffmpeg  -i /dev/video1 -pix_fmt yuv420p -f ismv -movflags isml+frag_keyframe  -video_track_timescale 10000000 -frag_duration 2000000 -framerate 30 -r 30  -c:v h264_omx -preset ultrafast -map 0:v:0  -b:v:0 2000k -minrate:v:0 2000k -maxrate:v:0 2000k -bufsize 2500k  -s:v:0 640x360  -map 0:v:0  -b:v:1 500k -minrate:v:1 500k -maxrate:v:1 500k -s:v:1 480x360 -g 60 -keyint_min 60 -sc_threshold 0  -c:a libfaac -ab 48k  -map 0:a? -threads 0 "http://***your-account-***channel.mediaservices.windows.net/ingest.isml/Streams(video)"
    

    深入了解FFMPEG命令行上面的内容:

    ffmpeg 
    -re     **READ INPUT AT NATIVE FRAMERATE
    -stream_loop -1  **LOOP INFINITE
    -i C:\Video\tears_of_steel_1080p.mov   **INPUT FILE IS THIS MOV FILE
    -movflags isml+frag_keyframe  **OUTPUT IS SMOOTH STREAMING THIS SETS THE FLAGS
    -f ismv  **OUTPUT ISMV SMOOTH
    -threads 0  ** SETS THE THREAD COUNT TO USE FOR ALL STREAMS. YOU CAN USE A STREAM SPECIFIC COUNT AS WELL
    -c:a aac  ** SET TO AAC CODEC
    -ac 2   ** SET THE OUTPUT TO STEREO
    -b:a 64k ** SET THE BITRATE FOR THE AUDIO
     -c:v libx264  ** SET THE VIDEO CODEC
    -preset fast ** USE THE FAST PRESET FOR X246
     -profile:v main **USE THE MAIN PROFILE
    -g 48 ** GOP SIZE IS 48 frames
     -keyint_min 48 ** KEY INTERVAL IS SET TO 48 FRAMES
    -sc_threshold 0  ** NOT SURE! 
    -map 0:v   ** MAP THE FIRST VIDEO TRACK OF THE FIRST INPUT FILE
    -b:v:0 5000k   **SET THE OUTPUT TRACK 0 BITRATE
    -minrate:v:0 5000k  ** SET OUTPUT TRACK 0 MIN RATE TO SIMULATE CBR
    -maxrate:v:0 5000k  ** SET OUTPUT TRACK 0 MAX RATE TO SIMULATE CBR
    -s:v:0 1920x1080  **SCALE THE OUTPUT OF TRACK 0 to 1920x1080. 
    -map 0:v  ** MAP THE FIRST VIDEO TRACK OF THE FIRST INPUT FILE
    -b:v:1 3000k ** SET THE OUTPUT TRACK 1 BITRATE TO 3Mbps
    -minrate:v:1 3000k -maxrate:v:1 3000k  ** SET THE MIN AND MAX RATE TO SIMULATE CBR OUTPU
    -s:v:1 1280x720  ** SCALE THE OUTPUT OF TRACK 1 to 1280x720
    -map 0:v -b:v:2 1800k  ** REPEAT THE ABOVE STEPS FOR THE REST OF THE OUTPUT TRACKS
    -minrate:v:2 1800k -maxrate:v:2 1800k -s:v:2 854x480 
    -map 0:v -b:v:3 1000k -minrate:v:3 1000k -maxrate:v:3 1000k -s:v:3 640x480 
    -map 0:v -b:v:4 600k -minrate:v:4 600k -maxrate:v:4 600k -s:v:4 480x360 
    -map 0:a:0    ** FINALLY TAKE THE SOURCE AUDIO FROM THE FIRST SOURCE AUDIO TRACK. 
     http://<yourchannel>.channel.mediaservices.windows.net/ingest.isml/Streams(stream0)
    

    希望这有助于您开始朝着正确的方向前进。如果您还有其他问题,请与我们联系。