[Ffmpeg-devel] ffmpeg/rtsp - dropped videoframes
Clemens Fischer
Clemens.Fischer
Tue Dec 5 16:21:19 CET 2006
Hi,
I'm using ffmpeg to transcode the video stream of a network camera but the
resulting video is not useable because according to the verbose output
almost all frames are dropped.
./ffmpeg-export-2006-12-05/ffmpeg -v 7 -i
"rtsp://62.99.205.199:554/flvga999.mp4" test.mpg
FFmpeg version SVN-r7222, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --enable-x264 --enable-gpl --enable-pp
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 5 2006 16:59:25, gcc: 4.1.1
[NULL @ 0x84dc878] video codec set to : mpeg4
[rtsp @ 0x844a734]hello state=0
Input #0, rtsp, from 'rtsp://62.99.205.199:554/flvga999.mp4':
Duration: 00:00:00.0, start: 0.000000, bitrate: N/A
Stream #0.0, 1/90000: Video: mpeg4, yuv420p, 640x480, 1/25, 25.00 fps(r)
File 'test.mpg' already exists. Overwrite ? [y/N] y
Output #0, mpeg, to 'test.mpg':
Stream #0.0, 1/90000: Video: mpeg1video, yuv420p, 640x480, 1/25, q=2-31,
200 kb/s, 25.00 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
*** 8 dup!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
[mpeg4 @ 0x84dc878]ac-tex damaged at 29 22
[mpeg4 @ 0x84dc878]Error at MB: 931
[mpeg4 @ 0x84dc878]concealing 387 DC, 387 AC, 387 MV errors
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!10 q=2.0 size= 62kB time=0.4 bitrate=1410.8kbits/s dup=9
drop=19
*** drop!
*** drop!
*** drop!
*** drop!
*** drop!10 q=2.0 size= 62kB time=0.4 bitrate=1410.8kbits/s dup=9
drop=24
*** drop!
frame= 11 q=2.1 Lsize= 120kB time=0.4 bitrate=2457.6kbits/s dup=9
drop=26
So I digged into the source and when if I uncomment the following code in
"static void do_video_out(.)", recompiling ffmpeg ..
/*
if(video_sync_method){
double vdelta;
vdelta = get_sync_ipts(ost) / av_q2d(enc->time_base) -
ost->sync_opts;
//FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
if (vdelta < -1.1)
nb_frames = 0;
else if (vdelta > 1.1)
nb_frames = lrintf(vdelta);
//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f
nb_frames:%d\n", vdelta, ost->sync_opts, ost->sync_ipts, nb_
if (nb_frames == 0){
++nb_frames_drop;
if (verbose>2)
fprintf(stderr, "*** drop!\n");
}else if (nb_frames > 1) {
nb_frames_dup += nb_frames;
if (verbose>2)
fprintf(stderr, "*** %d dup!\n", nb_frames-1);
}
}else
ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
*/
. and running the new ffmpeg version everything seems to be working fine .
./ffmpeg-export-2006-12-05/ffmpeg -v 7 -i
"rtsp://62.99.205.199:554/flvga999.mp4" test.mpg
FFmpeg version SVN-r7222, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --enable-x264 --enable-gpl --enable-pp
libavutil version: 49.1.0
libavcodec version: 51.25.0
libavformat version: 51.6.0
built on Dec 5 2006 16:09:44, gcc: 4.1.1
[NULL @ 0x84dc5f8] video codec set to : mpeg4
[rtsp @ 0x844a4b4]hello state=0
Input #0, rtsp, from 'rtsp://62.99.205.199:554/flvga999.mp4':
Duration: 00:00:00.0, start: 0.000000, bitrate: N/A
Stream #0.0, 1/90000: Video: mpeg4, yuv420p, 640x480, 1/25, 25.00 fps(r)
File 'test.mpg' already exists. Overwrite ? [y/N] y
Output #0, mpeg, to 'test.mpg':
Stream #0.0, 1/90000: Video: mpeg1video, yuv420p, 640x480, 1/25, q=2-31,
200 kb/s, 25.00 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
[mpeg4 @ 0x84dc5f8]ac-tex damaged at 14 22
[mpeg4 @ 0x84dc5f8]Error at MB: 916
[mpeg4 @ 0x84dc5f8]concealing 387 DC, 387 AC, 387 MV errors
[mpeg4 @ 0x84dc5f8]ac-tex damaged at 7 24
[mpeg4 @ 0x84dc5f8]Error at MB: 991
[mpeg4 @ 0x84dc5f8]concealing 317 DC, 317 AC, 317 MV errors
frame= 395 q=31.0 Lsize= 784kB time=15.8 bitrate= 407.5kbits/s dup=0
drop=0
video:778kB audio:0kB global headers:0kB muxing overhead 0.760837%
. the question is now where the problem could be located (rtsp stream, sdp
and/or ffmpeg). For the moment I totally lost because I have no idea how to
fix this problem but maybe you could provide me some hint(s), because with
VLC and realplayer everything works pretty well.
Regards
// Clemens
PS: Maybe the SDP is useful too .
sdp=v=0
o=- 1476600421 1165507137 IN IP4 62.99.205.199
s=flqvga999.mp4
u=<No Url>
e=<No Email>
c=IN IP4 0.0.0.0
t=0 0
a=control:rtsp://62.99.205.199/flqvga999.mp4
a=range:npt=0.000000-
m=video 0 RTP/AVP 97
b=AS:999
a=range:npt=0.000000-
a=rtpmap:97 MP4V-ES/1000
a=control:rtsp://62.99.205.199/flqvga999.mp4/trackID=11
a=control:trackID=11
a=fmtp:97
profile-level-id=3;config=000001B003000001B50900000100000001200084400668A021
E0A21F
More information about the ffmpeg-devel
mailing list