0

while trying to record RTSP stream, I noticed that ffmpeg only records up to 30 seconds, and then it just simply freezes I pressure Ctrl + C to terminate. I am running ffmpeg version 2.5.2

antony@medina:~$ ffmpeg -i rtsp://192.168.0.112:554/11 -vcodec copy ~/test.mp4
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 25 2014 00:04:42 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libpulse --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.0.112:554/11':
  Metadata:
    title           : \11
  Duration: N/A, start: 0.039900, bitrate: 64 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p, 1280x720, 25.08 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
Output #0, mp4, to '/home/antony/test.mp4':
  Metadata:
    title           : \11
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=2-31, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 8000 Hz, mono, s16, 17 kb/s
    Metadata:
      encoder         : Lavc56.13.100 libfdk_aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[mp4 @ 0x343c1e0] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[NULL @ 0x31cf840] RTP: missed 8 packetskB time=00:00:02.59 bitrate=1084.8kbits/s    
^Cav_interleaved_write_frame(): Immediate exit requested.56 bitrate=1492.1kbits/s    
frame=  751 fps=9.5 q=-1.0 Lsize=    5415kB time=00:00:29.88 bitrate=1484.3kbits/s    
video:5449kB audio:64kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Received signal 2: terminating.
0

Turns out that the following switch -rtsp_transport tcp is required

ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.112:554/11 ~/Videos/stream.mkv
  • Where is the document to specify this? Thanks! – Honghe.Wu Aug 23 '19 at 8:16
  • -rtsp_transport tcp may lead to steam stutters. Have you meet this problem? – Honghe.Wu Aug 26 '19 at 2:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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