Exemplo n.º 1
0
 public static FFmpegSession CreateWithOutputPath(
     string outputPath,
     int width, int height, float frameRate,
     FFmpegPreset preset
     )
 {
     return(new FFmpegSession(
                "-y -f rawvideo -vcodec rawvideo -pixel_format rgba"
                + " -colorspace bt709"
                + " -video_size " + width + "x" + height
                + " -framerate " + frameRate
                + " -loglevel warning -i - " + preset.GetOptions()
                + " \"" + outputPath + "\""
                ));
 }
Exemplo n.º 2
0
 public static FFmpegSession CreateWithOutputPath(
     string outputPath,
     int width, int height, float frameRate,
     FFmpegPreset preset
     )
 {
     return(new FFmpegSession(
                "-f rawvideo -vcodec rawvideo -pixel_format rgba"
                + " -colorspace bt709"
                + " -video_size " + width + "x" + height
                + " -framerate " + frameRate
                + " -loglevel warning -i - " + preset.GetOptions()
                + " -vcodec libx264 -acodec copy -preset:v ultrafast -tune:v zerolatency -f flv rtmp://..." //add you rtmp server url
                //+ " \"" + outputPath + "\""
                ));
 }
Exemplo n.º 3
0
        public static FFmpegSession CreateWithOutputPath(
            string outputPath,
            int width, int height, float frameRate,
            FFmpegPreset preset, bool recordAudio, double sampleRate
            )
        {
            /*
             * @"-y -framerate 30 -f rawvideo -pix_fmt rgb32 -video_size 800x600 "
             + @"-i unix:///var/folders/8q/p8gcyljs02lg80hxvyv49c800000gn/T/CoreFxPipe_ffv "
             +@"-f s16le -channels 1 -sample_rate 48000 "
             + @"-i unix:///var/folders/8q/p8gcyljs02lg80hxvyv49c800000gn/T/CoreFxPipe_ffa "
             +@"-map 0:0 -map 1:0 -vcodec libx264 -crf 23 -pix_fmt yuv420p -preset medium -r 30 -c:a aac out.mp4";
             + @"-y -v 9 -loglevel 99 " +
             + @" -thread_queue_size 512 -framerate "+out_fps+" -f rawvideo -pix_fmt rgb32 -video_size 800x600 " +
             + @"-i - " +
             + @"-f s16le -ac 1 -ar "+out_ar+" -thread_queue_size 512 " +
             + @"-i async:tcp://127.0.0.1:50505 -loglevel trace " +
             + @"-map 1:0 -map 0:0 -c:a aac -ac 1 -ar 48000 " + // -map 0:0 -map 1:0
             + @"-vcodec libx264 -crf 23 -pix_fmt yuv420p -preset ultrafast -r "+out_fps+" out.mp4"
             */
            string videoPipeName           = "-";
            string audioPipeName           = "async:tcp://127.0.0.1:50505?timeout=5000000";
            string audioInputSpecification = " ";
            string audioOutputOptions      = " "; // TODO: presets

            if (recordAudio)
            {
                // add audio pipe
                audioInputSpecification = " -f f32le -ac 2 -ar "
                                          + ((int)sampleRate).ToString() + " -thread_queue_size 512 -i " +
                                          audioPipeName;
                audioOutputOptions = " -map 0:0 -map 1:0 -c:a aac -ac 2 ";
            }

            string args = "-y -f rawvideo -thread_queue_size 512 -vcodec rawvideo -pixel_format rgba"
                          + " -colorspace bt709"
                          + " -video_size " + width + "x" + height
                          + " -framerate " + frameRate
                          + " -loglevel warning -i " + videoPipeName
                          + audioInputSpecification
                          + audioOutputOptions
                          + preset.GetOptions()
                          + " \"" + outputPath + "\"";

            UnityEngine.Debug.Log(args);
            return(new FFmpegSession(args, recordAudio));
        }
Exemplo n.º 4
0
        public static FFmpegSession CreateWithOutputPath(
            string streamURL,
            int width, int height, float frameRate,
            FFmpegPreset preset,
            int CrfValue,
            int maxBitrate
            )
        {
            string m_Path = Application.dataPath;

            return(new FFmpegSession(
                       "-y -f rawvideo -fflags +genpts -vcodec rawvideo -pixel_format rgba"
                       + " -colorspace bt709"
                       + " -video_size " + width + "x" + height
                       + " -framerate " + frameRate
                       + " -loglevel warning -i - " + preset.GetOptions()
                       + " -an -vpre x264-preset -crf " + CrfValue + " -maxrate " + maxBitrate + "k -bufsize " + maxBitrate + "k -g " + frameRate * 2 + " -rtsp_transport tcp -f rtsp " + streamURL

                       ));
        }