gstreamer cannot capture color images - raspberry-pi

I am trying to use 4 camera on rPI 4. Therefore, i use a Gstreamer and i don't know how it do but my camera is always send gray capture. Can Gstreamer change camera's microcontroller? and if yes, how can i fix this issue?
thank you
gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw, format=YUY2" ! videoconvert ! "video/x-raw, format=NV12" ! videoconvert ! autovideosink
i tried this command but it doesnt work, still gray capture

Related

How to implement Seekbar for a video player playing FFmpeg pipe output in Flutter?

I was about to create a video player that can play FFmpeg pipe output in flutter. Luckily i found a solution with Github project flutter-ffmpeg, Thanks #tanersener for this amazing project https://github.com/tanersener/flutter-ffmpeg
Below I am mentioning the comment that helped me to achieve the feature i was looking for
https://github.com/tanersener/flutter-ffmpeg/issues/92#issuecomment-606051974
thanks, #reeckset also.
BTW, my current issue is, that I didn't find any solution on how to seek my video player that plays a pipe output of ffmpeg. Is there anything I can do for implementing a Seekbar in my video player

ffmpeg - different video and audio length synchronization

I have a task where the sound is longer and the image should come later.
Actually, this is exactly what I want, but it's a bit different: ffmpeg : mix audio and video of different length
First of all, I leave the picture I draw below to be understood.
Click to see the image.
By doing this I am thinking of catching sync. With which ffmpeg command can I do this?
Thank you.
I had to use offset.
I solved it this way. I will automatically add the corresponding time interval according to the difference between video and audio. I will use the programming language for this.
ffmpeg -i finalsound.flv -itsoffset 00:00:44 -i finalvideo.flv -c copy final.flv
Thank you.

VLC loop/repeat not seamless when running in remote command mode

I have a Raspberry Pi 4 running Raspbian and run VLC from a command prompt with the following parameters
vlc --intf rc --rc-host localhost:65513 --fullscreen
I have successfully gotten VLC to play a video by issuing remote commands through a Socket and have issued a repeat/loop command.
The looping doesn't have to be seamless but it momentarily cuts back to the command prompt before it replays the video and looks unprofessional.
Is there any solution to this? I cannot find anything that works. I can live with the screen staying black for a moment but can't have work presentations playing continously on a screen that shows Linux in the background every 30 seconds.
I had the same issue, here is how I "fixed it" :
set desktop background to a black jpeg.
Told the panel not to appear at launch by editing /home/pi/.config/lxsession/LXDE-pi/autostart as follow (first line that launchs the panel is commented to do so) :
##lxpanel --profile LXDE-pi
#pcmanfm --desktop --profile LXDE-pi
#xscreensaver -no -splash
Prevent the pi to blank screen or go to sleep by editing file /etc/lightdm/lightdm.conf and adding in the [SeatDefaults] section :
xserver-command=X -s 0 -dpms
Now when VLC is looping, it still cuts back to the desktop but as everything is blacked out (no panel, black background), the cut becomes invisible.
Et voilĂ  :)
My best.
S.Y.
I solved this by using two instances of VLC, whereby one instance streams the video to the other using the --sout-keep flag. This way the VLC instance actually producing an image shows a continuous stream, as the streaming instance tries to keep one stream instance open across multiple(or one looped) file.
For example:
vlc rtp://127.0.0.1 --intf dummy --fullscreen --no-video-title-show --alsa-audio-device hw:1,0 &
cvlc file.mp4 --sout "#rtp{mux=ts,dst=127.0.0.1,sdp=sap,name='somename'}" --sout-keep --loop
The same happened to me some month ago, it looks that the only one solution is to wait for the release of vlc 4.0 for raspbian too, and no plans about it.

Orientation issue with mobile recordings

When I convert .mov files from iPhone 4 and .3gp from Android with FFMPEG.
I need to rotate the video 90 degress, but iPhone 4s needs 180 degress...
Is there any way to fix this?
I don't recall how Android handles this, but iPhones record orientation information in the mov file metadata. Depending on how the camera is held while recording, videos could need 0, 90, 180, or even 270 rotation to play upright after conversion. As yet, I don't know of any additions to ffmpeg to parse this metadata, so you have to do it manually using ffprobe -show_streams or something similar, and then set the rotation appropriately.
Update: as kibitzer points out ffmpeg does now detect that the video is rotated, but does not yet provide an automatic rotation fix. Instead, you'll still have to parse out the rotation information and use a combination of the transpose, vflip, and hflip video filters to correctly rotate the video.
Newer ffmpeg returns a rotate: metadata header (when you run ffmpeg -i), which specifies an angle that the video was rotated, so you don't have to parse the rotation matrix yourself and can just rotate the video by using ffmpeg's filters.
For example, if ffmpeg output rotate: 90 then you would run something like:
ffmpeg -y -i rotated_vid.mov -vf "transpose=1" correct_video.avi
I use a program called mediainfo who show the orientation angle and put in the ffmpeg options:
-vf %ROTATE%
ffmpeg in 95% of the cases understand the orientation but there are some cases, in some hardwares...

FFmpeg on iPhone - Modifying Video Orientation

I'm messing with h264 videos loaded with FFmpeg on the iPhone 3GS. The problem is any videos recorded in "Portrait" orientation have a transformation matrix applied to them causing them to display rotated 90 degrees counter-clock.
From what I understand thus far, I just need to modify the transform matrix in the 'tkhd' atom. The problem is I am having trouble accessing or modifying this data. I checked out the FFmpeg implementation for:
static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
which clearly shows how the matrix is accessed in avformat but when I try to access the header bytes using the same functions I am not getting any rational values. Even if I were to successfully pull the matrix I'm not sure how to replace it? FFmpeg has functions for retrieving and appending to the track header but nothing for replace it seems?
Any help would be greatly appreciated.
Thanks,
Matt.
To those who cannot get the v filter option to work, after some searching I found an alternative option which works for my build:
ffmpeg -i in.avi -vf "transpose=1" out.avi
this flips the video 90 degrees clockwise. hope this helps all those on ubuntu struggling like I was!! :)
I just had a patch accepted on the FFMPEG git master branch which should help all of us in adjusting for the iPhone's orientation and subsequent transform applied to the .mov file it sends out. FFMPEG will now send back in metadata:
'rotate'=90,180,or 270 depending on how many degrees you need to turn the image clockwise to get the true rotation.
Portrait video recorded in iPhone 3GS is strangely rotated in landscape, and only quicktime plays it correctly, players like VLC etc play the portrait mode videos in landscape because it is encoded that way! Maybe apple have set some bit so that quicktime identifies and sets the orientation properly.
You can use -vfilters option of ffmpeg to rotate the video. It is available in version r21242. You have to patch it on your version of ffmpeg.
configure the build by using --enable-vfilters
and you can use the option:
ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4
to rotate the input movie.
the movie is recorded directly with the orientation of the hardware camera. when you turn it the camera still records with the same orientation and the same straight write to file.
What determines the orientation of the video is the Transform matrix
The matrix is set dependent on the iphone's orientation. And this is what will determine if you have to rotate the video. And that rotation could be 90 degrees and it could be 180 degrees. It depends on the phone orientation.
After you get an idea of what the matrix is and how it relates to the image you will be able to determine the orientation of the video.