Skip to main content
Participant
June 5, 2017
Question

Try to record Webcam Stream and Mux(Merge)Stream from ffmpeg on FMS 4.5

  • June 5, 2017
  • 0 replies
  • 265 views

Hi,

we have to implement a new features in our project. In which we have to mux(merge) screen-share and webcam.

-Muxing part is done with the help of ffmpeg.

-Also for live streaming it is going well.

-But when we come to recording part its not going well, when we start recording with webcam stream , I didn't find any error or exception at the time of recording. But when I was playing the recorded mp4 file, and in that mp4 file  while there is webcam stream recording(video and audio) is played well, but when muxed stream come into the stream then recording(video and audio) is distorted.

-I also tried to  record mux stream before we webcam stream, then while there is mux stream recording(video and audio) is played well, but when  webcam stream come into the recording file, after that recording(video and audio) is also distorted in mp4 file.

I am using following line of code to record and play :

To Playing Merge Stream:::::

application.onPublish = function (clientObj, streamObj)

{

       var index = streamObj.name.indexOf("_merged");

       var streamKey = streamObj.name.substring(0, index);

       var targetStream = Stream.get(streamKey);

       targetStream.play(streamObj.name, -1);

}

application.onUnpublish = function (clientObj, streamObj)

{

       var index = streamObj.name.indexOf("_merged");

       var streamKey = streamObj.name.substring(0, index);

       var targetStream = Stream.get(streamKey);

       targetStream.play(StreamName, -1);

}

To Playing Webcam Stream:::::

var targetStream  = Stream.get(abc);

targetStream.play(streamname, -1);

To Record Webcam Stream:::::

var serverStream  = Stream.get("mp4:" + filename+ ".mp4");

serverStream.record();

serverStream.play(streamname);

Thanks,

Prashant

    This topic has been closed for replies.