umlaeute / v4l2loopback

v4l2-loopback device
GNU General Public License v2.0
3.73k stars 531 forks source link

v4l2loopback and mpegts #222

Open MichaelDenczek opened 5 years ago

MichaelDenczek commented 5 years ago

v4l2loopback fails for communicating from GStreamer to FFMPEG using video/mpegts, MPEG Transport Stream. GStreamer version 1.8.3, FFMPEG version 4.1.3.

v4l2loopback version: 0.9.1 kernel version: Linux tegra-ubuntu 4.4.38-tegra #1 SMP PREEMPT Wed Feb 21 12:05:07 CST 2018 aarch64 aarch64 aarch64 GNU/Linux distribution: Ubuntu 16.04.5 LTS

Using GStreamer as the producer, the pipeline takes the output of the mpegtsmux element to the v4l2sink after a tee element.

The GStreamer pipeline runs, but FFMPEG fails using the virtual device indicating it cannot find a proper format for codec 'none'.

To reproduce:

Start GStreamer with virtual device and testvideosrc:

gst-launch-1.0 videotestsrc \
  !  "video/x-raw, width=1280, height=720, format=I420, framerate=30/1" \
  ! omxh264enc \
  ! 'video/x-h264, stream-format=byte-stream' \
  ! mpegtsmux \
  ! v4l2sink device="/dev/video1"

And attempt to capture stream using FFMPEG:

ffmpeg -hide_banner -re -f video4linux2 -i /dev/video1 -f null /dev/null

Which results in FFMPEG indicating the following error:

_[video4linux2,v4l2 @ 0x666160] Cannot find a proper format for codec 'none' (id 0), pixel format 'none' (id -1) Assertion *codec_id != AV_CODEC_IDNONE failed at libavdevice/v4l2.c:811 Aborted

I was really hoping I would be able to use v4l2loopback to transfer MPEG Transport Stream between GStreamer and FFMPEG.

umlaeute commented 5 years ago

unfortunately i don't have an omxh264enc GStreamer element, so I cannot reproduce.

apart from that: why are you writing to /dev/video1 but reading from /dev/video6?

MichaelDenczek commented 5 years ago

The x264enc element should work in place of the omxh264enc element. /dev/video6 was a typo which is now fixed as /dev/video1 (output from the GStreamer pipeline.