Forum

Post a new question

Categories:

Tags:

use ffmpeg

Alfredo 2017-10-13 22:26:53 UTC in Nimble Streamer
81741b1504d613bc4f287e7313d96d2e

Hello everyone,

I want to know if I can use ffmpeg to encode my RTMP stream in various resolutions,
I know there is a coder, but it has a license.
https://wmspanel.com/transcoder
I want to know if I can use FFMPEG as encoder manually.

Thank you.

Alex Pokotilo 2017-10-15 13:54:44 UTC
B0af1cee7eb1e40dd284d9982b3aef70

Hi,
please check http://blog.wmspanel.com/2014/10/server-tasks-web-management.html

if you find key-frame alignment issues, performance issues or need support for your encoding tasks consider transcoder

Alfredo 2017-10-30 21:19:46 UTC
1eb3be8e5170e941f1cea08267e26042

How can I do that?

I'm trying to encode a live broadcast, using the following command:

ffmpeg -loglevel debug -i rtmp: //127.0.0.1: 1935 / live -vcodec libx264 -preset veryfast -b: v 2000k -maxrate 2000k -bufsize 2000k -s 480x360 -sws_flags lanczos -r 60 -acodec copy -f flv rtmp : //127.0.0.1: 1935 / live2? Rtmpauth = live: live / live

But nothing happens, the command is executed and then stopped, without errors.

Any ideas?

Thank you.

Denis Slobodskoy 2017-10-31 02:25:17 UTC
C723b4e32e1909d3d1b5519f98b586fe

Hello Alfredo.
What ffmpeg version are you using?
Could you give output of ffmpeg -version command?
There are an excessive number of extra whitespaces in your command - is it result of copy/paste or you run it as is?
Also I noticed that your source misses stream name; credentials doesn't match with application settings in Nimble and "rtmpauth" must be in lowercase. Summarizing all above, your command should looks like:
ffmpeg -i rtmp://127.0.0.1:1935/live/live -vcodec libx264 -preset veryfast -b:v 2000k -maxrate 2000k -bufsize 2000k -s 480x360 -sws_flags lanczos -r 60 -acodec copy -f flv rtmp://127.0.0.1:1935/live2?rtmpauth=live2:live2/live

If you have more questions, please use our contact form: https://wmspanel.com/help

Alfredo 2017-10-31 23:12:38 UTC
1eb3be8e5170e941f1cea08267e26042

hi Denis,
* What ffmpeg version are you using?

ffmpeg version 2.8.11

________________________________________________________________________
* Could you give output of ffmpeg -version command?

ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

* yes is it result of copy/paste jeje.

i am trying with this command:
ffmpeg -loglevel verbose -i rtmp://127.0.0.1:1935/live/live -c copy -f flv rtmp://127.0.0.1:1935/live2/live2 live=true pubUser=live2 pubPasswd=live2

... continue down

Alfredo 2017-10-31 23:14:32 UTC
1eb3be8e5170e941f1cea08267e26042

