This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: Interlaced video capture

Expert 2990 points
Other Parts Discussed in Thread: AM5728, TVP5150, TVP5158

HI all:

        we have developed a custom am5728 board which can be used to capture interlace video.

        Just now we can capture the video successfully, But the video have some jitter.

        So we make some debug and found that am5728 capture 50 fields per second, the field is width 720, height 288.

        because We can get 50 interrupts from the vin1a per second.

         We doubt whether am5728 take each field as a frame to display which result in jitter.

         So how can we deinterlace the video?

         Our Processor SDK is 4.0.

         The hardware is am5728 + tvp5150

         Our test command is below:

       

gst-launch-1.0 -v v4l2src device=/dev/video1 norm=255 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)720, height=(int)288, framerate=(fraction)50/1' \
! vpe ! 'video/x-raw, format=(string)NV12, width=(int)720, height=(int)576, framerate=(fraction)50/1' ! queue ! waylandsink

       

  • The software team have been notified. They will respond here.
  • HI :

        Anyone can help us

    Thanks

  • Hello,

    Could you try to replace the vpe element with :
    .... ! deinterlace ! videoconvert ! ....
    Do you see the same behavior?

    I tried pipeline like this on my side:
    gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)YUY2, width=(int)720, height=(int)288, framerate=(fraction)50/1 , interlace-mode=interlaced' ! vpe ! 'video/x-raw, format=(string)NV12, width=(int)720, height=(int)576, framerate=(fraction)50/1, interlace-mode=progressive' ! queue ! kmssink
    It seems to work.


    BR
    Margarita
  • Dear Margarita

              

    Thanks for your reply!

    We have test your advice and it reporter some error!

    The test command is like below:

    gst-launch-1.0 -v v4l2src device=/dev/video1 norm=255 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)720, height=(int)288, framerate=(fraction)50/1, interlace-mode=interlaced' \
    ! deinterlace ! videoconvert ! 'video/x-raw, format=(string)NV12, width=(int)720, height=(int)576, framerate=(fraction)50/1, interlace-mode=progressive' ! queue ! waylandsink

    The debug info is like below:

    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
    Additional debug info:
    ../../../../gstreamer-1.8.3/libs/gst/base/gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming task paused, reason not-negotiated (-4)
    Execution ended after 0:00:00.906756657
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...

    If we use videotestsrc to test, the result is the same:

    gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)YUY2, width=(int)720, height=(int)288, framerate=(fraction)50/1, interlace-mode=interlaced' !\
    deinterlace ! videoconvert ! 'video/x-raw, format=(string)NV12, width=(int)720, height=(int)576, framerate=(fraction)50/1, interlace-mode=progressive' ! queue ! waylandsink

    Just now I do not know whether the issue is because of tvp5150 driver/hardware or vpe deinterlace!

    I am very confusing !

    Regards

    xixi

  • Try this -

    gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \
    format=(string)YUY2, width=(int)720, height=(int)288' ! vpe num-input-buffers=8 ! queue ! waylandsink

    If it doesn't work, then share the dub logs using gst-debug-level=3
  • Dear manisha

    Thanks for your reply。

    Now we used below command to test and the result is the same as before.

    The video is clear but very jittery.

    gst-launch-1.0 --gst-debug=3 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)720, height=(int)288' ! vpe num-input-buffers=8 ! queue ! waylandsink

    The attachment is the log file.  from the log file, we can now v4l2src treat the interlaced video as progressive video

    Unhandled enum v4l2_field 2 - treating as progressive

     

    2671.log.txt

  • HI manisha

                       Can you find something wrong from the log!

                       Because it is very critical for me!

    Thanks

    Best Regards

  •  Hi all:

               anyone can help me about this issue!

    regards

  • Hello,

    I would recommend you to check the output file after the v4l2src is it correct.
    If it is, you could try the yuv file with testvpem2m.
    In additional the pipelines with deinterlace and videoconvert element does not seems correct. In this case I could recommend you to remove the second caps filter and to try without setting interlace-mode or  set this mode to interleaved. The deinterlace's properties like mode, fields could be set but I recommend to be on autodetect which is the default value.

    I would also recommend you to check these documents : part-mediatype-video-raw.txt and part-interlaced-video.txt.

    BR
    Margarita

  • Are you still facing the problem or is this resolved?

    Assuming that TVP5158 driver is setting the field attribute to V4L2_FIELD_ALTERNATE (7). If so, the VIP driver updates that “field” dynamically to switch the value between V4L2_FIELD_TOP (2) and V4L2_FIELD_BOTTOM (3). Based on the error message, it seems that the v4l2_capture g-streamer plugin does not like that very much and switches it to progressive instead.

    Can you also enable VIP and V4L2 logs using below instructions and share the dmesg log?

    echo 3 >/sys/class/video4linux/video1/dev_debug
    This allows V4L2 ioctl calls to be logged.
    In addition ti-vip also has specific debug log which can be enabled as follows:
    echo 3 > /sys/module/ti_vip/parameters/debug

    As well, can you try to collect more detailed v4l2src log by using gst-debug=v4l2src:4 in gstreamer pipeline?
  • HI manisha

    very thanks for your reply 

    Because we are on a business trip, so there is no time to debug, next Monday I will give you more detailed log

    Best regards

    xixi

  • HI  manisha

    The attachment is the gstreamer log and the kernel log!

    But the kernel_log have some lost, because it is too large!

    root@am57xx-evm:~# ./gst.sh 
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    [  629.156520] systemd-journald[125]: /dev/kmsg buffer overrun, some messages lost.
    [  629.165819] systemd-journald[125]: /dev/kmsg buffer overrun, some messages lost.
    [  629.173300] VIDIOC_TRY_FMT: error -22: type=vid-cap, width=720, height=288, pixelformat=YVYU, field=interlaced, bytesperline=0, sizeimage=0, colorspace=0, flags=0x0, ycbcr_enc=0, quantization=0, xfer_func=0
    0:00:00.210237558  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.033333333 out ts 0:00:00.096021393
    0:00:00.230248926  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.066666666 out ts 0:00:00.116058369
    0:00:00.250266314  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.099999999 out ts 0:00:00.136036694
    0:00:00.290229016  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.133333332 out ts 0:00:00.176035695
    0:00:00.290319310  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.176035695
    0:00:00.310279755  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.166666665 out ts 0:00:00.196071556
    0:00:00.330226534  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.199999998 out ts 0:00:00.216042345
    0:00:00.370233489  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.233333331 out ts 0:00:00.256048695
    0:00:00.370311907  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.256048695
    0:00:00.390261451  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.266666664 out ts 0:00:00.276084019
    0:00:00.410236376  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.299999997 out ts 0:00:00.296055183
    0:00:00.450246096  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.333333330 out ts 0:00:00.336061857
    0:00:00.450330859  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.336061857
    0:00:00.470271944  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.366666663 out ts 0:00:00.356098183
    0:00:00.490252400  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.399999996 out ts 0:00:00.376069182
    0:00:00.530260005  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.433333329 out ts 0:00:00.416077508
    0:00:00.530335657  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.416077508
    0:00:00.550295289  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.466666662 out ts 0:00:00.436105326
    0:00:00.570254111  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.499999995 out ts 0:00:00.456083345
    0:00:00.610287923  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.533333328 out ts 0:00:00.496089694
    0:00:00.610381797  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.496089694
    0:00:00.630297508  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.566666661 out ts 0:00:00.516125183
    0:00:00.650274880  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.599999994 out ts 0:00:00.536096671
    0:00:00.690279245  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.633333327 out ts 0:00:00.576103508
    0:00:00.690353921  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.576103508
    0:00:00.710322670  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.666666660 out ts 0:00:00.596139345
    0:00:00.730283122  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.699999993 out ts 0:00:00.616110020
    0:00:00.770291229  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.733333326 out ts 0:00:00.656116507
    0:00:00.770366556  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.656116507
    0:00:00.790325543  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.766666659 out ts 0:00:00.676151345
    0:00:00.810299824  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.799999992 out ts 0:00:00.696123019
    0:00:00.850336565  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.833333325 out ts 0:00:00.736131671
    0:00:00.850423117  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.736131671
    0:00:00.870343058  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.866666658 out ts 0:00:00.756166345
    0:00:00.890311157  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.899999991 out ts 0:00:00.776136833
    0:00:00.930320240  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.933333324 out ts 0:00:00.816143671
    0:00:00.930387757  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.816143671
    0:00:00.950348046  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.966666657 out ts 0:00:00.836179670
    0:00:00.970315819  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.999999990 out ts 0:00:00.856149670
    0:00:01.010321974  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.033333323 out ts 0:00:00.896155508
    0:00:01.010386563  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.896155508
    0:00:01.030354336  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.066666656 out ts 0:00:00.916192670
    0:00:01.050330894  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.099999989 out ts 0:00:00.936162183
    0:00:01.090343231  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.133333322 out ts 0:00:00.976174508
    0:00:01.090407495  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.976174508
    0:00:01.110410247  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.166666655 out ts 0:00:00.996205345
    0:00:01.130340926  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.199999988 out ts 0:00:01.016176833
    0:00:01.170353588  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.233333321 out ts 0:00:01.056187671
    0:00:01.170415899  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:01.056187671
    0:00:01.190385136  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.266666654 out ts 0:00:01.076219507
    0:00:01.210353072  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.299999987 out ts 0:00:01.096190671
    0:00:01.250366710  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.333333320 out ts 0:00:01.136200508
    0:00:01.250431462  1376   0x1474c0 WARN                 v4l2src gstv4l2src.c:862:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:01.136200508
    0:00:01.270510680  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.366666653 out ts 0:00:01.156231695
    0:00:01.290373190  1376   0x1474c0 INFO                 v4l2src gstv4l2src.c:843:gst_v4l2src_create:<v4l2src0> sync to 0:00:01.399999986 out ts 0:00:01.176203182
    0:00:01.330391710  1376   0x1474c0 INFO    ^Chandling interrupt.
    Interrupt: Stopping pipeline ...
    Execution ended after 0:00:01.220906178
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...
    
    kernel.txt

  • HI manisha:

                         How about the kernel log and the gstreamer log.

                         If it is not enough, we can provide more log  to you.

                         Thanks

    Regards

    xixi

  • HI all:

             Anyone can help us about this issue

    Thanks

    regards

                        

            

  • xixi, sorry for the delay...apps team is working on it...reply will be posted soon.
  • Sorry for the delay. Can you please try attached patch and see if it helps to resolve the issue?

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_media_2D00_ti_2D00_vpe_2D00_vip_2D00_HACK_2D00_Do_2D00_not_2D00_change_2D00_field_2D00_dynamical.patch

  • hi rogerio
    thanks
    we have tried the patch,the result is the same like before.

    regards
    xixi
  • Hi xixi,

    We would like to isolate if the issue is with the gstreamer plugins interactions or with the driver. Can you dump the captured image in a file and then later use testvpe application (available in filesystem) to deinterlace it? Please check the deinterlaced output from testvpe and see if the video looks good.

    If you are able to, share the interlaced capture video with us so that we can do the analysis at our end.

    By the way , the vip driver in SDK 4.0 had some known issue (not applicable to the jitter you are seeing) that's been fixed now. You can include the fix at your end when testing. Please check below post on getting the patch, building and installing it.
    e2e.ti.com/.../2293496


    Regards,
    Manisha

  • hi Manisha
    How can we send the video to you
    thanks
    regards
  • Hi,manisha
    wo have the same question with xixi.
    AM5728 capture video from tvp5158,and there is 50 frames per seconds.
    I have try the instructions you mentioned above.The problem was the same.
  • Dear user4592053

    How about your video,

    Is  it jitter?

    thanks

    regards

  • Yes,it's jitter.I think we had the same problem .
    I try to use v4l2 interface to capture one frame .It just has 288 lines which is one field.
  • you are right,we can get 50 frames per seconds.
    we also use v4l2 to capture video, the result is the same. but our chip is tvp5150 but not tvp5158
  • xixi said:
    How can we send the video to yo

    You can share the interlaced video as attachment to the e2e post. When you reply to the post, pick "use rich formatting" option. That will let you uploadthe file.

    Please as well share all the details on how you generated the video -

    1. Which application was used to generate the video, if gstreamer pipeline used, share the pipeline instruction
    2. Share the details on interlace video source - TVP5158/TVP5150/others. What  configuration used to generate the interlace video.

  • #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <sys/ioctl.h>
    #include <sys/mman.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <linux/videodev2.h>
    
    struct v4l2_user_buffer {
        int index;
        int length;
        char *addr;
    };
    struct v4l2_user_buffer user_buffer[3];
    
    int save_file(char *addr, int length, int index)
    {
        FILE *fp;
        char fname[256];
    
        memset(fname, 0x00, 256);
        sprintf(fname, "frame_%d.yuv", index);
        printf("save_file [%s]\n", fname);
        fp = fopen(fname, "wb");
        if (fp == NULL) {
            printf("%d: fopen error\n", __LINE__);
            return -1;
        }
    
        fwrite(addr, 1, length, fp);
        fflush(fp);
        fclose(fp);
    
        return 0;
    }
    
    int main(void)
    {
        int i = 0;
        int status = 0;
        int v4l2_fd = 0;
        struct v4l2_format format;
        struct v4l2_requestbuffers requestbuffers;
        struct v4l2_buffer buffer;
        struct v4l2_selection selection = { 0 };
    
        v4l2_fd = open("/dev/video1", O_RDWR);
        if (v4l2_fd == -1) {
            printf("%d: open error\n", __LINE__);
            return -1;
        }
    
        
    
        memset(&format, 0x00, sizeof(struct v4l2_format));
        format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        format.fmt.pix.width = 720;
        format.fmt.pix.height = 288;
        format.fmt.pix.field = V4L2_FIELD_ALTERNATE;
        format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
        //format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
        status = ioctl(v4l2_fd, VIDIOC_S_FMT, &format);
        if (status < 0) {
            printf("%d: ioctl VIDIOC_S_FMT error\n", __LINE__);
            return -1;
        }
    
        memset(&format, 0x00, sizeof(struct v4l2_format));
        format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        status = ioctl(v4l2_fd, VIDIOC_G_FMT, &format);
        if (status < 0) {
            printf("%d: ioctl VIDIOC_G_FMT error\n", __LINE__);
            return -1;
        }
        printf("format width: [%d]\n", format.fmt.pix.width);
        printf("format height: [%d]\n", format.fmt.pix.height);
    
        memset(&requestbuffers, 0x00, sizeof(struct v4l2_requestbuffers));
        requestbuffers.count = 3;
        requestbuffers.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        requestbuffers.memory = V4L2_MEMORY_MMAP;
        status = ioctl(v4l2_fd, VIDIOC_REQBUFS, &requestbuffers);
        if (status < 0) {
            printf("%d: ioctl VIDIOC_REQBUFS error\n", __LINE__);
            return -1;
        }
    
        for (i = 0; i < requestbuffers.count; i++) {
            buffer.index = i;
            buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            buffer.memory = V4L2_MEMORY_MMAP;
            status = ioctl(v4l2_fd, VIDIOC_QUERYBUF, &buffer);
            if (status < 0) {
                printf("%d: ioctl VIDIOC_QUERYBUF error\n", __LINE__);
                return -1;
            }
    
            user_buffer[i].index = i;
            user_buffer[i].length = buffer.length;
            user_buffer[i].addr = (char *)mmap(NULL,
                    buffer.length,
                    PROT_READ | PROT_WRITE,
                    MAP_SHARED,
                    v4l2_fd,
                    buffer.m.offset);
            if (user_buffer[i].addr == MAP_FAILED) {
                printf("%d: mmap error\n", __LINE__);
                return -1;
            }
            printf("user_buffer index: [%d]\n", user_buffer[i].index);
            printf("user_buffer length: [%d]\n", user_buffer[i].length);
            printf("user_buffer addr: [%p]\n", user_buffer[i].addr);
        }
    
        for (i = 0; i < requestbuffers.count; i ++) {
            buffer.index = i;
            buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            buffer.memory = V4L2_MEMORY_MMAP;
            status = ioctl(v4l2_fd, VIDIOC_QBUF, &buffer);
            if (status < 0) {
                printf("%d: ioctl VIDIOC_QBUF error\n", __LINE__);
                return -1;
            }
        }
    
        int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        status = ioctl(v4l2_fd, VIDIOC_STREAMON, &type);
        if (status < 0) {
            printf("%d: ioctl VIDIOC_STREAMOFF error\n", __LINE__);
            return -1;
        }
    	
       	FILE *fp = fopen("fram.yuv", "wr");
        for (i = 0 ; i < 50; i++) {
            buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            buffer.memory = V4L2_MEMORY_MMAP;
            status = ioctl(v4l2_fd, VIDIOC_DQBUF, &buffer);
            if (status < 0) {
                printf("%d: ioctl VIDIOC_DQBUF error\n", __LINE__);
                return -1;
            }
    
            //save_file(user_buffer[buffer.index].addr, user_buffer[buffer.index].length, i);
    
        if (fp == NULL) {                                                                  
            printf("%d: fopen error\n", __LINE__);                                         
            return -1;                                                                     
        }                                                                                  
                                                                                           
        fwrite(user_buffer[buffer.index].addr, 1, user_buffer[buffer.index].length, fp);                                                       
    
    
            buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            buffer.memory = V4L2_MEMORY_MMAP;
            buffer.m.offset = (unsigned long)user_buffer[buffer.index].addr;
            status = ioctl(v4l2_fd, VIDIOC_QBUF, &buffer);
            if (status < 0) {
                printf("%d: ioctl VIDIOC_DQBUF error\n", __LINE__);
                return -1;
            }
        }
    
        fflush(fp);                                                                        
        fclose(fp); 
        type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        status = ioctl(v4l2_fd, VIDIOC_STREAMOFF, &type);
        if (status < 0) {
            printf("%d: ioctl VIDIOC_STREAMOFF error\n", __LINE__);
            return -1;
        }
    
        close (v4l2_fd);
    
        return status;
    }
    
     HI manisha

    frame.zip

    The attachment frame.zip is the test video, Please upzip it.

    The main.c is my v4l2 source code 

    The video width is 720, height is 288

    We use v4l2 code to capture the video.

    The below is my tvp5150's config

    i2cset -f -y 0 0x5D 0x00 0x00
    i2cset -f -y 0 0x5D 0x01 0x15
    i2cset -f -y 0 0x5D 0x02 0x30
    i2cset -f -y 0 0x5D 0x03 0x6f
    i2cset -f -y 0 0x5D 0x04 0x00
    i2cset -f -y 0 0x5D 0x06 0x10
    i2cset -f -y 0 0x5D 0x07 0x60
    i2cset -f -y 0 0x5D 0x08 0x00
    i2cset -f -y 0 0x5D 0x09 0x80
    i2cset -f -y 0 0x5D 0x0A 0x80
    i2cset -f -y 0 0x5D 0x0B 0x00
    i2cset -f -y 0 0x5D 0x0C 0x80
    i2cset -f -y 0 0x5D 0x0D 0x47
    i2cset -f -y 0 0x5D 0x0E 0x00
    i2cset -f -y 0 0x5D 0x0F 0x08
    i2cset -f -y 0 0x5D 0x11 0x00
    i2cset -f -y 0 0x5D 0x12 0x00
    i2cset -f -y 0 0x5D 0x13 0x00
    i2cset -f -y 0 0x5D 0x14 0x00
    i2cset -f -y 0 0x5D 0x15 0x01
    i2cset -f -y 0 0x5D 0x16 0x00
    i2cset -f -y 0 0x5D 0x18 0xFF
    i2cset -f -y 0 0x5D 0x19 0xFF
    i2cset -f -y 0 0x5D 0x1A 0x0C
    i2cset -f -y 0 0x5D 0x1B 0x54
    i2cset -f -y 0 0x5D 0x1C 0x00
    i2cset -f -y 0 0x5D 0x1D 0x00
    i2cset -f -y 0 0x5D 0x1E 0x01
    i2cset -f -y 0 0x5D 0x27 0x20
    i2cset -f -y 0 0x5D 0x28 0x00
    i2cset -f -y 0 0x5D 0x2E 0x0F
    i2cset -f -y 0 0x5D 0x2F 0x01
    i2cset -f -y 0 0x5D 0xBB 0x00
    i2cset -f -y 0 0x5D 0xC0 0x00
    i2cset -f -y 0 0x5D 0xC1 0x40
    i2cset -f -y 0 0x5D 0xC2 0x05
    i2cset -f -y 0 0x5D 0xC8 0x80
    i2cset -f -y 0 0x5D 0xC9 0x00
    i2cset -f -y 0 0x5D 0xCA 0x00
    i2cset -f -y 0 0x5D 0xCB 0x4E
    i2cset -f -y 0 0x5D 0xCC 0x00
    i2cset -f -y 0 0x5D 0xCD 0x01
    i2cset -f -y 0 0x5D 0xCF 0x00
    i2cset -f -y 0 0x5D 0xD0 0x00
    i2cset -f -y 0 0x5D 0xFC 0x7F

    Thanks

    regards

  • Dear manisha

    Have you test the attachment?

    Whether it is jitter on the ubuntu PC.

    regards

    xixi

  • The below is my test command on th Ubuntu PC

    gst-launch-1.0 -v filesrc location=frame.yuv ! videoparse width=720 height=288 format=4 ! videoconvert ! autovideosink

    When we use the test command, the video is also jitter!

    Thanks 

    regards

  • Hi,
    I've tried omapdrmtest (git.ti.com/.../master) which can solve the jitter issue.
  • Dear user4592053

    which demo do you use and I am confusing how do you solve this issus!
    Thanks
    Regards
  • The capturevpedisplay demo which use vpe to de-interlace video through V4L2.
    You can refer capturevpedisplay.c
  • Dear user4592053
    When we use the capture capturevpedisplay, the video is also jitter
    The below is my test command
    capturevpedisplay 720 576 yuyv 720 576 nv12 1 1 -s 32:720x576
    Does the test command have problem or not?
    Can you tell what is your test command

    regards
  • My test command is :
    ./capturevpedisplay 720 288 yuyv 720 576 yuyv 1 3 -s 27:720x576
    Do you use the latest SDK?
  • Thanks for your reply

    Yes, We used the Processor 4.0 SDK, The linux kernel is 4.9.28
    if we use your test command , it will print error like below

    vpe:/dev/video0 open success!!!
    vip open success!!!
    using 1 connectors, 720x400 display, multiplanar: 1
    Setting mode 720x576 on connector 32, crtc 34
    display open success!!!
    vip: G_FMT(start): width = 720, height = 288, 4cc = YUYV
    vip: allocated buffers = 6
    vpe i/p: G_FMT: width = 720, height = 288, 4cc = YUYV
    vpe->input_buf_dmafd[0] = 7
    vpe->input_buf_dmafd[1] = 9
    vpe->input_buf_dmafd[2] = 11
    vpe->input_buf_dmafd[3] = 13
    vpe->input_buf_dmafd[4] = 15
    vpe->input_buf_dmafd[5] = 17
    vpe o/p: G_FMT: width = 720, height = 576, 4cc = YUYV
    Page flip: frame=24775, sec=3477, usec=673517, remaining=0
    vip buffer queue
    vip buffer queue
    vip buffer queue
    vip buffer queue
    vip buffer queue
    vip buffer queue
    vip dequeue buffer
    vip: DQBUF idx = 0, field = Bottom
    vpe i/p: QBUF failed: Invalid argument, index = 0
  • Thanks

    We changed to the processor 3.3 sdk, The video is not jitter when use the capturevpedisplay.
    So we think the issue is caused by the vpe element!
    And in the processor 4.0 sdk, the issue is exist, we must wait for the new sdk version or used the v4l2 program to capture video

    regards
    xixi
  • PLSDK 4.0 version has known VIP bug that is causing the QBUF issue. The issue is been resolved. I am attaching the patch for the VIP bug. You can apply the patch by running below cammands at top level PLSDK installation directory or can wait for PLSDK 4.1 release in end of 3Q.https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0020.0001_2D00_vip_2D00_add_2D00_memset_2D00_to_2D00_initialize_2D00_the_2D00_format 

    #make linux

    #make linux_install (need to set the DESTDIR in the Rules.make to point to filesystem either on SD card or NFS - what ever mean you are using)

  • Dear manisha 

    This patch can not resolve the jitter issue.

    And we can just use the vpe to deinterlace.

    regards

    xixi

  • Hi xixi,

    The patch was to address the issue you reported with PLSDK 4.0 version running capturevpedisplay application. 

    vpe i/p: QBUF failed: Invalid argument, index = 0

  • Hi manisha 

        Thanks for your reply

         And we want to know When the video jitter issue be resolved.

         That is to say we want to use the gstreamer vpe element to deinterlace but not to use the v4l2 vpe code to deinterlace.

    regards

    xixi

  • Hi xixi,

    We will look into the vpe and v4l2src gstreamer plugin to root cause the jitter with gstreamer pipeline. Please expect the patch with the fix in next 3 weeks or so.

    Regards,

    Manisha

  • HI Manisha

    Thanks for your reply.

    We will wait for your good news

    regards

    xixi