Opened 3 years ago

Closed 3 years ago

#5564 closed defect (invalid)

It is impossible to create complex rtmp_conn parameter

Reported by: solomax Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: rtmp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

According to the documentation [1] it should be possible to add additional RTMP connection parameters using -rtmp_conn "NN:code:1.23 NS:flag:ok",
Actually these parameters are not being added to RTMP connection parameter map (tested with Wireshark and red5 server)

parameters goes to plain params array

same time simple options like -rtmp_conn S:test_string works as expected

issue was marked as important due to it's important for our project to be able to add custom properties to the connection parameter map

[1] https://ffmpeg.org/ffmpeg-protocols.html#rtmp

How to reproduce:

% ffmpeg -y -i /home/solomax/Downloads/Avengers2.mp4 -s 640x480 -an -vcodec flv -f flv -rtmp_conn NN:code:1.23 rtmp://localhost:1935/openmeetings/5/666

ffmpeg version N-79632-g3ce1988 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
  configuration: --prefix=/home/solomax/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/solomax/ffmpeg_build/include --extra-ldflags=-L/home/solomax/ffmpeg_build/lib --bindir=/home/solomax/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 22.101 / 55. 22.101
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/solomax/Downloads/Avengers2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
  Duration: 00:02:33.19, start: 0.000000, bitrate: 729 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 1280:1071 DAR 640:357], 597 kb/s, 16 fps, 16 tbr, 16384 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (10)

comment:1 Changed 3 years ago by cehoyos

  • Priority changed from important to normal

Your command line does not conform to the documentation and the console output seems incomplete.

comment:2 follow-up: Changed 3 years ago by solomax

Not sure what is wrong with command ...
Maybe some redundant options were used

here is the updated command with "simple" connection parameter

ffmpeg -i /home/solomax/Downloads/Avengers2.mp4 -vcodec flv -f flv -rtmp_conn S:code rtmp://localhost:1935/openmeetings/5/666

Output:

ffmpeg version N-79632-g3ce1988 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
  configuration: --prefix=/home/solomax/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/solomax/ffmpeg_build/include --extra-ldflags=-L/home/solomax/ffmpeg_build/lib --bindir=/home/solomax/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 22.101 / 55. 22.101
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/solomax/Downloads/Avengers2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
  Duration: 00:02:33.19, start: 0.000000, bitrate: 729 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 1280:1071 DAR 640:357], 597 kb/s, 16 fps, 16 tbr, 16384 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[flv @ 0x3d8aee0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, flv, to 'rtmp://localhost:1935/openmeetings/5/666':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.34.103
    Stream #0:0(und): Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 720x480 [SAR 1280:1071 DAR 640:357], q=2-31, 200 kb/s, 16 fps, 1k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.38.100 flv
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, fltp (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.38.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
  Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[flv @ 0x3d8aee0] Failed to update header with correct duration.ate= 512.2kbits/s speed=25.9x    
[flv @ 0x3d8aee0] Failed to update header with correct filesize.
frame= 2451 fps=422 q=31.0 Lsize=    9276kB time=00:02:33.12 bitrate= 496.3kbits/s speed=26.4x    
video:6753kB audio:2393kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.424466%

red5 server reports error in case "simple" parameter is being changed to "complex" one: i.e. -rtmp_conn NN:code:1.23 instead of -rtmp_conn S:code

Wireshark also detects no additional parameters in connect params map

comment:3 in reply to: ↑ 2 Changed 3 years ago by cehoyos

Replying to solomax:

red5 server reports error in case "simple" parameter is being changed to "complex" one

Do I understand correctly that you now posted a working command line including complete, uncut console output that does not allow to reproduce an issue?

comment:4 follow-up: Changed 3 years ago by solomax

sorry, I thought it is trivial to change one parameter with another ..

ffmpeg -i /home/solomax/Downloads/Avengers2.mp4 -vcodec flv -f flv -rtmp_conn NN:code:1.23 rtmp://192.168.15.177:1935/openmeetings/5/666

output

ffmpeg version N-79632-g3ce1988 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
  configuration: --prefix=/home/solomax/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/solomax/ffmpeg_build/include --extra-ldflags=-L/home/solomax/ffmpeg_build/lib --bindir=/home/solomax/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 22.101 / 55. 22.101
  libavcodec     57. 38.100 / 57. 38.100
  libavformat    57. 34.103 / 57. 34.103
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 44.100 /  6. 44.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/solomax/Downloads/Avengers2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.15.102
  Duration: 00:02:33.19, start: 0.000000, bitrate: 729 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 1280:1071 DAR 640:357], 597 kb/s, 16 fps, 16 tbr, 16384 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
rtmp://192.168.15.177:1935/openmeetings/5/666: Input/output error

here is Wireshark decoded message:

Frame 16: 260 bytes on wire (2080 bits), 260 bytes captured (2080 bits) on interface 0
Linux cooked capture
Internet Protocol Version 4, Src: 10.8.72.21, Dst: 192.168.15.177
Transmission Control Protocol, Src Port: 48870 (48870), Dst Port: 1935 (1935), Seq: 3074, Ack: 3074, Len: 192
Real Time Messaging Protocol (AMF0 Command connect('openmeetings/5'))
    RTMP Header
    RTMP Body
        String 'connect'
        Number 1
        Object (4 items)
            AMF0 type: Object (0x03)
            Property 'app' String 'openmeetings/5'
            Property 'type' String 'nonprivate'
            Property 'flashVer' String 'FMLE/3.0 (compatible; Lavf57.34.103)'
            Property 'tcUrl' String 'rtmp://192.168.15.177:1935/openmeetings/5'
            End Of Object Marker
        Number 1.59544376928632e-287
            AMF0 type: Number (0x00)
            Number: 1.59544376928632e-287
        Unknown
            AMF0 type: Unknown (0xae)

as you can see "NN:code:1.23" is not being treated as "named parameter of number type with name 'code' and value 1.23", but being written in weird form as parameter without a name

comment:5 in reply to: ↑ 4 Changed 3 years ago by cehoyos

Replying to solomax:

sorry, I thought it is trivial to change one parameter with another ..

I agree!

ffmpeg -i /home/solomax/Downloads/Avengers2.mp4 -vcodec flv -f flv -rtmp_conn NN:code:1.23 rtmp://192.168.15.177:1935/openmeetings/5/666

... but this looks different from the sample that you linked above or do you disagree?

comment:6 follow-up: Changed 3 years ago by solomax

The only difference is:
-rtmp_conn S:code
is replaced with
-rtmp_conn NN:code:1.23

as I wrote In the bug description, in case first parameter is passed everything works as expected,
with second, "complex" parameter ffmpeg is not working

comment:7 Changed 3 years ago by solomax

According to https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/rtmpproto.c#L370
parsed named parameters are not being added to connection map (which contains only fixed set of parameters), but being added to the end of message.
I can try to debug this if it helps

comment:8 in reply to: ↑ 6 Changed 3 years ago by cehoyos

Replying to solomax:

The only difference is:
-rtmp_conn S:code
is replaced with
-rtmp_conn NN:code:1.23

I disagree, please test the following:

$ ffmpeg -i Avengers2.mp4 -f flv -rtmp_conn "O:1 NN:code:1.23 O:0" rtmp://192.168.15.177:1935/openmeetings/5/666

comment:9 Changed 3 years ago by solomax

My bad,
I thought I can use named parameters "as is", but they are working only inside the object
please close the issue

Thanks for the help and patience

comment:10 Changed 3 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

Thank you for testing!

Note: See TracTickets for help on using tickets.