[FFmpeg-devel] More than one HTTP inputs block

Subrata Sa kiteflyer77
Mon Jul 16 11:03:57 CEST 2007


Hi,

I'm trying to fetch mp4 file from HTTP server and send its audio and
video to separate RTP destinations as given below:

Input #0 from http://srcurl/sample.mp4
 Stream #0.0: Video: vcodec1
 Stream #0.1: Audio: acodec1

Input #1 from http://srcurl/sample.mp4 [same URL]
 Stream #1.0: Video: vcodec1
 Stream #1.1: Audio: acodec1

Output #0, rtp, to 'rtp://dsturl:6970
  Stream #0.0: Video: vcodec2

Output #1, rtp, to 'rtp://dsturl:6980 [different port]
  Stream #1.0: Audio: acodec2
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #1.1 -> #1.0

For "-an" and "-vn" options handling, I'm using this patch:
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-April/027693.html.
While similar thing works fine if the file source is disk, in the
above case, ffmpeg blocks at reading HTTP Input #1 and then unblocks
after a long time. Ethreal shows that TCP buffer at ffmpeg side gets
full and it keeps on sending zero window size till it manages to help
itself. Here is output of ffmpeg run:

[subrata at kansabati mplayerhq]$ ./ffmpeg -re -f mp4 -i
http://192.168.50.7/Video/gm.mp4 -vcodec mpeg4 -an -r 10 -b 38.8kb -s
qcif -f rtp rtp://192.168.50.7:6970?localport=5004 -f mp4 -i
http://192.168.50.7/Video/gm.mp4 -vn -acodec libamr_nb -ac 1 -ar 8000
-ab 12.2kb -f rtp rtp://192.168.50.7:6980?localport=5014 2>&1 | tee
ffmpeg_log.txt
FFmpeg version SVN-r9453, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --enable-pthreads --enable-libamr-nb --enable-gpl
--enable-libfaad
  libavutil version: 49.4.1
  libavcodec version: 51.40.4
  libavformat version: 51.12.1
  built on Jul  6 2007 17:17:03, gcc: 3.4.4 20050721 (Red Hat 3.4.4-2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://192.168.50.7/Video/gm.mp4':
  Duration: 00:00:17.4, start: 0.000000, bitrate: 85 kb/s
  Stream #0.0(und): Video: mpeg4, yuv420p, 160x120, 25.00 fps(r)
  Stream #0.1(und): Audio: libamr_nb, 8000 Hz, mono
[blocks here. <CTRL-C>]
[subrata at kansabati mplayerhq]$

I added function entry/ exit logs (av_log) to functions in
libavformat/*.c files to see the function call stack. Here is the log
at the end showing TCP read blocking:
Above mentioned ffmpeg run with -v 100 param:
...
entering aviobuf.c:url_ftell
entering aviobuf.c:url_fseek
exiting 2 aviobuf.c:url_fseek
exiting aviobuf.c:url_ftell
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8323c00]ISO: File Type Major Brand: isom
entering aviobuf.c:url_fskip
entering aviobuf.c:url_fseek
exiting 4 aviobuf.c:url_fseek
exiting aviobuf.c:url_fskip
entering aviobuf.c:url_ftell
entering aviobuf.c:url_fseek
exiting 2 aviobuf.c:url_fseek
exiting aviobuf.c:url_ftell
entering aviobuf.c:url_feof
entering aviobuf.c:url_fskip
entering aviobuf.c:url_fseek
exiting 2 aviobuf.c:url_fseek
exiting aviobuf.c:url_fskip
entering aviobuf.c:url_feof
entering aviobuf.c:url_ftell
entering aviobuf.c:url_fseek
exiting 2 aviobuf.c:url_fseek
exiting aviobuf.c:url_ftell
entering aviobuf.c:url_fskip
entering aviobuf.c:url_fseek
entering aviobuf.c:url_seek_packet
entering avio.c:url_seek
entering http.c:http_seek
entering http.c:http_open_cnx
entering avio.c:url_open
entering tcp.c:tcp_open
exiting tcp.c:tcp_open
exiting 2 avio.c:url_open
entering http.c:http_connect
entering avio.c:url_write
entering tcp.c:tcp_write
exiting tcp.c:tcp_write
exiting avio.c:url_write
entering avio.c:url_read
entering tcp.c:tcp_read

---
Sorry for the long explanation. Am I missing something here? Any hint
is welcome.

Regards,
Subrata Sa




More information about the ffmpeg-devel mailing list