Exemplo n.º 1
0
        public static async Task streamToVimeo()
        {
            FFmpeg.SetExecutablesPath("C://ffmpeg/bin/");
            var mediaInfo = await FFmpeg.GetMediaInfo("rtsp://*****:*****@192.168.1.2:554/onvif1");

            var cancellationTokenSource = new System.Threading.CancellationTokenSource();

            cancellationTokenSource.CancelAfter(10000);
            IConversionResult conversionResult = await FFmpeg.Conversions.New()
                                                 .AddStream(mediaInfo.Streams.First())
                                                 .SetOutput(StreamOnline.buildVimeowLink())
                                                 .Start();
        }
Exemplo n.º 2
0
        public static async Task streamToTwitch()
        {
            FFmpeg.SetExecutablesPath("C://ffmpeg/bin/");
            var mediaInfo = await FFmpeg.GetMediaInfo("rtsp://*****:*****@192.168.1.2:554/onvif1");

            var cancellationTokenSource = new System.Threading.CancellationTokenSource();

            cancellationTokenSource.CancelAfter(10000);

            IStream videoStream = mediaInfo.VideoStreams.FirstOrDefault().SetCodec(VideoCodec.libx264).SetBitrate(3000000);
            IStream audioStream = mediaInfo.AudioStreams.FirstOrDefault().SetCodec(AudioCodec.aac).SetBitrate(192000);

            IConversionResult conversionResult = await FFmpeg.Conversions.New()
                                                 .AddStream(videoStream, audioStream)
                                                 .SetOutput(StreamOnline.buildTwitchLink())
                                                 .SetOutputFormat(Format.flv)
                                                 .Start();
        }