Results 1 to 7 of 7

Thread: How to force bitrate of the transcoded stream?

  1. #1

    Default How to force bitrate of the transcoded stream?

    Hello Transcoder Team,

    I have 1 Mbps input stream. The processing is as follow:

    1. The source is an IP camera.

    2. Application "master", type="live-record". The stream is started with file with the rtp link in it. I start the stream automatically but that is not important. As the result I have:
    * recording of the input data
    * published rtmp://x.x.x.x/master/ stream.

    3. Application "origin", type="liverepeater". The stream is started with with the RTMP link on the master stream. I start the stream manually on demand. The goal is to record all the input data, but make available the data to public only when the event is going, not before and after. All this works.

    4. I need to record the input data with bitrate 1 Mbps (and it works too), but broadcast the stream as 512 kbps. So I set up transcoding section with the following settings:

    Once I publish the origin stream I can connect to camera-origin.stream_512k stream. And here is the issue (probably). All the metadata (in logs, in rtmpdump, in ffmpeg) says that the stream is 512k:

    date: 2013-05-12
    time: 04:25:51
    tz: NOVT      
    x-event: encoder-video-start
    x-category: transcoder
    x-severity: INFO
    x-status: 200
    x-comment: {name:"512k", bitrate:512000, codec:H264, profile:Baseline, level:3.1, frameSize:860x576, displaySize:860x576, frameRate:12.5}
    But when I save the stream with rtmpdump or ffmpeg it is 1 Mbps. For example here is ffmpeg output:

    Input #0, flv, from 'rtmp://x.x.x.x/orig/camera-origin.stream_512k':
        frameWidth      : 860
        frameHeight     : 576
        displayWidth    : 860
        displayHeight   : 576
        audiochannels   : 1
      Duration: N/A, start: 0.000000, bitrate: 559 kb/s
        Stream #0:0: Video: h264 (Baseline), yuv420p, 860x576 [SAR 1:1 DAR 215:144], 512 kb/s, 12.50 tbr, 1k tbn, 25 tbc
        Stream #0:1: Audio: aac, 8000 Hz, mono, fltp, 47 kb/s
    Output #0, flv, to 'f2.flv':
        frameWidth      : 860
        frameHeight     : 576
        displayWidth    : 860
        displayHeight   : 576
        audiochannels   : 1
        encoder         : Lavf55.2.100
        Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 860x576 [SAR 1:1 DAR 215:144], q=2-31, 512 kb/s, 1k tbn, 1k tbc
        Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 8000 Hz, mono, 47 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame= 1657 fps= 27 q=-1.0 Lsize=    9572kB time=00:01:08.68 bitrate=1141.7kbits/s
    video:9132kB audio:398kB subtitle:0 global headers:0kB muxing overhead 0.438521%
    Note bitrate=1141.7kbits/s at the very bottom.

    rtmpdump output:
    INFO: Connected...
    Starting Live Stream
    INFO: Metadata:
    INFO: trackinfo:
    INFO:   type                  video
    INFO:   profile-level-id      42801f
    INFO:   description           {H264CodecConfigInfo: codec:H264, profile:Baseline, level:3.1, frameSize:860x576, displaySize:860x576, frameRate:12.5, PAR:1:1, crop: l:0 r:2 t:0 b:0}
    INFO:   type                  audio
    INFO:   config                1588
    INFO:   description           {AACFrame: codec:AAC, channels:1, frequency:8000, samplesPerFrame:1024, objectType:LC}
    INFO: rtpsessioninfo:
    INFO:   name                  D-Link DCS-5605
    INFO:   origin                CV-RTSPHandler 1123412 0 IN IP4 z.z.z.z
    INFO:   timing                0 0
    INFO:   protocolversion       0
    INFO: attributes:
    INFO:   etag                  1234567890
    INFO:   range                 npt=now-
    INFO:   charset               Shift_JIS
    INFO:   videocodecid          avc1
    INFO:   width                 860.00
    INFO:   height                576.00
    INFO:   frameWidth            860.00
    INFO:   frameHeight           576.00
    INFO:   displayWidth          860.00
    INFO:   displayHeight         576.00
    INFO:   framerate             12.50
    INFO:   videodatarate         500.00
    INFO:   audiochannels         1.00
    INFO:   audiosamplerate       8000.00
    INFO:   audiocodecid          mp4a
    INFO:   audiodatarate         46.00
    INFO: transcoder:
    INFO:   audioCodec            AAC
    INFO:   audioBitrate          48000.00
    INFO:   audioEncodingParams   FALSE
    INFO:   videoCodec            H264
    INFO:   videoBitrate          512000.00
    INFO:   videoImplementation   DEFAULT
    INFO:   videoProfile          BASE
    INFO:   videoFrameSizeFitMode letterbox
    INFO:   videoFrameSizeWidth   860.00
    INFO:   videoFrameSizeHeight  576.00
    INFO:   videoKeyFrameFollowSourceTRUE
    INFO:   videoEncodingParams   FALSE
    14134.276 kB / 100.48 sec
    Caught signal: 2, cleaning up, just a second...
    14219.419 kB / 101.00 sec
    Download may be incomplete (downloaded about 0.00%), try resuming
    Some calculations: 14219 kB * 8 / 101 = 1126 kbps.

    It might be the ffmpeg/rtmpdump issue, but this is what the access log has:
    date: 2013-05-12
    time: 04:38:45
    tz: NOVT      
    x-event: stop
    x-category: stream
    x-severity: INFO
    x-status: 200
    x-ctx: camera-origin.stream_512k
    x-comment: -
    x-vhost: _defaultVHost_
    x-app: orig
    x-appinst: _definst_
    x-duration: 68.89
    s-ip: [any]
    s-port: 1935
    s-uri: rtmp://x.x.x.x/orig
    c-ip: y.y.y.y
    c-proto: rtmp
    c-referrer: -
    c-user-agent: unknown
    c-client-id: 832776896
    cs-bytes: 3644
    sc-bytes: 9811669
    x-stream-id: 1
    x-spos: 67976
    cs-stream-bytes: 0
    sc-stream-bytes: 9770610
    x-sname: camera-origin.stream_512k
    x-sname-query: -
    x-file-name: -
    x-file-ext: -
    x-file-size: -
    x-file-lengt: -
    x-suri: rtmp://x.x.x.x/orig/camera-origin.stream_512k
    x-suri-stem: rtmp://x.x.x.x/orig/camera-origin.stream_512k
    x-suri-query: -
    cs-uri-ste m: rtmp://x.x.x.x/orig/
    cs-uri-query: -
    Some calculations:
    x-duration: 68.89
    sc-bytes: 9811669

    Bitrate = (9811669 * 8)/68.89 = 1139401 bps = 1.08 Mbps. Similar to what ffmpeg reported above. As I understand this is what the server sent in reality.

    So this does look like the transcoder module works incorrectly. Can you please advice how to limit the bitrate? I am expecting a lot of connections and would like to save some bandwidth.

    Best Regards,
    Last edited by wotan192; 05-11-2013 at 03:25 PM.

  2. #2


    UPD: I logged encoding parameters and changed bit_rate_scale from 0 to 1:
    # long: external setting of bit_rate_scale (avoids recalculation of bitrate)
    mainconcept.bit_rate_scale: 1
    No effect :-(

    Some other settings from the log:
    # long: bit rate stuff: avg bitrate; if 0, use above quantization parameters
    mainconcept.bit_rate: 512000
    # long: bit rate stuff: H264_CBR, H264_CQT, H264_VBR or H264_TQM
    mainconcept.bit_rate_mode: 2
    # long: bit rate stuff: vbv buffer size
    mainconcept.bit_rate_buffer_size: 574992
    # long: bit rate stuff: max bitrate, used in VBR mode
    mainconcept.max_bit_rate: 563200
    # long: external setting of cpb_size_scale (avoids recalculation of bitrate)
    mainconcept.cpb_size_scale: 2
    And the result:
    {name:"512k", bitrate:512000, codec:H264, profile:Baseline, level:2.1, frameSize:430x288, displaySize:430x288, frameRate:12.5}
    Everything looks to be correct, but the stream is still 1 Mbps. I even reduced size of the video (in assumption that you do not touch bitrate if the video has the same width and height), but got no effect either.

  3. #3


    It looks like I found something. I changed the bitrate in transcoder settings from 512k to 256k and got the stream 512k. So the setting affects the bitrate of the transcoded stream!

    This drives us to the question why the stream has double bitrate. I think the answer is in wrong framerate reported. Note that the original feed (from the IP camera) has 25 FPS, but reports only 12.5 FPS. This 2 times difference makes the 2 times difference in bitrate I think.

    Please put your attention on that.

  4. #4


    Hi Wotan,

    Can you please try updating to the latest patch version here,, to see if that fixes your problem.

    If not then can you please open a ticket at

    Please include a reference to this forum post.



  5. #5


    My fault, I should have reported it from the beginning. The version is already latest. The ticket was created.

    Wowza Media Server 3 Developer Edition (Expires: Oct 05, 2013) build4736

  6. #6


    We have been through a few things, in support, however it appears the camera is reporting 1/2 frame rate so when the transcoder is producing a new stream with the data it is being given the resulting bitrate out is twice the bitrate configured.

    The only solution, which has already been outlined, is to set the bitrate 1/2 of what is needed and then the resulting output is the bitrate required.

    Unfortunately in this case it is a camera manufacturer problem but there is a solution to create the required bitrate.


  7. #7


    Thank you Andrew. Setting bitrate to 256k works and produces 512k stream.

    I sent the bug report to D-Link support. JFI this is D-Link DCS-5605 model.

Similar Threads

  1. Replies: 2
    Last Post: 03-04-2014, 10:08 AM
  2. Obtaining bitrate of transcoded streams
    By ve1kyne in forum AddOn: Transcoder
    Replies: 4
    Last Post: 12-27-2013, 08:18 AM
  3. Replies: 30
    Last Post: 08-02-2012, 05:11 AM
  4. Adaptive bitrate, force a bitrate via HTTPProvider
    By Meinaart in forum Server-side Modules and Code Samples Discussion
    Replies: 9
    Last Post: 04-05-2012, 10:55 AM
  5. Replies: 3
    Last Post: 11-20-2011, 06:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts