Problem streaming ffmpeg output to rtmp. RTMP_ReadPacket, failed to read RTMP packet header

I can stream udp but not rtmp.

Here is my command and output:

./ffmpeg -re -i “sample.mp4” -vcodec copy -acodec copy -f flv rtmp://localhost:1935/live/stream ffmpeg version N-45279-g1a104bf Copyright © 2000-2012 the FFmpeg developers built on Oct 10 2012 19:23:23 with gcc 4.7.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 74.100 / 51. 74.100 libavcodec 54. 65.100 / 54. 65.100 libavformat 54. 31.100 / 54. 31.100 libavdevice 54. 3.100 / 54. 3.100 libavfilter 3. 19.102 / 3. 19.102 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 16.100 / 0. 16.100 libpostproc 52. 1.100 / 52. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘sample.mp4’: Metadata: major_brand : qt minor_version : 512 compatible_brands: qt creation_time : 1970-01-01 00:00:00 encoder : Lavf52.73.0 Duration: 00:09:56.45, start: 0.000000, bitrate: 524 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 424x240, 420 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : DataHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 99 kb/s Metadata: creation_time : 1970-01-01 00:00:00 handler_name : DataHandler RTMP_ReadPacket, failed to read RTMP packet header rtmp://localhost:1935/live/stream: Unknown error occurred

Here is the output in the access log:

2018-01-0508:25:05CSTconnect-pendingsessionINFO100127.0.0.1-_defaultVHost_live_definst_0.0[any]1935rtmp://localhost:1935/live127.0.0.1rtmp-unknown38028502331753073-------------rtmp://localhost:1935/live- 2018-01-0508:25:05CSTconnectsessionINFO200127.0.0.1-_defaultVHost_live_definst_0.001[any]1935rtmp://localhost:1935/live127.0.0.1rtmp-unknown38028502331753073-------------rtmp://localhost:1935/live- 2018-01-0508:25:05CSTcreatestreamINFO200–_defaultVHost_live_definst_0.001[any]1935rtmp://localhost:1935/live127.0.0.1rtmp-unknown380285023329034131000------rtmp://localhost:1935/livertmp://localhost:1935/live-rtmp://localhost:1935/live- 2018-01-0508:25:05CSTdestroystreamINFO200–_defaultVHost_live_definst_0.002[any]1935rtmp://localhost:1935/live127.0.0.1rtmp-unknown380285023333837941000------rtmp://localhost:1935/livertmp://localhost:1935/live-rtmp://localhost:1935/live- 2018-01-0508:25:05CSTdisconnectsessionINFO200380285023-_defaultVHost_live_definst_0.004[any]1935rtmp://localhost:1935/live127.0.0.1rtmp-unknown38028502333383794-------------rtmp://localhost:1935/live- 2018-01-0508:26:05CSTapp-stopapplicationINFO200_definst_live/definst—61263.418-------------------------

You need to either disable source authentication or add a username and password. More information regarding source security can be found in our article below.

https://www.wowza.com/docs/how-to-configure-security-using-wowza-streaming-engine-manager

./ffmpeg -re -i "sample.mp4" -codec copy -f flv "rtmp://localhost:1935/live/streamflashver=FMLE/3.0\20(compatible;\20FMSc/1.0) live=true pubUser=username pubPasswd=password"

Thanks. That works