Results 1 to 8 of 8

Thread: TransRate multi-recording & keyframe align

  1. #1

    Default TransRate multi-recording & keyframe align

    Hi,

    I am trying to use the transcode addon to transrate source stream then store multi-bitrate recording by LiveStreamRecord module. I plan to split the recorded segments by duration and I need the corresponding file be aligned to the same keyframe.
    e.g. there are 720p & 360p streams generated by transcode addon, and the recording splited by duration:
    mystream_720p_0.mp4
    mystream_720p_1.mp4
    mystream_720p_2.mp4
    mystream_720p_3.mp4
    .....

    mystream_360p_0.mp4
    mystream_360p_1.mp4
    mystream_360p_2.mp4
    mystream_360p_3.mp4
    .....
    I would like to design the mystream_720p_1.mp4 & mystream_360p_1.mp4 are start w/ the same keyframe, is it possible to approach? if it's possible, do I need any special configuration on it?

    Yehudi

  2. #2

    Default

    Hi,

    When you split recordings, they will split on the next key frame after the split command is sent to the recorder. If starting the recorder using the startRecordingSegmentByDuration method then each of the splits should occur at the same key frame. The duration of each segment is taken from the difference from the first key frame in the recording up to the last frame.

    You need to ensure that your recordings start on the same frame by starting each of the recorders at the same time.
    If you use IMediaStreamActionNotify.onPublish to check which stream is published and then start the record process from there, it should work. This will be called before the first frames are transcoded so you will get the first frames.

    If also recording the source stream, you should use the source stream option in the transrate template and record that stream rather than the actual source stream so that it is aligned with the transcoded streams.

    Stop the recordings using IMediaStreamActionNotify.onUnPublish.

    Roger.

  3. #3

    Default

    Hi,
    Thank you prompt reply.
    I would record the source stream, and a reduced bitrate stream by transcode. According to your advice, I will do the ILiveStreamRecord.startRecordingSegmentByDuration in IMediaStreamActionNotify.onPublish to make sure all the transcoded stream start at the first frame.
    Could you explain more about the option in transrate template so that both would be aligned? It sounds like an "non-transcoded" stream...
                               <Encode>
    				<Enable>true</Enable>
    				<Name>source</Name>
    				<StreamName>mp4:${SourceStreamName}_source</StreamName>
    				<Video>
    					<!-- H.264, H.263, PassThru, Disable -->
    					<Codec>PassThru</Codec>
    					<Bitrate>${SourceVideoBitrate}</Bitrate>
    					<Parameters>
    					</Parameters>
    				</Video>
    				<Audio>
    					<!-- AAC, PassThru, Disable -->
    					<Codec>PassThru</Codec>
    					<Bitrate>${SourceAudioBitrate}</Bitrate>
    					<Parameters>
    					</Parameters>
    				</Audio>
    				<Properties>
    				</Properties>
    			</Encode>
    Is it?

    Yehudi
    Last edited by spiritsoul; 08-20-2013 at 04:32 AM.

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    If you start the recordings with the Live Stream Record api the resultant segment sets should be key frame aligned.

    Rihcard

  5. #5

    Default

    Hi,

    Yes that is correct. In onPublish, look at the streamName and if it ends in _source or one of the transcoded renditions then starting the recorders should start them all on the same frame.

    Because the transcoder takes a few seconds to start up properly. the original stream (without the _source in the name) will possibly have a few more frames at the beginning.

    Roger.

  6. #6

    Default

    Thank you Roger
    Your reply is always precise and clear.

    Yehudi

  7. #7

    Default

    Hi Roger:
    Could you suggest the timing to stop recording? onUnPublish, onStop or onStreamDestroy, which one would be better?
    And how could I set the segment format? ILiveStreamRecord has no method to do that...

    Yehudi
    Last edited by spiritsoul; 09-06-2013 at 02:47 AM.

  8. #8

    Default

    Hi,

    You should stop recording in the onUnPublish method.

    To set the segment names, you use a custom ILiveStreamRecordFileVersionDelegate. It has a single method getFileName in which you return the name that you want to call the segment.

    You attach your delegate class to the recorder with ILiveStreamRecord.setFileVersionDelegate

    It will be called each time a new segment is created.

    Roger.

Posting Permissions

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