Esempio n. 1
0
        public static MediaPacket EncodeFrame(AVCodecContext *codecContext, MediaFrame mediaFrame)
        {
            var frame  = mediaFrame.Pointer;
            var packet = ffmpeg.av_packet_alloc();

            ffmpeg.av_init_packet(packet);

            ffmpeg.avcodec_send_frame(codecContext, frame).ThrowOnError();
            ffmpeg.avcodec_receive_packet(codecContext, packet).ThrowOnError();

            return(new MediaPacket(packet));
        }
Esempio n. 2
0
 public void WriteFrame(AVCodecContext *codecContext, MediaFrame mediaFrame)
 {
     using var packet = EncodeFrame(codecContext, mediaFrame);
     WritePacket(packet.Pointer);
 }