Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to simply record a IP camera stream to my harddrive on Ubuntu Linaro. It works very well for 4 seconds then stops. There are no errors and playback is perfect. It seems like it is doing it intentionally. However I cannot for the life see where this file size is set. It stops after approx 280k. If I lower the stream size it just records for longer but always stops when the file is roughly 280k. If I reduce the filesize with the -fs options and can force it smaller but any value over the 280k leaves the file at 280k. Here is my output :

avconv -y -i 'rtsp://' -benchmark -loglevel debug -c copy test.mpg

Produces :

avconv version 0.8-4:0.8-1ubuntu1linaro1, Copyright (c) 2000-2011 the Libav developers
  built on Jan 26 2012 15:06:17 with gcc 4.6.1
  configuration: --extra-version='4:0.8-1ubuntu1linaro1' --arch=arm --prefix=/usr --libdir=/usr/lib/arm-linux-gnueabi --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --extra-cflags='-marm -fPIC -DPIC' --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/arm-linux-gnueabi/neon/vfp --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  libavutil    51. 21. 0 / 51. 21. 0
  libavcodec   53. 34. 0 / 53. 34. 0
  libavformat  53. 20. 0 / 53. 20. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 15. 0 /  2. 15. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  52.  0. 0 / 52.  0. 0
[rtsp @ 0x26aa0] SDP:
o=- 1343234035552520 1343234035552520 IN IP4
s=Media Presentation
t=0 0
m=video 0 RTP/AVP 96
c=IN IP4
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=420029; sprop-parameter-sets=Z0IAKeKQCgDLYC3AQEBpB4kRUA==,aM48gA==

[rtsp @ 0x26aa0] video codec set to: h264
[NULL @ 0x2a800] RTP Packetization Mode: 1
[NULL @ 0x2a800] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[NULL @ 0x2a800] Extradata set to 0x2ad80 (size: 29)!hello state=0
[h264 @ 0x2a800] err{or,}_recognition separate: 1; 1
[h264 @ 0x2a800] err{or,}_recognition combined: 1; 1
[h264 @ 0x2a800] Unsupported bit depth: 0
[rtsp @ 0x26aa0] All info found
[rtsp @ 0x26aa0] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://':
    title           : Media Presentation
  Duration: N/A, start: 0.039989, bitrate: N/A
    Stream #0.0, 22, 1/90000: Video: h264 (Baseline), yuvj420p, 1280x800 [PAR 1:1 DAR 8:5], 1/180000, 90k tbr, 90k tbn, 180k tbc
[mpeg @ 0x2fac0] VBV buffer size not set, muxing may fail
Output #0, mpeg, to 'test.mpg':
    title           : Media Presentation
    encoder         : Lavf53.20.0
    Stream #0.0, 0, 1/90000: Video: [0][0][0][0] / 0x0000, yuvj420p, 1280x800 [PAR 1:1 DAR 8:5], 1/90000, q=2-31, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press ctrl-c to stop encoding
Received BYE for stream 0 (1/1)=     208kB time=1.36 bitrate=1252.6kbits/s    
frame=   49 fps= 49 q=-1.0 Lsize=     286kB time=1.88 bitrate=1245.9kbits/s    
video:283kB audio:0kB global headers:0kB muxing overhead 0.902341%

Thank you in advance.

share|improve this question
It looks like the stream may be stopping you. avconv says "Received BYE for stream 0" near the end. Is there any chance the stream you are trying to capture is cutting off after a certain amount of data? – Travis G. Jan 25 '13 at 7:32

Try running the following command:

avconv -rtsp_transport tcp -i

This works for me.

share|improve this answer
OP really should mark this one as the answer, as this resolved my problem – Antony Jan 5 '15 at 1:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.