Video is not sync at the pipline start

Hi

I use Toradex Analogue Camera Adapter (ACA) to connect Camera to Ixora V1.1A board and I use a standard PAL analogue video camera as input.

The problem is when I start gstreamer pipline the video started to show from top of screen and continue until stop at the bottom of screen. I see the problem always when I:

  1. start the pipline

  2. disconnect the camera and connected it when the pipline is running.

I use different srcs and sinks but the result not different.

My Linux dmesg

Video

is there any way to solve it?
Thanks

hi @prog

Could you update to the latest Bsp 2.8b5 and check if the issue is still there?

Which commands did you use to start the pipeline?
Do you see any messages on the console, when you disconnect and reconnect the camera?

Thanks and best regards,
Jaski

Hi @jaski.tx
This is my pipline and the console messages:

root@apalis-imx6:~# gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! imxeglvivsink -e
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[  939.527237] imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_5 = 0x00000001

when I disconnect and reconnect camera do not show any message on console

I download the the latest Toradex demo image (Apalis iMX6 (2.8b5 | 2018-12-28 | 157.64 MB)) and the video result was the same.

Thanks.

Hi All,
I had the same problem and I could not solve it either.
The problem is easily seen if you disconnect and reconnect the camera to Analog Camera Adapter several times while a loopback or record pipeline is running.

Let me explain it more to recreate the problem.
1- Run the following gstreamer pipeline to display a video loopback.

gst-launch-1.0 imxv4l2videosrc ! autovideosink

2- Disconnect the camera from Analog Camera Adapter and reconnect it again several times. Most if the time you see that the image is not synced vertically. It starts scrolling or rolling downwards until it reaches the correct vertical position. Then it stops and it never happens again, until you disconnect/reconnect the input video connection.

Check these images:
Original Frame:
[upload|3IlAEmN/MLazfDkSz6QRAbGXV5Y=]

Test 01:
[upload|QCEYM/Gg16aLq+8cAYIqXJxRX0g=]

Test 02:
[upload|99Tdh/rX795hG9Af4pIy1ygfx/o=]

I searched a lot but I could not find a good answer for this problem.
The most relevant thing I found was this link: Transient vertical sync problem at CSI input

Any idea or trick to solve it would be highly appreciated.
Best Regards
MoZa

PS:
This link shows the exact same problem someone else had in other forums:
https://www.youtube.com/watch?v=WT_tbhqFV7c

HI @prog, Hi @MoZa

The problem is when I start gstreamer pipline the video started to show from top of screen and continue until stop at the bottom of screen. I see the problem always when I:
start the pipline

This is normal, the first streams from the analogue are not synchronized. You might change the driver of adv7280 to see an image first, when the Frames are synchronized.

disconnect the camera and connected it when the pipline is running.

If you disconnect and reconnect the camera, the chip of the ACA Converter needs to relock to the camera signal, thus the first frames are not synchronized. Here also you might try to change the driver to achieve what you want.

Best regards,
Jaski

ATN: @jaski.tx

Dear Jaski,

Thanks for the reply.

But I think this is not the problem with ADV7280 driver.

It would be normal if it was just 1 frame. It takes about 7 seconds for the picture to relock to VSync.
Please check [this Youtube video][1] to see what this phenomenon looks like.

Thanks again.
[1]: https://www.youtube.com/watch?v=WT_tbhqFV7c

Dear Moza

t would be normal if it was just 1 frame. It takes about 7 seconds for the picture to relock to VSync. Please check [this Youtube video][1] to see what this phenomenon looks like.

Did you try this on one of our regular Bsp images? Which camera are you using?

Dear Jaski (@jaski.tx ) I use the latest BSP image and I am using a Sony Industrial Camera. (PAL)
I even tried changing the camera (NTSC) and the result was the same.

Hi Prog ( @prog ) are you sure you have this problem when you start the pipeline.
No matter how many times I tested this problem, it never happens when I start the pipeline.
It only happens when Video is switched between two different sources or when it is disconnected and reconnected.

Try switching video with two different analog cameras:

v4l2-ctl -i 1

then

v4l2-ctl -i 2

See what happens then
Regards,
Morteza

Hi @prog

Did you try out the solution of @MoZa?

Hi @jaski.tx

Yes, I tested this but it is not a solution but it show the problem in different way!
When you have two different camera input and switch between them, the relock process takes about 7 second with picture scrolling.
The problem is after input video switch to another input (when pipeline is running) the video do not sync after one frame, it takes about 7*25 frames.

Thanks.
.

Hi @prog

Thanks for the infos. Could you have a look here, please?

Dear @jaski.tx ,
With all due respect, I think you did not get the problem.

Sync time under 1 second is acceptable. But in this case, sometimes it takes about 7 seconds for the video to stabilize.

In fact it is not a problem with ADVsync in my idea. Because the video frame looks OK. It just scrolls down until the first line of video reaches line 0.

Could you please look at the video below: https://www.youtube.com/watch?v=WT_tbhqFV7c

Best Regards.
MoZa

@Prog @jaski.tx @marcel.tx :

One solution suggested by a user at nxp forum was to use the following:

ioctl VIDIOC_STREAMOFF
//switch the adv_input
ioctl VIDIOC_QBUF
ioctl VIDIOC_STREAMON

Is it possible to run ioctl in terminal?

I tried media-ctl and v4l2-ctl but to no avail.

It seems that the trick is to stop the current stream, clear the buffer and start the stream again.

Any idea how it can be done?

Hi @jaski.tx @max.tx

I do not want to decode multiple analog video inputs on a digital bus at a same time, but I want to switch between my video inputs and decode only one of video inputs at any time.

The solution that suggested by @MoZa can be useful if you can help me to implement it.

Thanks

hi @MoZa

Thanks for you suggestion.

No you cannot run ioctl form terminal, but write a custom application in C++ to use ioctl.

Best regards,
Jaski

Hello,

did you solve the problem some way?

I’m fighting the same problem on Apalis iMX6Q with TP2828 HD video decoder connected to CSI0.

It shows rolling picture in exactly the same cases as described here - on pipeline startup and on source switching.

Even restarting gstreamer won’t help (that should perform VIDIOC_STREAMOFF and VIDIOC_STREAMON).

Did you find any solution to this problem?

Hello @MoZa,

did you solve the problem some way?

I’m fighting the same problem on Apalis iMX6Q with TP2828 HD video decoder connected to CSI0.

It shows rolling picture in exactly the same cases as described here - on pipeline startup and on source switching.

Even restarting gstreamer won’t help (that should perform VIDIOC_STREAMOFF and VIDIOC_STREAMON).

Did you find any solution to this problem?