iphone - Getting artifacts when trying to read video stream from YouTube -


i'm trying read video frames rtsp stream youtube. here link test video:

rtsp://v8.cache5.c.youtube.com/ciileny73wiagqkjlrxmiag8bxmydsanfeggugz2awrlb3mm/0/0/0/video.3gp

if i'm reading frames local file - fine, when read them stream nothing lots of artifacts. i've googled around , found out there might problem udp packets , switching tcp may can't find possible change this.

here function reading frame:

bool nextframe(avformatcontext *pformatctx, avcodeccontext *pcodecctx, int videostream, avframe *pframe) {  avpacket packet;     int framefinished = 0;      while( !framefinished && av_read_frame(pformatctx, &packet) >= 0 ) {         // packet video stream?         if( packet.stream_index == videostream ) {             // decode video frame             avcodec_decode_video2(pcodecctx, pframe, &framefinished, &packet);         }          // free packet allocated av_read_frame         av_free_packet(&packet);            }            return framefinished!=0;   } 

i'm getting lots of error messages in log:

[h263 @ 0x7804c00] warning: first frame no keyframe [h263 @ 0x7804c00] illegal ac vlc code @ 6x1 [h263 @ 0x7804c00] error @ mb: 18 [h263 @ 0x7804c00] concealing 99 dc, 99 ac, 99 mv errors [h263 @ 0x7804c00] cbpy damaged @ 10 4 [h263 @ 0x7804c00] error @ mb: 58 [h263 @ 0x7804c00] concealing 99 dc, 99 ac, 99 mv errors [h263 @ 0x7804c00] cbpy damaged @ 6 6 [h263 @ 0x7804c00] error @ mb: 78 [h263 @ 0x7804c00] concealing 76 dc, 76 ac, 76 mv errors [h263 @ 0x7804c00] cbpy damaged @ 5 5 [h263 @ 0x7804c00] error @ mb: 65 [h263 @ 0x7804c00] concealing 88 dc, 88 ac, 88 mv errors [h263 @ 0x7804c00] illegal ac vlc code @ 7x5 [h263 @ 0x7804c00] error @ mb: 67 [h263 @ 0x7804c00] concealing 86 dc, 86 ac, 86 mv errors 

...and on

edit: 99.9% udp-tcp problem. i've found link:

rtsp://195.200.199.8/mpeg4/media.amp

this test camera available online. streams artifacts. if has parameter 'tcp' , if use

rtsp://195.200.199.8/mpeg4/media.amp?tcp

everything works without artifacts.

so correct question: there way force youtube or ffmpeg use tcp ?

the transport protocol property of ip socket request. such, can have same url (and ip:port) on both tcp , udp transports. means client open tcp port rather udp port.

this selected when create socket.

sock = socket(pf_inet, sock_stream, ipproto_tcp) 

or

sock = socket(pf_inet, sock_stream, ipproto_udp) 

now, have no clue ffmpeg this, surely above can give clue on how find out.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -