Hey Alex and Huy, As I coded last night a lot, but still got no nice pictures from my stream I searched in the ffmpeg documentation and I have found an interesting part in ffmpeg:
av_parser_parse2() -> http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/avcodec_8h.html#691ca0258e91f99297e7726f56d8c247 There is also a little example how to use it and some description, which is a rare case in ffmpeg-documentation ;-) I think it's ment to be there, just for what we are trying. Maybe you use it already and I didn't know. But for h264 it should parse the incoming buffer and let us get complete frames into an outputbuffer, which could be sent to the decoding process. I have read in an older post about it, that you should send the h264 bitstream through the parser before decoding it. The av_parser_parse2() - call will send some information to the AVCodecContext which is important to decode H264. related stuff: av_parser_parse2() -> AVCodecParserContext -> http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/structAVCodecParserContext.html AVCodecParser -> http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/structAVCodecParser.html AVCodecContext I'm just trying to implement this. On success I post the code here! If you already knrew this, have you tried out? I think, I can't be totally wrong. cheers sven 2010/9/20 Sven Wasmer <[email protected]>: > Hi Huy, > > thanks for the example picture and the link to the viewer. It's very > clear to me now. I used the "JM reference encoder" from Heinrich Hertz > Institut (http://iphome.hhi.de/suehring/tml/), but I used a > preconfigured flag (I forgot to deactivate it), which generates > multiple PPS and with your mentioned viewer I can see a structure of > SPS, PPS, PPS, PPS, IDR (only 1 slice!). Thus 3 different PPS with > different IDs in a row, that MIGHT confuse ffmpeg, if it expects the > IDR right after the first PPS, but I'm not sure about that. I reencode > and go on with your suggested method ([785] ...) > > cheers > Sven > > 2010/9/20 Huy Tran <[email protected]>: >> Hi Alex and Sven, >> >> I sent to you an image about the H.264 AnnexB payload format (file format). >> >> >> http://img13.imageshack.us/img13/7995/h264d.jpg >> >> I create this bitstream by using x264: * x264.exe --slices 4 -o output.264 >> input.yuv 1920x1080* >> My bitstream has 5 frames and each frame has 4 slices. Thus I have total 20 >> slices. >> I use "H.264 Video ES Viewer" to check the length, starcode, nal_unit_type >> and so on. >> >> To decode this bitstream in FFmpeg, you have to collect 4 slices data of a >> whole frame before passing it to avcodec_decode_video. >> You also have to calculate exactly the length of each slices, FFmpeg need it >> to decode H.264. >> >> Hope it helps. >> Huy. >> _______________________________________________ >> libav-user mailing list >> [email protected] >> https://lists.mplayerhq.hu/mailman/listinfo/libav-user >> > _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
