Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (98)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

Sur d’autres sites (10866)

  • What is the commmand line to add watermark while screen recording using ffmpeg ? [duplicate]

    11 septembre 2020, par Yong Ju

    I tried to record screen using ffmpeg commmand line. So, I have complete it using this commmand.
ffmpeg.exe -rtbufsize 1500M -f -y -rtbufsize 100M -f gdigrab -t 00:02:00 -framerate 30 0 0 -probesize 10M 1920 1080 -draw_mouse 1 -i desktop -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -crf 30 -pix_fmt yuv420p output.avi".

    


    Now, I want to add watermark while recording video.
If you have good experience this field, Please give me good advice.
Thanks for your attention.
Sincerely.

    


  • I am using ffmpeg java library to convert captured screenshots to video. Video output is blurry

    2 octobre 2020, par dark prince

    I am using ffmpeg java library to convert captured screenshots to video. Video which is generated as output is blurry.

    


    I am using bit rate as 9000, frames per sec as 25 and video size as that of desktop screen size.

    


    Any suggestions on how to solve this issue.

    


    P.S. I cannot use ffmpeg.exe and command line due to certain restrictions and hence I am opting for ffmpeg java library.

    


    Any suggestions on the issue or suggestions on any better approach will be helpful.

    


        import java.awt.AWTException;&#xA;    import java.awt.Dimension;&#xA;    import java.awt.FlowLayout;&#xA;    import java.awt.Rectangle;&#xA;    import java.awt.Robot;&#xA;    import java.awt.Toolkit;&#xA;    import java.awt.event.ActionEvent;&#xA;    import java.awt.event.ActionListener;&#xA;    import java.awt.image.BufferedImage;&#xA;    import java.io.File;&#xA;    import java.io.IOException;&#xA;    import java.util.Date;&#xA;    &#xA;    import javax.imageio.ImageIO;&#xA;    import javax.swing.JButton;&#xA;    import javax.swing.JFrame;&#xA;    import javax.swing.JLabel;&#xA;    import javax.swing.JOptionPane;&#xA;    &#xA;    import org.bytedeco.javacpp.avcodec;&#xA;    import org.bytedeco.javacv.FFmpegFrameRecorder;&#xA;    import org.bytedeco.javacv.OpenCVFrameConverter;&#xA;    &#xA;    public class ScreenRecorder{&#xA;    &#xA;        public static boolean videoComplete=false;&#xA;        public static String inputImageDir="inputImgFolder"&#x2B;File.separator;&#xA;        public static String inputImgExt="png";&#xA;        public static String outputVideo="recording.mp4"; &#xA;        public static int counter=0;&#xA;        public static int imgProcessed=0;&#xA;        public static FFmpegFrameRecorder recorder=null;&#xA;        public static int videoWidth=1920;&#xA;        public static int videoHeight=1080;&#xA;        public static int videoFrameRate=3;&#xA;        public static int videoQuality=0; // 0 is the max quality&#xA;        public static int videoBitRate=9000;&#xA;        public static String videoFormat="mp4";&#xA;        public static int videoCodec=avcodec.AV_CODEC_ID_MPEG4;&#xA;        public static Thread t1=null;&#xA;        public static Thread t2=null;&#xA;        public static JFrame frame=null;&#xA;        public static boolean isRegionSelected=false;&#xA;        public static int c1=0;&#xA;        public static int c2=0;&#xA;        public static int c3=0;&#xA;        public static int c4=0;&#xA;        &#xA;        &#xA;        public static void main(String[] args) {&#xA;            &#xA;            try {&#xA;                if(getRecorder()==null)&#xA;                {&#xA;                    System.out.println("Cannot make recorder object, Exiting program");&#xA;                    System.exit(0);&#xA;                }&#xA;                if(getRobot()==null)&#xA;                {&#xA;                    System.out.println("Cannot make robot object, Exiting program");&#xA;                    System.exit(0);&#xA;                }&#xA;                File scanFolder=new File(inputImageDir);&#xA;                scanFolder.delete();&#xA;                scanFolder.mkdirs();&#xA;                &#xA;                createGUI();&#xA;            } catch (Exception e) {&#xA;                System.out.println("Exception in program "&#x2B;e.getMessage());&#xA;            }&#xA;        }&#xA;        &#xA;        public static void createGUI()&#xA;        {&#xA;            frame=new JFrame("Screen Recorder");&#xA;            JButton b1=new JButton("Select Region for Recording");&#xA;            JButton b2=new JButton("Start Recording");&#xA;            JButton b3=new JButton("Stop Recording");&#xA;            JLabel l1=new JLabel("<br />If you dont select a region then full screen recording <br /> will be made when you click on Start Recording");&#xA;            l1.setFont (l1.getFont ().deriveFont (20.0f));&#xA;            b1.addActionListener(new ActionListener() {&#xA;                @Override&#xA;                public void actionPerformed(ActionEvent e) {&#xA;                    try {&#xA;                        JOptionPane.showMessageDialog(frame, "A new window will open. Use your mouse to select the region you like to record");&#xA;                        new CropRegion().getImage();&#xA;                    } catch (Exception e1) {&#xA;                        // TODO Auto-generated catch block&#xA;                        System.out.println("Issue while trying to call the module to crop region");&#xA;                        e1.printStackTrace();&#xA;                    } &#xA;                }&#xA;            });&#xA;            b2.addActionListener(new ActionListener() {&#xA;                @Override&#xA;                public void actionPerformed(ActionEvent e) {&#xA;                    counter=0;&#xA;                    startRecording();&#xA;                }&#xA;            });&#xA;            b3.addActionListener(new ActionListener() {&#xA;                @Override&#xA;                public void actionPerformed(ActionEvent e) {&#xA;                    stopRecording();&#xA;                    System.out.print("Exiting...");&#xA;                    System.exit(0);&#xA;                }&#xA;            });&#xA;            &#xA;            frame.add(b1);&#xA;            frame.add(b2);&#xA;            frame.add(b3);&#xA;            frame.add(l1);&#xA;            frame.setLayout(new FlowLayout(0));&#xA;            frame.setVisible(true);&#xA;            frame.setSize(1000, 170);&#xA;            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&#xA;        }&#xA;        &#xA;        public static void startRecording()&#xA;        {&#xA;            t1=new Thread()&#xA;            {&#xA;                public void run() {&#xA;                    try {&#xA;                        takeScreenshot(getRobot());&#xA;                    } catch (Exception e) {&#xA;                        JOptionPane.showMessageDialog(frame, "Cannot make robot object, Exiting program "&#x2B;e.getMessage());&#xA;                        System.out.println("Cannot make robot object, Exiting program "&#x2B;e.getMessage());&#xA;                        System.exit(0);&#xA;                    }&#xA;                }&#xA;            };&#xA;            &#xA;            t2=new Thread()&#xA;            {&#xA;                public void run() {&#xA;                    prepareVideo();&#xA;                }&#xA;            };&#xA;            &#xA;            t1.start();&#xA;            t2.start();&#xA;            System.out.println("Started recording at "&#x2B;new Date());&#xA;        }&#xA;        &#xA;        public static Robot getRobot() throws Exception&#xA;        {&#xA;            Robot r=null;&#xA;            try {&#xA;                r = new Robot();&#xA;                return r;&#xA;            } catch (AWTException e) {&#xA;                JOptionPane.showMessageDialog(frame, "Issue while initiating Robot object "&#x2B;e.getMessage());&#xA;                System.out.println("Issue while initiating Robot object "&#x2B;e.getMessage());&#xA;                throw new Exception("Issue while initiating Robot object");&#xA;            }&#xA;        }&#xA;        &#xA;        public static void takeScreenshot(Robot r)&#xA;        {&#xA;            Dimension size = Toolkit.getDefaultToolkit().getScreenSize();&#xA;            Rectangle rec=new Rectangle(size);&#xA;            if(isRegionSelected)&#xA;            {&#xA;                rec=new Rectangle(c1, c2, c3-c1, c4-c2);&#xA;            }&#xA;            while(!videoComplete)&#xA;            {&#xA;            counter&#x2B;&#x2B;;&#xA;            BufferedImage img = r.createScreenCapture(rec);&#xA;            try {&#xA;                ImageIO.write(img, inputImgExt, new File(inputImageDir&#x2B;counter&#x2B;"."&#x2B;inputImgExt));&#xA;            } catch (IOException e) {&#xA;                JOptionPane.showMessageDialog(frame, "Got an issue while writing the screenshot to disk "&#x2B;e.getMessage());&#xA;                System.out.println("Got an issue while writing the screenshot to disk "&#x2B;e.getMessage());&#xA;                counter--;&#xA;            }&#xA;            }&#xA;        }&#xA;        &#xA;        public static void prepareVideo()&#xA;        {&#xA;            File scanFolder=new File(inputImageDir);&#xA;            while(!videoComplete)&#xA;            {&#xA;                File[] inputFiles=scanFolder.listFiles();&#xA;                try {&#xA;                    getRobot().delay(500);&#xA;                } catch (Exception e) {&#xA;                }&#xA;                //for(int i=0;i/imgProcessed&#x2B;&#x2B;;&#xA;                    addImageToVideo(inputFiles[i].getAbsolutePath());&#xA;                    //String imgToAdd=scanFolder.getAbsolutePath()&#x2B;File.separator&#x2B;imgProcessed&#x2B;"."&#x2B;inputImgExt;&#xA;                    //addImageToVideo(imgToAdd);&#xA;                    //new File(imgToAdd).delete();&#xA;                    inputFiles[i].delete();&#xA;                }&#xA;            }&#xA;            &#xA;            File[] inputFiles=scanFolder.listFiles();&#xA;            for(int i=0;i/ maximum quality&#xA;             recorder.start();&#xA;             }&#xA;             catch(Exception e)&#xA;             {&#xA;                 JOptionPane.showMessageDialog(frame, "Exception while starting the recorder object "&#x2B;e.getMessage());&#xA;                 System.out.println("Exception while starting the recorder object "&#x2B;e.getMessage());&#xA;                 throw new Exception("Unable to start recorder");&#xA;             }&#xA;             return recorder;&#xA;        }&#xA;        &#xA;        public static OpenCVFrameConverter.ToIplImage getFrameConverter()&#xA;        {&#xA;            OpenCVFrameConverter.ToIplImage grabberConverter = new OpenCVFrameConverter.ToIplImage();&#xA;            return grabberConverter;&#xA;        }&#xA;        &#xA;        public static void addImageToVideo(String imgPath)&#xA;        {&#xA;            try {&#xA;                getRecorder().record(getFrameConverter().convert(cvLoadImage(imgPath)));&#xA;            } catch (Exception e) {&#xA;                JOptionPane.showMessageDialog(frame, "Exception while adding image to video "&#x2B;e.getMessage());&#xA;                System.out.println("Exception while adding image to video "&#x2B;e.getMessage());&#xA;            }&#xA;        }&#xA;        &#xA;        public static void stopRecording()&#xA;        {&#xA;            try {&#xA;                videoComplete=true;&#xA;                System.out.println("Stopping recording at "&#x2B;new Date());&#xA;                t1.join();&#xA;                System.out.println("Screenshot thread complete");&#xA;                t2.join();&#xA;                System.out.println("Video maker thread complete");&#xA;                getRecorder().stop();&#xA;                System.out.println("Recording has been saved successfully at "&#x2B;new File(outputVideo).getAbsolutePath());&#xA;                JOptionPane.showMessageDialog(frame, "Recording has been saved successfully at "&#x2B;new File(outputVideo).getAbsolutePath());&#xA;            } catch (Exception e) {&#xA;                System.out.println("Exception while stopping the recorder "&#x2B;e.getMessage());&#xA;            }&#xA;        }&#xA;    }&#xA;

    &#xA;

    Imagepanel.java

    &#xA;

    import java.awt.Dimension;&#xA;import java.awt.Graphics;&#xA;import java.awt.Image;&#xA;import javax.swing.ImageIcon;&#xA;import javax.swing.JPanel;&#xA;&#xA;class ImagePanel&#xA;  extends JPanel&#xA;{&#xA;  private Image img;&#xA;  &#xA;  public ImagePanel(String img)&#xA;  {&#xA;    this(new ImageIcon(img).getImage());&#xA;  }&#xA;  &#xA;  public ImagePanel(Image img)&#xA;  {&#xA;    this.img = img;&#xA;    Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));&#xA;    &#xA;    setPreferredSize(size);&#xA;    setMinimumSize(size);&#xA;    setMaximumSize(size);&#xA;    setSize(size);&#xA;    setLayout(null);&#xA;  }&#xA;  &#xA;  public void paintComponent(Graphics g)&#xA;  {&#xA;    g.drawImage(this.img, 0, 0, null);&#xA;  }&#xA;}&#xA;

    &#xA;

    CropRegion.java

    &#xA;

    import java.awt.AWTException;&#xA;import java.awt.Dimension;&#xA;import java.awt.FlowLayout;&#xA;import java.awt.Graphics;&#xA;import java.awt.Rectangle;&#xA;import java.awt.Robot;&#xA;import java.awt.Toolkit;&#xA;import java.awt.event.MouseEvent;&#xA;import java.awt.event.MouseListener;&#xA;import java.awt.event.MouseMotionListener;&#xA;import java.awt.image.BufferedImage;&#xA;import java.io.IOException;&#xA;import javax.swing.JFrame;&#xA;import javax.swing.JLabel;&#xA;import javax.swing.JOptionPane;&#xA;&#xA;&#xA;public class CropRegion implements MouseListener,&#xA;        MouseMotionListener {&#xA;&#xA;    int drag_status = 0;&#xA;    int c1;&#xA;    int c2;&#xA;    int c3;&#xA;    int c4;&#xA;    JFrame frame=null;&#xA;    static int counter=0;&#xA;    JLabel background=null;&#xA;&#xA;    &#xA;    public void getImage() throws AWTException, IOException, InterruptedException {&#xA;        Dimension size = Toolkit.getDefaultToolkit().getScreenSize();&#xA;        Robot robot = new Robot();&#xA;        BufferedImage img = robot.createScreenCapture(new Rectangle(size));&#xA;        ImagePanel panel = new ImagePanel(img);&#xA;        frame=new JFrame();&#xA;        frame.add(panel);&#xA;        frame.setLocation(0, 0);&#xA;        frame.setSize(size);&#xA;        frame.setLayout(new FlowLayout());&#xA;        frame.setUndecorated(true);&#xA;        frame.setVisible(true);&#xA;        frame.addMouseListener(this);&#xA;        frame.addMouseMotionListener(this);&#xA;        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);&#xA;    }&#xA;&#xA;    public void draggedScreen() throws Exception {&#xA;        ScreenRecorder.c1=c1;&#xA;        ScreenRecorder.c2=c2;&#xA;        ScreenRecorder.c3=c3;&#xA;        ScreenRecorder.c4=c4;&#xA;        ScreenRecorder.isRegionSelected=true;&#xA;        JOptionPane.showMessageDialog(frame, "Region Selected.Please click on Start Recording button to record the selected region.");&#xA;        frame.dispose();&#xA;    }&#xA;&#xA;    public void mouseClicked(MouseEvent arg0) {&#xA;    }&#xA;&#xA;    public void mouseEntered(MouseEvent arg0) {&#xA;    }&#xA;&#xA;    public void mouseExited(MouseEvent arg0) {&#xA;    }&#xA;&#xA;    public void mousePressed(MouseEvent arg0) {&#xA;        paint();&#xA;        this.c1 = arg0.getX();&#xA;        this.c2 = arg0.getY();&#xA;    }&#xA;&#xA;    public void mouseReleased(MouseEvent arg0) {&#xA;        paint();&#xA;        if (this.drag_status == 1) {&#xA;            this.c3 = arg0.getX();&#xA;            this.c4 = arg0.getY();&#xA;            try {&#xA;                draggedScreen();&#xA;            } catch (Exception e) {&#xA;                e.printStackTrace();&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    public void mouseDragged(MouseEvent arg0) {&#xA;        paint();&#xA;        this.drag_status = 1;&#xA;        this.c3 = arg0.getX();&#xA;        this.c4 = arg0.getY();&#xA;    }&#xA;&#xA;    public void mouseMoved(MouseEvent arg0) {&#xA;    }&#xA;&#xA;    public void paint() {&#xA;        Graphics g = frame.getGraphics();&#xA;        frame.repaint();&#xA;        int w = this.c1 - this.c3;&#xA;        int h = this.c2 - this.c4;&#xA;        w *= -1;&#xA;        h *= -1;&#xA;        if (w &lt; 0) {&#xA;            w *= -1;&#xA;        }&#xA;        g.drawRect(this.c1, this.c2, w, h);&#xA;    }&#xA;}&#xA;

    &#xA;

  • Frame sliced into 2 under some degree. How fix it ?

    26 novembre 2020, par Алекс Аникей

    I trying use h264 codec in videochat application. And in some reason frame sliced into 2 triangle (picture below). I try send my desktop image to another person and get this image on another client.

    &#xA;

    What settings i set wrong ?&#xA;My code :

    &#xA;

    Init :

    &#xA;

    VCSession *vc_new_x264(Logger *log, ToxAV *av, uint32_t friend_number, toxav_video_receive_frame_cb *cb, void *cb_data,&#xA;                       VCSession *vc)&#xA;{&#xA;&#xA;    if (x264_param_default_preset(&amp;param, "slow", "zerolatency") &lt; 0) {&#xA;        // goto fail;&#xA;    }&#xA;&#xA;    param.i_csp = X264_CSP_I420;&#xA;    param.i_width  = 1920;&#xA;    param.i_height = 1080;&#xA;    vc->h264_enc_width = param.i_width;&#xA;    vc->h264_enc_height = param.i_height;&#xA;&#xA;    param.i_keyint_max = 30;&#xA;&#xA;    param.b_vfr_input = 1; /* VFR input.  If 1, use timebase and timestamps for ratecontrol purposes.&#xA;                            * If 0, use fps only. */&#xA;    param.i_timebase_num = 1;       // 1 ms = timebase units = (1/1000)s&#xA;    param.i_timebase_den = 1000;   // 1 ms = timebase units = (1/1000)s&#xA;    param.b_repeat_headers = 1;&#xA;    param.b_annexb = 1;&#xA;&#xA;    param.rc.f_rate_tolerance = VIDEO_F_RATE_TOLERANCE_H264;&#xA;    param.rc.i_vbv_buffer_size = 1500;&#xA;    param.rc.i_vbv_max_bitrate = VIDEO_BITRATE_INITIAL_VALUE_H264 * 1;&#xA;&#xA;    vc->h264_enc_bitrate = VIDEO_BITRATE_INITIAL_VALUE_H264;&#xA;&#xA;    param.rc.i_qp_min = 13;&#xA;    param.rc.i_qp_max = 35; // max quantizer for x264&#xA;&#xA;    vc->h264_enc_bitrate = VIDEO_BITRATE_INITIAL_VALUE_H264;&#xA;&#xA;    param.rc.b_stat_read = 0;&#xA;    param.rc.b_stat_write = 0;&#xA;&#xA;&#xA;    if (x264_param_apply_profile(&amp;param,&#xA;                                 "high") &lt; 0) { // "baseline", "main", "high", "high10", "high422", "high444"&#xA;        // goto fail;&#xA;    }&#xA;&#xA;&#xA;    if (x264_picture_alloc(&amp;(vc->h264_in_pic), param.i_csp, param.i_width, param.i_height) &lt; 0) {&#xA;        // goto fail;&#xA;    }&#xA;&#xA;    vc->h264_encoder = x264_encoder_open(&amp;param);&#xA;&#xA;    AVCodec *codec = NULL;&#xA;    vc->h264_decoder = NULL;&#xA;    avcodec_register_all();&#xA;    codec = NULL;&#xA;&#xA;    codec = avcodec_find_decoder(AV_CODEC_ID_H264);&#xA;&#xA;    if (!codec) {&#xA;        LOGGER_WARNING(log, "codec not found H264 on decoder");&#xA;    }&#xA;&#xA;    vc->h264_decoder = avcodec_alloc_context3(codec);&#xA;&#xA;    if (codec->capabilities &amp; AV_CODEC_CAP_TRUNCATED) {&#xA;        vc->h264_decoder->flags |= AV_CODEC_FLAG_TRUNCATED; /* we do not send complete frames */&#xA;    }&#xA;&#xA;&#xA;    vc->h264_decoder->delay = 5;&#xA;&#xA;    if (avcodec_open2(vc->h264_decoder, codec, NULL) &lt; 0) {&#xA;        LOGGER_WARNING(log, "could not open codec H264 on decoder");&#xA;    }&#xA;&#xA;&#xA;    return vc;&#xA;}&#xA;

    &#xA;

    Get frame and decoding him :

    &#xA;

    void vc_iterate_x264(VCSession *vc)&#xA;{&#xA;&#xA;    if (!vc) {&#xA;        return;&#xA;    }&#xA;&#xA;    pthread_mutex_lock(vc->queue_mutex);&#xA;&#xA;    struct RTPMessage *p;&#xA;&#xA;    if (!rb_read(vc->vbuf_raw, (void **)&amp;p)) {&#xA;        LOGGER_TRACE(vc->log, "no Video frame data available");&#xA;        pthread_mutex_unlock(vc->queue_mutex);&#xA;        return;&#xA;    }&#xA;&#xA;    pthread_mutex_unlock(vc->queue_mutex);&#xA;    const struct RTPHeader *const header = &amp;p->header;&#xA;&#xA;    uint32_t full_data_len;&#xA;&#xA;    if (header->flags &amp; RTP_LARGE_FRAME) {&#xA;        full_data_len = header->data_length_full;&#xA;        LOGGER_WARNING(vc->log, "vc_iterate:001:full_data_len=%d", (int)full_data_len);&#xA;    } else {&#xA;        full_data_len = p->len;&#xA;        if (header->data_length_lower != full_data_len)&#xA;        {&#xA;            LOGGER_ERROR("Data header and packet don&#x27;t equal: %d - header %d - packet", header->data_length_lower, full_data_len);&#xA;        }&#xA;        LOGGER_DEBUG(vc->log, "vc_iterate:002");&#xA;    }&#xA;&#xA;    decode_frame_h264(vc, p, full_data_len);&#xA;}&#xA;&#xA;void decode_frame_h264(VCSession *vc,&#xA;                       struct RTPMessage *p,&#xA;                       uint32_t full_data_len)&#xA;{&#xA;&#xA;    AVPacket *compr_data;&#xA;    compr_data = av_packet_alloc();&#xA;&#xA;&#xA;    uint8_t *tmp_buf = calloc(1, full_data_len &#x2B; FF_INPUT_BUFFER_PADDING_SIZE);&#xA;    memcpy(tmp_buf, p->data, full_data_len);&#xA;&#xA;    compr_data->data = tmp_buf; // p->data;&#xA;    compr_data->size = (int)full_data_len; // hmm, "int" again&#xA;&#xA;    avcodec_send_packet(vc->h264_decoder, compr_data);&#xA;&#xA;    int ret_ = 0;&#xA;    while (ret_ >= 0) {&#xA;        AVFrame *frame = av_frame_alloc();&#xA;        ret_ = avcodec_receive_frame(vc->h264_decoder, frame);&#xA;        if (ret_ == AVERROR(EAGAIN) || ret_ == AVERROR_EOF) {&#xA;            // error&#xA;            break;&#xA;        } else if (ret_ &lt; 0) {&#xA;            // Error during decoding&#xA;            break;&#xA;        } else if (ret_ == 0) {&#xA;            vc->vcb(vc->av, vc->friend_number, frame->width, frame->height,&#xA;                          (const uint8_t *)frame->data[0],&#xA;                          (const uint8_t *)frame->data[1],&#xA;                          (const uint8_t *)frame->data[2],&#xA;                          frame->linesize[0], frame->linesize[1],&#xA;                          frame->linesize[2], vc->vcb_user_data);&#xA;        } else {&#xA;            // some other error&#xA;        }&#xA;        av_frame_free(&amp;frame);&#xA;    }&#xA;    av_packet_free(&amp;compr_data);&#xA;    free(tmp_buf);&#xA;    free(p);&#xA;}&#xA;

    &#xA;

    Send frame and encoding :

    &#xA;

    bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y,&#xA;                            const uint8_t *u, const uint8_t *v, Toxav_Err_Send_Frame *error, int16_t kf_max_dist, vpx_codec_er_flags_t error_resilient,&#xA;                            unsigned int my_lag_in_frames, uint16_t kf_mode, uint16_t quality_mode)&#xA;{&#xA;    Toxav_Err_Send_Frame rc = TOXAV_ERR_SEND_FRAME_OK;&#xA;    ToxAVCall *call;&#xA;    uint64_t video_frame_record_timestamp = current_time_monotonic(av->m->mono_time);&#xA;&#xA;    int vpx_encode_flags = 0;&#xA;&#xA;    pthread_mutex_lock(call->mutex_video);&#xA;    pthread_mutex_unlock(av->mutex);&#xA;&#xA;    if (y == nullptr || u == nullptr || v == nullptr) {&#xA;        pthread_mutex_unlock(call->mutex_video);&#xA;        rc = TOXAV_ERR_SEND_FRAME_NULL;&#xA;        goto RETURN;&#xA;    }&#xA;&#xA;&#xA;    if (call->video_rtp->ssrc &lt; VIDEO_SEND_X_KEYFRAMES_FIRST) {&#xA;        // Key frame flag for first frames&#xA;        vpx_encode_flags = VPX_EFLAG_FORCE_KF;&#xA;        LOGGER_INFO(av->m->log, "I_FRAME_FLAG:%d only-i-frame mode", call->video_rtp->ssrc);&#xA;&#xA;        &#x2B;&#x2B;call->video_rtp->ssrc;&#xA;    } else if (call->video_rtp->ssrc == VIDEO_SEND_X_KEYFRAMES_FIRST) {&#xA;        // normal keyframe placement&#xA;        vpx_encode_flags = 0;&#xA;        LOGGER_INFO(av->m->log, "I_FRAME_FLAG:%d normal mode", call->video_rtp->ssrc);&#xA;&#xA;        &#x2B;&#x2B;call->video_rtp->ssrc;&#xA;    }&#xA;&#xA;&#xA;    x264_nal_t *nal = NULL;&#xA;    int i_frame_size = 0;&#xA;&#xA;    uint32_t result = encode_frame_h264(av, friend_number, width, height,&#xA;                                        y, u, v,&#xA;                                        &amp;video_frame_record_timestamp,&#xA;                                        vpx_encode_flags,&#xA;                                        &amp;nal,&#xA;                                        &amp;i_frame_size);&#xA;    if (result != 0) {&#xA;        pthread_mutex_unlock(call->mutex_video);&#xA;        rc = TOXAV_ERR_SEND_FRAME_INVALID;&#xA;        goto RETURN;&#xA;    }&#xA;&#xA;    &#x2B;&#x2B;call->video->frame_counter;&#xA;&#xA;    rc = send_frames_h264(av, friend_number, width, height,&#xA;                          y, u, v, call,&#xA;                          &amp;video_frame_record_timestamp,&#xA;                          vpx_encode_flags,&#xA;                          &amp;nal,&#xA;                          &amp;i_frame_size,&#xA;                          &amp;rc);&#xA;&#xA;    pthread_mutex_unlock(call->mutex_video);&#xA;&#xA;RETURN:&#xA;&#xA;    if (error) {&#xA;        *error = rc;&#xA;    }&#xA;&#xA;    return rc == TOXAV_ERR_SEND_FRAME_OK;&#xA;}&#xA;&#xA;uint32_t send_frames_h264(ToxAV *av, uint32_t friend_number, uint16_t width, uint16_t height,&#xA;                          const uint8_t *y,&#xA;                          const uint8_t *u, const uint8_t *v, ToxAVCall *call,&#xA;                          uint64_t *video_frame_record_timestamp,&#xA;                          int vpx_encode_flags,&#xA;                          x264_nal_t **nal,&#xA;                          int *i_frame_size,&#xA;                          TOXAV_ERR_SEND_FRAME *rc)&#xA;{&#xA;&#xA;    if (*i_frame_size > 0) {&#xA;&#xA;        // use the record timestamp that was actually used for this frame&#xA;        *video_frame_record_timestamp = (uint64_t)call->video->h264_in_pic.i_pts;&#xA;        const uint32_t frame_length_in_bytes = *i_frame_size;&#xA;        const int keyframe = (int)call->video->h264_out_pic.b_keyframe;&#xA;&#xA;        LOGGER_DEBUG(av->m->log, "video packet record time: %lu", (*video_frame_record_timestamp));&#xA;&#xA;        int res = rtp_send_data&#xA;                  (&#xA;                      call->video_rtp,&#xA;                      (const uint8_t *)((*nal)->p_payload),&#xA;                      frame_length_in_bytes,&#xA;                      keyframe,&#xA;                      *video_frame_record_timestamp,&#xA;                      av->m->log&#xA;                  );&#xA;&#xA;        (*video_frame_record_timestamp)&#x2B;&#x2B;;&#xA;&#xA;        if (res &lt; 0) {&#xA;            LOGGER_WARNING(av->m->log, "Could not send video frame: %s", strerror(errno));&#xA;            *rc = TOXAV_ERR_SEND_FRAME_RTP_FAILED;&#xA;            return 1;&#xA;        }&#xA;&#xA;        return 0;&#xA;    } else {&#xA;        *rc = TOXAV_ERR_SEND_FRAME_RTP_FAILED;&#xA;        return 1;&#xA;    }&#xA;&#xA;}&#xA;

    &#xA;

    I get image like this :

    &#xA;

    enter image description here

    &#xA;