What's wrong with my H264 video decoding (link to video included)
I've written an HTTP Live Streaming client for use in Silverlight. (It is implemented as a MediaStreamSource for a MediaElement)
The alpha code is working pretty well, except that there are some strange artefacts in the video decoding; in particular a horizontal strip at the bottom of the frame that is not being decoded properly. Please see this video for an example of what I mean.
As far as I can see, no frames are being dropped.
The encoding is being done by ffmpeg/X264 with the following command line:
ffmpeg --segment-length 5 --segment-offset 0 -threads 4 -flags +loop -g 30
-keyint_min 1 -bf 0 -b_strategy 0 -flags2 -wpred-dct8x8 -cmp +chroma -deblockalpha 0
-deblockbeta 0 开发者_开发技巧-refs 1 -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -
trellis 0 -coder 0 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4
-rc_eq 'blurCplx^(1-qComp)' -i inputfile.wtv -aspect 4:3 -s 240x160 -y -async 1
-f mpegts -vcodec libx264 -bufsize 128k -b 128k -bt 120k -qmax 48 -qmin 2 -r 25
-acodec libmp3lame -ab 64k -ar 44100 -ac 2 output.ts
Anybody with H264 knowledge able to speculate what might be tripped up the decoder? I'm particularly anxious to know whether it's an obvious issue with compatibility, or whether it might be something more specific to my code, e.g. a bug passing NAL frames to the native decoder.
The answer was a bug in my parsing code, so at the end of each PES, it sent an incomplete NAL unit to the decoder. So.. ..now you know what that looks like! Kudos to the MS H264 decoder for actually struggling on. C
精彩评论