I have figured out why I got the invalid error. Since I copy and pasted the command from a site it had a hyphen rather than an English dash. After changing the command to this I got a new error message.
#ffmpeg -rtsp_transport tcp -i rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1 -vcodec libx264 -vprofile baseline -g 10 -acodec libfaac -ar 44100 -ac 1 -c copy -f flv rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name;
ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --prefix=/opt/kaltura/ffmpeg-3.2 --libdir=/opt/kaltura/ffmpeg-3.2/lib --shlibdir=/opt/kaltura/ffmpeg-3.2/lib --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC -I/opt/kaltura/include' --extra-ldflags=-L/opt/kaltura/lib --disable-devices --enable-bzlib --enable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-avisynth --enable-libxvid --enable-filter=movie --enable-avfilter --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libvpx --enable-libspeex --enable-libass --enable-postproc --enable-pthreads --enable-static --enable-shared --enable-gpl --disable-debug --disable-optimizations --enable-gpl --enable-pthreads --enable-swscale --enable-vdpau --enable-bzlib --disable-devices --enable-filter=movie --enable-version3 --enable-indev=lavfi --enable-x11grab
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.100 / 57. 64.100
libavformat 57. 56.100 / 57. 56.100
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
Input #0, rtsp, from 'rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.033367, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, smpte170m/smpte170m/bt709, progressive), 704x480 [SAR 10:11 DAR 4:3], 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
Output #0, flv, to 'rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name':
Metadata:
title : Media Presentation
encoder : Lavf57.56.100
Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuvj420p(pc, smpte170m/smpte170m/bt709, progressive), 704x480 [SAR 10:11 DAR 4:3], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[flv @ 0x2209a00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
av_interleaved_write_frame(): Broken pipe
Error writing trailer of rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name: Broken pipeframe= 1 fps=0.0 q=-1.0 Lsize= 10kB time=00:00:00.00 bitrate=79280.0kbits/s speed=4.27x
video:9kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.068123%
Conversion failed!
I also re-ran the command with a the ‘-v debug’ option and got this:
#ffmpeg -v debug -rtsp_transport tcp -i rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1 -vcodec libx264 -vprofile baseline -g 10 -acodec libfaac -ar 44100 -ac 1 -c copy -f flv rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name;
ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --prefix=/opt/kaltura/ffmpeg-3.2 --libdir=/opt/kaltura/ffmpeg-3.2/lib --shlibdir=/opt/kaltura/ffmpeg-3.2/lib --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPICall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC -I/opt/kaltura/include' --extra-ldflags=-L/opt/kaltura/lib --disable-devices --enable-bzlib --enable-libgsm --enable-libmp3lame --enable-libschroedinger --es --enable-libx264 --enable-libx265 --enable-avisynth --enable-libxvid --enable-filter=movie --enable-avfilter --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libvpx --enable-libspeex --enable-libass --enable-postproc --enable-pthrred --enable-gpl --disable-debug --disable-optimizations --enable-gpl --enable-pthreads --enable-swscale --enable-vdpau --enable-bzlib --disable-devices --enable-filter=movie --enable-version3 --enable-indev=lavfi --enable-x11grab
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.100 / 57. 64.100
libavformat 57. 56.100 / 57. 56.100
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
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input file with argument 'rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '2'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '25'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '1280x720'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'.
Reading option '-vprofile' ... matched as AVOption 'vprofile' with argument 'baseline'.
Reading option '-g' ... matched as AVOption 'g' with argument '10'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libfaac'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '44100'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1.
Successfully parsed a group of options.
Opening an input file: rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1.
[tcp @ 0x23effc0] No default whitelist set
[rtsp @ 0x23edf60] SDP:
v=0
o=- 1147797149021282 1147797149021282 IN IP4 50.242.199.138
s=Media Presentation
e=NONE
b=AS:50000
t=0 0
a=control:rtsp://HOST-IP:PORT/axis-media/media.amp?camera=1 a=range:npt=0.000000-
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:50000
a=framerate:30.0
a=transform:1.000000,0.000000,0.000000;0.000000,0.909091,0.000000;0.000000,0.000000,1.000000
a=control:rtsp://HOST-IP:PORT/axis-media/media.amp/trackID=1?camera=1
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=4D0029; sprop-parameter-sets=Z00AKeKQFge2BqwYBBuHiRFQ,aO48gA==
Failed to parse interval end specification ''
[rtsp @ 0x23edf60] video codec set to: h264
[rtsp @ 0x23edf60] RTP Packetization Mode: 1
[rtsp @ 0x23edf60] RTP Profile IDC: 4d Profile IOP: 0 Level: 29
[rtsp @ 0x23edf60] Extradata set to 0x23f03d0 (size: 30)
[rtsp @ 0x23edf60] setting jitter buffer size to 0
[rtsp @ 0x23edf60] hello state=0
Failed to parse interval end specification ''
[h264 @ 0x23f1760] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x23f1760] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x23f1760] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x23f1760] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x23f1760] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x23f1760] Reinit context to 704x480, pix_fmt: yuvj420p
[h264 @ 0x23f1760] nal_unit_type: 1, nal_ref_idc: 2
Last message repeated 5 times
[rtsp @ 0x23edf60] All info found
[rtsp @ 0x23edf60] rfps: 29.250000 0.019163
[rtsp @ 0x23edf60] rfps: 29.333333 0.014981
[rtsp @ 0x23edf60] rfps: 29.416667 0.011313
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.500000 0.008159
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.583333 0.005520
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.666667 0.003394
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.750000 0.001783
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.833333 0.000686
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.916667 0.000103
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 30.000000 0.000035
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 60.000000 0.000138
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 120.000000 0.000553
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 240.000000 0.002210
Last message repeated 1 times
[rtsp @ 0x23edf60] rfps: 29.970030 0.000000
[rtsp @ 0x23edf60] rfps: 59.940060 0.000000
[rtsp @ 0x23edf60] Setting avg frame rate based on r frame rate
Input #0, rtsp, from 'rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.033378, bitrate: N/A
Stream #0:0, 28, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, smpte170m/smpte170m/bt709, progressive, left), 704x480 [SAR 10:11 DAR 4:3], 0/1, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
Successfully opened the file.
Parsing a group of options: output file rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 25.
Applying option s (set frame size (WxH or abbreviation)) with argument 1280x720.
Applying option an (disable audio) with argument 1.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument libx264.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument libfaac.
Applying option ar (set audio sampling rate (in Hz)) with argument 44100.
Applying option ac (set number of audio channels) with argument 1.
Applying option c (codec name) with argument copy.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name.
[rtmp @ 0x2516f00] No default whitelist set
[tcp @ 0x23f0740] No default whitelist set
[rtmp @ 0x2516f00] Handshaking...
[rtmp @ 0x2516f00] Type answer 3
[rtmp @ 0x2516f00] Server version 13.14.10.13
[rtmp @ 0x2516f00] Proto = rtmp, path = /kLive/stream_name, app = kLive, fname = stream_name
[rtmp @ 0x2516f00] Server bandwidth = 5000000
[rtmp @ 0x2516f00] Client bandwidth = 5000000
[rtmp @ 0x2516f00] New incoming chunk size = 4096
[rtmp @ 0x2516f00] Releasing stream...
[rtmp @ 0x2516f00] FCPublish stream...
[rtmp @ 0x2516f00] Creating stream...
[rtmp @ 0x2516f00] Sending publish command for 'stream_name'
Successfully opened the file.
Output #0, flv, to 'rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name':
Metadata:
title : Media Presentation
encoder : Lavf57.56.100
Stream #0:0, 0, 1/1000: Video: h264 (Main), 1 reference frame ([7][0][0][0] / 0x0007), yuvj420p(pc, smpte170m/smpte170m/bt709, progressive, left), 704x480 (0x0) [SAR 10:11 DAR 4:3], 0/1, q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[flv @ 0x251a4e0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
av_interleaved_write_frame(): Broken pipe
No more output streams to write to, finishing.
Error writing trailer of rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name: Broken pipeframe= 1 fps=0.0 q=-1.0 Lsize= 9kB time=00:00:00.00 bitrate=75080.0kbits/s speed=3.68x
video:9kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.245325%
Input file #0 (rtsp://usr_name:usr_pswd@HOST-IP:PORT/axis-media/media.amp?camera=1):
Input stream #0:0 (video): 1 packets read (9090 bytes);
Total: 1 packets (9090 bytes) demuxed
Output file #0 (rtmp://NGINX_HOST:NGINX_PORT/kLive/stream_name):
Output stream #0:0 (video): 1 packets muxed (9090 bytes);
Total: 1 packets (9090 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x24a0b20] Statistics: 0 seeks, 2 writeouts
[rtmp @ 0x2516f00] UnPublishing stream...
[rtmp @ 0x2516f00] Deleting stream...
Conversion failed!
My specific errors would need to be fixed by updating the configuration at time of compiling of ffmpeg to resolve both issues. Specifically, the timestamp issue and issue with the error writing trailer. If these issues are resolved then I add all my IP camera RSTP streams to the NGINX configuration file and pull them into NGINX to hand off to Kaltura CE for streaming without using Wowza.