[FFmpeg-user] Trying to stream rtsp camera to youtube's rtmp

wim delvaux wim.delvaux at adaptiveplanet.com
Mon Jun 9 20:57:04 CEST 2014


 Hi all,

I have been struggling to get this operational but to no avail

What works :

I am able to stream a regular file to youtube over rtmp using :

ffmpeg -i SomeFile.avi -ar 44100 -acodec pcm_s16le -f s16le -ac 2 -i <(dd
if=/dev/zero bs=$((44100 * 2 * 2)) count=1000000) -vcodec libx264 -preset
veryfast -maxrate 3000k
  -bufsize 6000k -pix_fmt yuv420p -g 50 -acodec libmp3lame -b:a 128k -ac 2
  -ar 44100 -f flv rtmp://
x.rtmp.youtube.com/live2/wrl.delvaux.k12w-976d-6g7p-0byr

I am also able to view the content of my camera like so :

ffplay rtsp://192.168.99.13/stream1

I am also able to dump the stream of my cam to a raw file and play that
file like (produces output at about 800 kbps)

ffmpeg -i rtsp://192.168.99.13/stream1 -vcodec copy -acodec copy test.avi

I can play the produced content like :

vlc test.avi
or
ffplay test.avi

However I am unable to combine both actions in one command

ffmpeg -i rtsp://192.168.99.13/stream1 -vcodec copy -acodec pcm_s16le -f
s16le -ac 2 -ar 44100  -f flv rtmp://
x.rtmp.youtube.com/live2/wrl.delvaux.k12w-976d-6g7p-0byr


   ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
     built on Feb 25 2014 08:24:47 with gcc 4.8.2 (GCC) 20131212 (Red Hat
   4.8.2-7)
     configuration: --prefix=/usr --bindir=/usr/bin
   --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg
   --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2
   -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
   -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
   -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r
   --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt
   --enable-libdc1394 --disable-indev=jack --enable-libfreetype
   --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv
   --enable-libopenjpeg --enable-libopus --enable-libpulse
   --enable-libschroedinger --enable-libsoxr --enable-libspeex
   --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx
   --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter
   --enable-avresample --enable-postproc --enable-pthreads --disable-static
   --enable-shared --enable-gpl --disable-debug --disable-stripping
   --shlibdir=/usr/lib64 --enable-runtime-cpudetect
     libavutil      52. 48.101 / 52. 48.101
     libavcodec     55. 39.101 / 55. 39.101
     libavformat    55. 19.104 / 55. 19.104
     libavdevice    55.  5.100 / 55.  5.100
     libavfilter     3. 90.100 /  3. 90.100
     libavresample   1.  1.  0 /  1.  1.  0
     libswscale      2.  5.101 /  2.  5.101
     libswresample   0. 17.104 /  0. 17.104
     libpostproc    52.  3.100 / 52.  3.100
   [h264 @ 0x14c2540] Overread VUI by 8 bits
   [h264 @ 0x14c2540] Truncated VUI
   Guessed Channel Layout for  Input Stream #0.1 : mono
   Input #0, rtsp, from 'rtsp://192.168.99.13/stream1':
     Metadata:
       title           : RTSP/RTP stream
       comment         : stream1
     Duration: N/A, start: 0.072044, bitrate: 64 kb/s
       Stream #0:0: Video: h264 (Main), yuvj420p(pc), 1920x1080 [SAR 1:1
   DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc
       Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
   Output #0, flv, to 'rtmp://
   x.rtmp.youtube.com/live2/wrl.delvaux.q324-jza0-vk07-2cb6':
     Metadata:
       title           : RTSP/RTP stream
       comment         : stream1
       encoder         : Lavf55.19.104
       Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuvj420p,
   1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 15 fps, 1k tbn, 90k tbc
       Stream #0:1: Audio: pcm_s16le ([3][0][0][0] / 0x0003), 44100 Hz,
   stereo, s16, 1411 kb/s
   Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (pcm_mulaw -> pcm_s16le)
   Press [q] to stop, [?] for help
   [flv @ 0x14c47e0] Non-monotonous DTS in output stream 0:0; previous: 0,
   current: -53; changing to 0. This may result in incorrect timestamps in the
   output file.
   [flv @ 0x14c47e0] Non-monotonous DTS in output stream 0:0; previous: 0,
   current: -34; changing to 0. This may result in incorrect timestamps in the
   output file.
   [flv @ 0x14c47e0] Non-monotonous DTS in output stream 0:0; previous: 0,
   current: -13; changing to 0. This may result in incorrect timestamps in the
   output file.
   [flv @ 0x14c47e0] Failed to update header with correct duration.ate=
   0.2kbits/s
   [flv @ 0x14c47e0] Failed to update header with correct filesize.
   frame=  424 fps= 26 q=-1.0 Lsize=    1716kB time=00:00:16.55 bitrate=
   849.0kbits/s
   video:1707kB audio:0kB subtitle:0 global headers:0kB muxing overhead
   0.511410%
   Received signal 2: terminating.

   HELP !!!


More information about the ffmpeg-user mailing list