public MediaWriter AddVideo(VideoFormat format, VideoEncoderParameters encoderParams = null) { if (readyEncoders != null) { throw new InvalidOperationException($"该{nameof(MediaWriter)}对象已经初始化"); } if (outputFormat == null) { throw new InvalidOperationException("无法确定媒体的输出格式"); } if (outputFormat->VideoCodec == AVCodecID.None) { throw new InvalidOperationException($"该{nameof(MediaWriter)}对象并不支持视频"); } var stream = FF.avformat_new_stream(formatContext, Codec.GetEncoder(outputFormat->VideoCodec)); if (stream == null) { throw new InvalidOperationException("无法创建流"); } var codecContext = stream->Codec; var videoEncoder = new VideoEncoder(stream, format, encoderParams); stream->TimeBase = codecContext->TimeBase; stream->AvgFrameRate = codecContext->Framerate; int result = FF.avcodec_parameters_from_context(stream->Codecpar, codecContext); if (result < 0) { throw new FFmpegException(result); } encoders.Add(videoEncoder); return(this); }
public void Resize(VideoFormat format) { this.format = format; Resize(); }
public VideoFrame(VideoFormat format) { this.format = format; Resize(); }
public VideoDecoder(AVStream *stream) : base(stream) { InFormat = new VideoFormat(codecContext->Width, codecContext->Height, codecContext->PixFmt); }