[FFmpeg-user] RTMP WriteN error using NVENC while libx264 works fine
Matthew Shapiro
me at mshapiro.net
Wed Dec 9 16:51:44 CET 2015
I am trying to run some transcoding tests to figure out how well ffmpeg
works on some GPU servers we have.
>From my desktop I am sending up an RTMP stream via OBS to a media server
system we have running. I then started ffmpeg with arguments to pull that
feed from the media server and push it back to a different ingestion point
on that server. So for example with libx264 I am invoking it with the
following:
ffmpeg -loglevel verbose -i "rtmp://server/live/matt-input live=1" -vcodec
libx264 -ar 44100 -f flv "rtmp://server/live/matt-test1"
This is meant as a bare bones basic test without doing any meaningful
conversion, and it works perfectly. I"m able to subscribe to
rtmp://server/live/matt-test1 and see my vide out.
However, when I change libx264 to nvec:
ffmpeg -loglevel verbose -i "rtmp://server/live/matt-input live=1" -vcodec
nvenc -ar 44100 -f flv "rtmp://server/live/matt-test1"
After about 70-90 frames it gives me WriteN, RTMP send error 104 (136
bytes). The metadata that ffmpeg sees from this video is:
Metadata:
Server NGINX RTMP (github.com/arut/nginx-rtmp-module)
width 1920.00
height 1080.00
displayWidth 1920.00
displayHeight 1080.00
duration 0.00
framerate 30.00
fps 30.00
videodatarate 0.00
videocodecid 0.00
audiodatarate 0.00
audiocodecid 0.00
profile
level
Input #0, live_flv, from 'rtmp://server/live/matt-input live=1':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 1920
displayHeight : 1080
fps : 30
profile :
level :
Duration: 00:00:00.00, start: 4.736000, bitrate: N/A
Stream #0:0: Video: h264 (High), 3 reference frames, yuv420p(tv,
bt709/bt709/iec61966-2-1), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 30.30
fps, 30 tbr, 1k tbn, 60 tbc
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
It appears that NVENC has some incompatibility when it comes to rtmp that
libx264 does not have. It's also interesting to note that if I use ffmpeg
to encode the big buck bunny video and send it up to
rtmp://server/live/matt-input, then I am able to successfully use NVENC to
pull down the video and push it back up no problem. For reference, the BBB
video is seen by FFMPEG as:
Metadata:
Server NGINX RTMP (github.com/arut/nginx-rtmp-module)
width 1920.00
height 1080.00
displayWidth 1920.00
displayHeight 1080.00
duration 0.00
framerate 60.00
fps 60.00
videodatarate 0.00
videocodecid 7.00
audiodatarate 125.00
audiocodecid 1.00
profile
level
Input #0, live_flv, from 'rtmp://server/live/matt-input live=1':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 1920
displayHeight : 1080
fps : 60
profile :
level :
Duration: 00:00:00.00, start: 1.950000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(tv), 1920x1080 [SAR 1:1 DAR
16:9], 62.50 fps, 60 tbr, 1k tbn, 120 tbc
Stream #0:1: Audio: adpcm_swf, 44100 Hz, stereo, s16, 352 kb/s
Also, if needed I compiled FFMPEG using the instructions from
http://developer.download.nvidia.com/compute/redist/ffmpeg/1511-patch/FFMPEG-with-NVIDIA-Acceleration-on-Ubuntu_UG_v01.pdf,
and the beginning of the ffmpeg output looks like:
# ffmpeg -i "rtmp://server/live/matt-input live=1" -vcodec nvenc -ar 44100
-f flv "rtmp://server/live/matt-test1"
ffmpeg version N-76538-gb83c849 Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --enable-nonfree --enable-nvenc --enable-nvresize
--extra-cflags=-I../cudautils --extra-ldflags=-L../cudautils --enable-gpl
--enable-libx264 --enable-librtmp
libavutil 55. 5.100 / 55. 5.100
libavcodec 57. 15.100 / 57. 15.100
libavformat 57. 14.100 / 57. 14.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 15.100 / 6. 15.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
I have tried changing my OBS settings one at a time (both multi-platform
and non-multiplatform versions) to no avail. Pulling from other streams
seems to cause the same thing to happen, and the only stream I've been able
to pull, transcode, then re-push via RTMP (via NVENC) seems to be one that
originates straight from FFMPEG
Does anyone have any suggestions on what might be wrong? Is there
something on my end that is causing rtmp to fail or is it a bug in the
NVENC encoder?
More information about the ffmpeg-user
mailing list