but output this log:
________________________LOG________________________________________
Parsing...
Parsed protocol: 0
Parsed host : 127.0.0.1
Parsed app : live
RTMP_Connect1, ... connected, handshaking
HandShake: Type Answer : 03
HandShake: Server Uptime : 0
HandShake: FMS Version : 10.0.0.1
HandShake: Handshaking finished....
RTMP_Connect1, handshaked
Invoking connect
HandleServerBW: server BW = 5000000
HandleClientBW: client BW = 5000000 2
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 0
HandleChangeChunkSize, received: chunk size change to 1048576
RTMP_ClientPacket, received: invoke 131 bytes
(object begin)
Property: <Name: no-name., STRING: _result>
Property: <Name: no-name., NUMBER: 1.00>
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: fmsVer, STRING: Nimble/3.3.1-1>
(object end)
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: level, STRING: status>
Property: <Name: code, STRING: NetConnection.Connect.Success>
Property: <Name: objectEncoding, NUMBER: 0.00>
(object end)
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <connect>
sending ctrl. type: 0x0003
Invoking createStream
RTMP_ClientPacket, received: invoke 29 bytes
(object begin)
Property: <Name: no-name., STRING: _result>
Property: <Name: no-name., NUMBER: 2.00>
Property: NULL
Property: <Name: no-name., NUMBER: 1.00>
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <createStream>
SendPlay, seekTime=0, stopTime=0, sending play: live
Invoking play
sending ctrl. type: 0x0003
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 1
RTMP_ClientPacket, received: invoke 115 bytes
(object begin)
Property: <Name: no-name., STRING: onStatus>
Property: <Name: no-name., NUMBER: 0.00>
Property: NULL
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: level, STRING: status>
Property: <Name: code, STRING: NetStream.Play.Start>
Property: <Name: description, STRING: Start live>
Property: <Name: clientid, NUMBER: 3057890206.00>
(object end)
(object end)
HandleInvoke, server invoking <onStatus>
HandleInvoke, onStatus: NetStream.Play.Start
RTMP_ClientPacket, received: notify 24 bytes
(object begin)
Property: <Name: no-name., STRING: |RtmpSampleAccess>
Property: <Name: no-name., BOOLEAN: FALSE>
Property: <Name: no-name., BOOLEAN: FALSE>
(object end)
HandleCtrl, received ctrl. type: 32, len: 6
HandleCtrl, Stream BufferReady 1
RTMP_ClientPacket, received: notify 341 bytes
(object begin)
Property: <Name: no-name., STRING: onMetaData>
Property: <Name: no-name., ECMA_ARRAY>
(object begin)
Property: <Name: duration, NUMBER: 0.00>
Property: <Name: fileSize, NUMBER: 0.00>
Property: <Name: width, NUMBER: 424.00>
Property: <Name: height, NUMBER: 240.00>
Property: <Name: videocodecid, STRING: avc1>
Property: <Name: videodatarate, NUMBER: 2500.00>
Property: <Name: framerate, NUMBER: 30.00>
Property: <Name: audiocodecid, STRING: mp4a>
Property: <Name: audiodatarate, NUMBER: 160.00>
Property: <Name: audiosamplerate, NUMBER: 44100.00>
Property: <Name: audiosamplesize, NUMBER: 16.00>
Property: <Name: audiochannels, NUMBER: 2.00>
Property: <Name: stereo, BOOLEAN: TRUE>
Property: <Name: encoder, STRING: obs-output module (libobs version 20.1.0)>

... continue down

Alfredo 2017-10-31 23:14:50 UTC
1eb3be8e5170e941f1cea08267e26042

(object end)
(object end)
Metadata:
duration 0.00
fileSize 0.00
width 424.00
height 240.00
videocodecid avc1
videodatarate 2500.00
framerate 30.00
audiocodecid mp4a
audiodatarate 160.00
audiosamplerate 44100.00
audiosamplesize 16.00
audiochannels 2.00
stereo TRUE
encoder obs-output module (libobs version 20.1.0)
[flv @ 0xf016a0] Stream discovered after head already parsed
Input #0, flv, from 'rtmp://127.0.0.1:1935/live/live':
Metadata:
fileSize : 0
audiochannels : 2
encoder : obs-output module (libobs version 20.1.0)
Duration: 00:00:00.00, start: 1062.634000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 163 kb/s
Stream #0:1: Video: h264 (High), 4 reference frames, yuv420p, 424x240 (432x240), 30.30 fps, 30 tbr, 1k tbn, 60 tbc
Parsing...
Parsed protocol: 0
Parsed host : localhost
Parsed app : live2
RTMP_Connect1, ... connected, handshaking
HandShake: Type Answer : 03
HandShake: Server Uptime : 0
HandShake: FMS Version : 10.0.0.1
HandShake: Handshaking finished....
RTMP_Connect1, handshaked
Invoking connect
HandleServerBW: server BW = 5000000
HandleClientBW: client BW = 5000000 2
HandleCtrl, received ctrl. type: 0, len: 6
HandleCtrl, Stream Begin 0
HandleChangeChunkSize, received: chunk size change to 1048576
RTMP_ClientPacket, received: invoke 131 bytes
(object begin)
Property: <Name: no-name., STRING: _result>
Property: <Name: no-name., NUMBER: 1.00>
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: fmsVer, STRING: Nimble/3.3.1-1>
(object end)
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: level, STRING: status>
Property: <Name: code, STRING: NetConnection.Connect.Success>
Property: <Name: objectEncoding, NUMBER: 0.00>
(object end)
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <connect>
Invoking releaseStream
Invoking FCPublish
Invoking createStream
RTMP_ClientPacket, received: invoke 137 bytes
(object begin)
Property: <Name: no-name., STRING: onFCPublish>
Property: <Name: no-name., NUMBER: 0.00>
Property: NULL
Property: <Name: no-name., OBJECT>
(object begin)
Property: <Name: level, STRING: status>
Property: <Name: code, STRING: NetStream.Publish.Start>
Property: <Name: description, STRING: FCPublish to stream live2.>
Property: <Name: clientid, NUMBER: 3735928559.00>
(object end)
(object end)
HandleInvoke, server invoking <onFCPublish>
RTMP_ClientPacket, received: invoke 29 bytes
(object begin)
Property: <Name: no-name., STRING: _result>
Property: <Name: no-name., NUMBER: 4.00>
Property: NULL
Property: <Name: no-name., NUMBER: 1.00>
(object end)
HandleInvoke, server invoking <_result>
HandleInvoke, received result for method call <createStream>
Invoking publish
Invoking FCUnpublish

