[FFmpeg-user] v4l2 overlay on mjpeg stream

Baltazár Radics baltazar.radics at gmail.com
Mon Jan 25 02:39:27 EET 2021


On Mon, Jan 25, 2021 at 12:59 AM Carl Eugen Hoyos <ceffmpeg at gmail.com>
wrote:

> For future questions:
> Please always post all information here on the mailing list, do not
> use external resources
> except for input samples.
>

Sorry, I thought I'd read to use pastesites but that must have been another
forum.

You cannot synchronize these streams because they have different start
> times,
> there should be a filter incantation that resets the timestamps of the
> second input,
> something like "setpts=PTS-STARTPTS"
>

That didn't help, but it made me read what setpts did, and apparently the
problem was that the mjpeg stream didn't have timestamps at all.
This command worked in the end: `ffmpeg -i https://192.168.11.139:8080/video
-i /dev/video3 -filter_complex
'[0:v]setpts=(RTCTIME-RTCSTART)/(TB*1000000),scale=iw*4/3:-1,crop=1280:720[cam];[1:v]scale=4*iw:-1:flags=neighbor[calc];[cam][calc]overlay'
-vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video2`

Thanks again

On Mon, Jan 25, 2021 at 12:59 AM Carl Eugen Hoyos <ceffmpeg at gmail.com>
wrote:

> Am Mo., 25. Jan. 2021 um 00:42 Uhr schrieb Baltazár Radics
> <baltazar.radics at gmail.com>:
> >
> > output of `ffmpeg -i https://192.168.11.139:8080/video
> -thread_queue_size
> > 2048 -i /dev/video3 -filter_complex
> >
> '[0:v]scale=iw*4/3:-1,crop=1280:720[cam];[1:v]scale=4*iw:-1:flags=neighbor[calc];[cam]
> > [calc]overlay' -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video2`:
> > http://ix.io/2NeC
> > output of `ffmpeg -i /dev/video0 -i /dev/video3 -filter_complex
> >
> '[0:v]scale=iw*4/3:-1[cam];[1:v]scale=4*iw:-1:flags=neighbor[calc];[cam][calc]overlay'
> > -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /de
> > v/video2`: http://ix.io/2NeD
>
> For future questions:
> Please always post all information here on the mailing list, do not
> use external resources
> except for input samples.
> And please find out what top-posting means and avoid it here.
>
> > Input #0, mpjpeg, from 'https://192.168.11.139:8080/video':
> >   Duration: N/A, bitrate: N/A
> >     Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc,
> bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25
> tbc
> > Input #1, video4linux2,v4l2, from '/dev/video3':
> >   Duration: N/A, start: 36730.385449, bitrate: 1985 kb/s
> >     Stream #1:0: Video: rawvideo (Y800 / 0x30303859), gray, 128x64, 1985
> kb/s, 30.30 fps, 30.30 tbr, 1000k tbn, 1000k tbc
>
> You cannot synchronize these streams because they have different start
> times,
> there should be a filter incantation that resets the timestamps of the
> second input,
> something like "setpts=PTS-STARTPTS"
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list