0

I have completely revised this on May 21, 2018, to reflect my latest attempts to use ffmpeg to create a live, h264, 10 fps, 960x540 video-only stream using rtsp tunneled over http via a named pipe to work. I seem to be making progress but I'm still having problems.

Evidently, client software cannot access ffmpeg to view a stream. This was not obvious to me. So one has to also use ffserver (now discontinued ?) or equivalent to do that. Therefore I set up ffserver and my best guess at ffserver.conf. That solved one problem in ffmpeg -- Connection Refused -- but I'm still getting errors in ffmpeg about the video stream. I now have ffserver running on the same machine as ffmpeg.

Here's my latest command:

ffmpeg -loglevel verbose -r 10 -i /home/vout1 -r 10 -c copy -f rtsp -rtsp_flags prefer_tcp -rtsp_transport tcp http://127.0.0.1:8090/feed1.ffm

I used to use localhost but that doesn't work in either ffmpeg or ffserver, so I use 127.0.0.1.

Here's the entire response I get from ffmpeg:

ffmpeg version 3.2.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.1 (Debian 5.4.1-5) 20170205 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libxvid

libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100

[h264 @ 0x29700f0] Reinit context to 960x544, pix_fmt: yuv420p [h264 @ 0x296f050] max_analyze_duration 5000000 reached at 5000000 microseconds st:0

Input #0, h264, from '/home/vout1': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 960x540 (960x544), 25 fps, 25 tbr, 1200k tbn, 50 tbc

Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing inputStream mapping: Stream #0:0 -> #0:0 (copy) Last message repeated 1 times

Note: (1) It says my stream is 25 fps but it's 10 (I used -r 10 in the command); (2) it says cannot write header; (3) it says only one reference frame but they occur every 50 frames, (4) it says invalid data found, (5) it says Reinit context to 960x544 (the stream is 960x540).

Also, I'm not sure how to declare the video-only h264 stream in ffserver.conf. I'm using Format mpeg. I only want it copied not transcoded or scaled.

How do I fix this ?

  • Your output is being re-encoded ... to MPEG-4 Part-2 and AAC. Add -c copy to avoid that. – Gyan May 16 '18 at 6:38
  • I made the change you suggested, thank you, but it's still not working. I modified the original post with the new information. I also tried -vcodec copy, but it did not help. – NewtownGuy May 17 '18 at 16:49
  • rtsp transport should be tcp or udp. – Gyan May 17 '18 at 16:57
  • I changed the command to: ffmpeg -loglevel verbose -r 10 -i /home/vout1 -r 10 -c copy -f rtsp -rtsp_flags prefer_tcp -rtsp_transport tcp 127.0.0.1:8100 – NewtownGuy May 17 '18 at 17:14
  • I completely edited the post to reflect my latest attempts to get this to work but I'm still having problems. Please help. Thank you. – NewtownGuy May 21 '18 at 19:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.