Project

General

Profile

How to creat a mux with ffmpeg .jpg to video (display .jpg webcam) ?

Added by manuel neuer over 2 years ago

I want to watch a static webcam (Picture) in TV and tried
pipe:///usr/bin/ffmpeg -i https://www.previval.org/w/images/f/fc/Testbild.jpg -c:a ac3 -f mpegts -mpegts_service_type digital_tv pipe:1
but it does not work. What can I do?


Replies (4)

RE: How to creat a mux with ffmpeg .jpg to video (display .jpg webcam) ? - Added by Jay O over 2 years ago

Can you post what it says in the debug log?

RE: How to creat a mux with ffmpeg .jpg to video (display .jpg webcam) ? - Added by manuel neuer over 2 years ago

I get:
2022-03-21 19:28:16.552 mpegts: WEBCAMFFMPEG in IPTV - tuning on IPTV
2022-03-21 19:28:16.562 spawn: Executing "/usr/bin/ffmpeg"
2022-03-21 19:28:16.564 subscription: 03C3: "192.168.178.31 [ osmc | Kodi Media Center ]" subscribing on channel "WEBCAMFFMPEG", weight: 150, adapter: "IPTV", network: "IPTV", mux: "WEBCAMFFMPEG", provider: "FFmpeg", service: "Service01", profile="htsp", hostname="192.168.178.31", username="osmc", client="Kodi Media Center"
2022-03-21 19:28:17.173 spawn: ffmpeg version 4.1.8-0+deb10u1 Copyright (c) 2000-2021 the FFmpeg developers
2022-03-21 19:28:17.174 spawn: built with gcc 8 (Debian 8.3.0-6)
2022-03-21 19:28:17.174 spawn: configuration: --prefix=/usr --extra-version=0+deb10u1 --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable
2022-03-21 19:28:17.174 spawn: libavutil 56. 22.100 / 56. 22.100
2022-03-21 19:28:17.174 spawn: libavcodec 58. 35.100 / 58. 35.100
2022-03-21 19:28:17.174 spawn: libavformat 58. 20.100 / 58. 20.100
2022-03-21 19:28:17.174 spawn: libavdevice 58. 5.100 / 58. 5.100
2022-03-21 19:28:17.174 spawn: libavfilter 7. 40.101 / 7. 40.101
2022-03-21 19:28:17.174 spawn: libavresample 4. 0. 0 / 4. 0. 0
2022-03-21 19:28:17.174 spawn: libswscale 5. 3.100 / 5. 3.100
2022-03-21 19:28:17.174 spawn: libswresample 3. 3.100 / 3. 3.100
2022-03-21 19:28:17.174 spawn: libpostproc 55. 3.100 / 55. 3.100
2022-03-21 19:28:17.605 spawn: Input #0, image2, from 'https://www.previval.org/w/images/f/fc/Testbild.jpg':
2022-03-21 19:28:17.605 spawn: Duration: 00:00:00.04, start: 0.000000, bitrate: 12541 kb/s
2022-03-21 19:28:17.607 spawn: Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 400x320 [SAR 96:96 DAR 5:4], 25 tbr, 25 tbn, 25 tbc
2022-03-21 19:28:17.609 spawn: Stream mapping:
2022-03-21 19:28:17.609 spawn: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg2video (native))
2022-03-21 19:28:17.609 spawn: Press [q] to stop, [?] for help
2022-03-21 19:28:17.621 spawn: [swscaler @ 0x12bfa30] deprecated pixel format used, make sure you did set range correctly
2022-03-21 19:28:17.646 spawn: Output #0, mpegts, to 'pipe:1':
2022-03-21 19:28:17.646 spawn: Metadata:
2022-03-21 19:28:17.646 spawn: encoder : Lavf58.20.100
2022-03-21 19:28:17.648 spawn: Stream #0:0: Video: mpeg2video (Main), yuv420p, 400x320 [SAR 1:1 DAR 5:4], q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc
2022-03-21 19:28:17.648 spawn: Metadata:
2022-03-21 19:28:17.648 spawn: encoder : Lavc58.35.100 mpeg2video
2022-03-21 19:28:17.648 spawn: Side data:
2022-03-21 19:28:17.648 spawn: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
2022-03-21 19:28:17.698 spawn: frame= 1 fps=0.0 q=7.0 Lsize= 26kB time=00:00:00.00 bitrate=19688727.3kbits/s speed=0.000123x
2022-03-21 19:28:17.698 spawn: video:24kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.262623%
2022-03-21 19:28:17.755 spawn: Executing "/usr/bin/ffmpeg"
2022-03-21 19:28:18.246 spawn: ffmpeg version 4.1.8-0+deb10u1 Copyright (c) 2000-2021 the FFmpeg developers
2022-03-21 19:28:18.247 spawn: built with gcc 8 (Debian 8.3.0-6)
2022-03-21 19:28:18.247 spawn: configuration: --prefix=/usr --extra-version=0+deb10u1 --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable
2022-03-21 19:28:18.248 spawn: libavutil 56. 22.100 / 56. 22.100
2022-03-21 19:28:18.248 spawn: libavcodec 58. 35.100 / 58. 35.100
2022-03-21 19:28:18.248 spawn: libavformat 58. 20.100 / 58. 20.100
2022-03-21 19:28:18.248 spawn: libavdevice 58. 5.100 / 58. 5.100
2022-03-21 19:28:18.248 spawn: libavfilter 7. 40.101 / 7. 40.101
and endless so on.... ( something works but I can not see anything)

But what I really am looking for is someone who sets up an own mux and tests it (what might not cost much time) and posts the
correct command line here.

RE: How to creat a mux with ffmpeg .jpg to video (display .jpg webcam) ? - Added by Jay O over 2 years ago

I'd suggest trying to get this working in ffmpeg from a terminal prompt first, outside TVHeadend.

When I try to run your command line: ffmpeg -i https://www.previval.org/w/images/f/fc/Testbild.jpg -c:a ac3 -f mpegts -mpegts_service_type digital_tv test_output.ts , I get similar errors.

You should download that jpeg locally and store it on the machine that is running TVH, so that it doesn't have to fetch from the website for every frame.

Then ffmpeg needs to know to loop that jpeg input, and what the framerate should be.

This works for me on the command line, after downloading the jpg:
ffmpeg -loop 1 -framerate 25 -i testbild.jpg -c:a ac3 -f mpegts -mpegts_service_type digital_tv out.ts

It generates an output video with the testbild. Set the bitrate to something reasonable also.

Try something like:
pipe:///usr/bin/ffmpeg -i /home/hts/testbild.jpg -c:a ac3 -f mpegts -mpegts_service_type digital_tv pipe:1

Adjust the .jpg location to match your case.

RE: How to creat a mux with ffmpeg .jpg to video (display .jpg webcam) ? - Added by manuel neuer over 2 years ago

As I need to view the webcam actually it makes no sense to store a capture on disk.
May be one day anyone will get it to work.
I will regard this thread from time to time...

    (1-4/4)