<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><br><blockquote type="cite"><div>On Mar 1, 2023, at 1:12 PM, Peter Bennett <pb.mythtv@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div><br>On 3/1/23 11:00, Jay Harbeston wrote:<br><blockquote type="cite">I did check out your lean capture page, and I used the test on it to see how it fared as far as cpu usage, and the RPI4 stinks in comparison to what you are using. The events per second for the RPi 4 processor is 393, so that is a non starter for trying to use transcode with H264.<br><br>I did try just copying to mpegts , but I couldn’t view video using it, either with vlc or mythtv.<br><br>The best success I have had is creating an mkv, or an avi, but have not been able to get mythtv to accept it via a pipe.<br><br>Looks like I am SOL then when using the RPI4 as the capture for the USB HDMI .<br><br>UNLESS there is some other magic!?<br><br>Some of the other experiments I tried were to treat it as a v4l2 capture device(there look like there are a couple of choices as tuners in Mythtv) since it is v4l2 video, but that was also a fail. I’m guessing the v4l2 driver is only looking for 640x480 video likes old school analog tv?<br><br></blockquote>Did you try using ffmpeg using copy to prevent encoding and specifying ts output, something like this -<br><br>ffmpeg -hide_banner -loglevel error -f v4l2 -thread_queue_size 256 -input_format mjpeg \<br> -framerate 60 -video_size 1280x720 \<br> -use_wallclock_as_timestamps 1 \<br> -i /dev/video0 -f alsa -ac 2 -ar 48000 -thread_queue_size 1024 \<br> -itsoffset 0.150 -i hw:2.0 \<br> -c:v copy -vf format=yuv420p -c:a copy \<br> -f mpegts outfile.ts<br><br>This may not work if ts format does not support mjpeg or the audio format.<br><br>The alsa audio requires you to find the correct audio device and to disable pulseaudio. I have a script to find the alsa device.<br></div></div></blockquote></div><br><div>I am using fixes/32.0-40 from the mythtv lite packages from Peter if that makes a difference regarding how mythtv accepts the output.</div><div><br></div><div><br></div><div>I tried the above example, modified slightly to suit my command, and the following occurred: </div><div><br></div><div>The only big change to your command was to use pulse default instead of also as the input for audio. I also used 1920x1080 resolution and 30 fps frame rate. </div><div><br></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">ffmpeg -f pulse -thread_queue_size 1024 -i default -f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 1920x1080 -framerate 30 -use_wallclock_as_timestamps 1 -i /dev/video0 -f mpegts -c:v yuv420p -c:a copy ~/outfile.ts</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">The output encoder is having troubles as shown in the error:<br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavutil 56. 51.100 / 56. 51.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavcodec 58. 91.100 / 58. 91.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavformat 58. 45.100 / 58. 45.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavdevice 58. 10.100 / 58. 10.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavfilter 7. 85.100 / 7. 85.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavresample 4. 0. 0 / 4. 0. 0</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libswscale 5. 7.100 / 5. 7.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libswresample 3. 7.100 / 3. 7.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libpostproc 55. 7.100 / 55. 7.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">Guessed Channel Layout for Input Stream #0.0 : stereo</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">Input #0, pulse, from 'default':</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Duration: N/A, start: 1677702787.763392, bitrate: 1536 kb/s</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">[mjpeg @ 0x1606550] EOI missing, emulating</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">Input #1, video4linux2,v4l2, from '/dev/video0':</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Duration: N/A, start: 1677702788.117759, bitrate: N/A</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">Unknown encoder 'yuv420p'</span></div><div><br></div><div><br></div><div>Here is what I am using that gives me audio and video that can be played by vlc. The bit rate for mkv is around 10,000kbps less than the avi.</div><div><br></div><div>The bit rate for mkv is ~34,000 kbps while Avi below is ~45,000kbps.</div><div><br></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">###################################################################################</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">ffmpeg to create mkv stream that works correctly, including being able to watch using vlc while recording:</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">ffmpeg -f pulse -thread_queue_size 1024 -i default -f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 1920x1080 -framerate 30 -i /dev/video0 -f matroska -codec copy pipe:1 > ~/file.mkv</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">ffprobe file.mkv</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavutil 56. 51.100 / 56. 51.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavcodec 58. 91.100 / 58. 91.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavformat 58. 45.100 / 58. 45.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavdevice 58. 10.100 / 58. 10.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavfilter 7. 85.100 / 7. 85.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libavresample 4. 0. 0 / 4. 0. 0</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libswscale 5. 7.100 / 5. 7.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libswresample 3. 7.100 / 3. 7.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> libpostproc 55. 7.100 / 55. 7.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">[mjpeg @ 0x16e0c60] EOI missing, emulating</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">[matroska,webm @ 0x16de540] Estimating duration from bitrate, this may be inaccurate</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">Input #0, matroska,webm, from 'file.mkv':</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Metadata:</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> ENCODER : Lavf58.45.100</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Duration: 01:25:19.33, start: 0.000000, bitrate: 1536 kb/s</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"> Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">#######################################################################################</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">ffmpeg to create avi stream that works correctly including being able to watch using vlc while recording:</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">ffmpeg -f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 1920x1080 -framerate 30 -i /dev/video0 -f pulse -thread_queue_size 1024 -i default -codec copy vid_1080p_30.avi</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br></span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">I have had no dropouts using the above methods, and ffmpeg uses ~15% of cpu according to top while capturing with either of the above.</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;"><br></span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Palatino-Roman;">Regards!</span></div></body></html>