Hello Transcoder Team,
I have 1 Mbps input stream. The processing is as follow:
-
The source is an IP camera.
-
Application “master”, type=“live-record”. The stream is started with camera.stream 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/camera.stream stream.
-
Application “origin”, type=“liverepeater”. The stream is started with camera-origin.stream 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.
-
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:
<Encode>
<Enable>true</Enable>
<Name>512k</Name>
<StreamName>mp4:${SourceStreamName}_512k</StreamName>
<Video>
<Codec>H.264</Codec>
<Transcoder>default</Transcoder>
<GPUID>-1</GPUID>
<FrameSize>
<FitMode>match-source</FitMode>
<Width>860</Width>
<Height>576</Height>
</FrameSize>
<Profile>base</Profile>
<Bitrate>512000</Bitrate>
<KeyFrameInterval>
<FollowSource>true</FollowSource>
<Interval>60</Interval>
</KeyFrameInterval>
<Parameters>
</Parameters>
</Video>
<Audio>
<Codec>AAC</Codec>
<Bitrate>48000</Bitrate>
<Parameters>
</Parameters>
</Audio>
<Properties>
</Properties>
</Encode>
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-ctx: camera-origin.stream
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':
Metadata:
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':
Metadata:
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: sprop-parameter-sets Z0KAH5ZSAbAk9+AqEAAAAwAQAAADAZ4EAAiYAAAjGE/GOMCAARMAAARjCfjHDtChUkA=,aMuNSA==
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,
Maxim