and the end it closes.

I think this is important:
[flv @ 0xf016a0] Stream discovered after head already parsed

I appreciate the help very much.

Denis Slobodskoy 2017-10-31 23:33:51 UTC
C723b4e32e1909d3d1b5519f98b586fe

Alfredo,
take a look at your nimble log (at /etc/nimble/log/nimble.log), there should be messages like this:
[rtmp] E: publish not authorized for live2/live2
Not sure pubUser/pubPassword works properly; try to set login/pass in output stream in rtmp://login:pass@server/path format) (must be rtmp://live2:live2@127.0.0.1:1935/live2/live2 in your case).

Alfredo 2017-10-31 23:52:47 UTC
1eb3be8e5170e941f1cea08267e26042

Denis,
Thanks for you help.

I found a link in this route:

/var/log/nimble/nimble.log

It effectively shows me the error you mention:

[2017-10-31 23:42:35 P1971-T1982] [rtmp] E: publish not authorized for live2/live2

I tried using authentication how do you tell me:

rtmp://live2:live2@127.0.0.1:1935/live2/live2

but show me this error:

Problem accessing the DNS. (addr: live2)
rtmp://live2:live2@127.0.0.1:1935/live2/live2: Unknown error occurred

I have tried with this form to authenticate:

rtmp://127.0.0.1:1935/live2/live2?rtmpauth=live2:live2

He does not show me an error, but nothing happens. it just closes.
There is no record in the /var/log/nimble/nimble.log file either

What could be happening?

Denis Slobodskoy 2017-11-01 00:13:23 UTC
C723b4e32e1909d3d1b5519f98b586fe

Alfredo,
rtmpauth must be put before stream name, so url have format rtmp://server/applicaion?rtmpauth=login:pass/stream, i.e. in your case you should use rtmp://127.0.0.1:1935/live2?rtmpauth=live2:live2/live2

Alfredo 2017-11-01 00:26:30 UTC
1eb3be8e5170e941f1cea08267e26042

I have managed to make it work using the comendo like this:

ffmpeg -i rtmp://127.0.0.1:1935/live/live -vcodec libx264 -c copy -acodec copy -f flv "rtmp://127.0.0.1:1935/live2/live2 flashver=FMLE/3.0\20(compatible;)FMSc/1.0\29 pubUser=live2 pubPasswd=live2"

I already think it works, but I'm having a new error:

This is directly from FFMPEG, but I'm not sure if nimble has anything to do with it:

The error:
*** Error in `ffmpeg ': free (): invalid next size (fast): 0x0000000001563a20 ***
.
.
.
Aborted (core dumped)

This seems difficult to solve.

Denis Slobodskoy 2017-11-01 00:51:02 UTC
C723b4e32e1909d3d1b5519f98b586fe

Alfredo,
try to install ffmpeg 3.4 as described here: http://tipsonubuntu.com/2016/11/02/install-ffmpeg-3-2-via-ppa-ubuntu-16-04/
At least, it supports authentication via rtmp://login:pass@server/app/stream

Post a reply



This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the Privacy Policy. If you want to know more or withdraw your consent to all or some of the cookies, please refer to the Privacy Policy.
By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to the use of cookies.