Mailing List Archive

Recording from input video on demand, no tuner
I’m wondering how this would work using the external video recorder as the tuner. I’d like to be able to start ‘watching’ the video input, with no tuning required.

While ‘watching ‘ the tuner, I’d like to be able to use the record button to start recording.. and then at predetermined time hit the record again to stop recording.

Again, no tuning will be involved, just starting and stopping the external tuner.

Regards,

Jay
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner [ In reply to ]
Here's what I do, this may work for you.

1. I have a VOD "channel" in my program guide (channel 1)
2. I've modified my channel change script such that when channe1 1 is
requested the script immediately exits and indicates success
3. I wade through the VOD menu and determine what I want to record and
how long it will last.
4. I set-up a manual record on channel 1 to start at a specified time
and record for the specified length.
5. I start the VOD program then immediately pause.
6. Once recording stops, I un-pause and walk away

Bob

On 2/19/23 13:30, Jay Harbeston wrote:
>
> I’m wondering how this would work using the external video recorder as the tuner. I’d like to be able to start ‘watching’ the video input, with no tuning required.
>
> While ‘watching ‘ the tuner, I’d like to be able to use the record button to start recording.. and then at predetermined time hit the record again to stop recording.
>
> Again, no tuning will be involved, just starting and stopping the external tuner.
>
> Regards,
>
> Jay
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner [ In reply to ]
Sorry, step 6 should be:
6. Once recording starts, I un-pause the VOD program and walk away

On 2/25/23 11:11, Bob wrote:
> Here's what I do, this may work for you.
>
> 1. I have a VOD "channel" in my program guide (channel 1)
> 2. I've modified my channel change script such that when channe1 1 is
> requested the script immediately exits and indicates success
> 3. I wade through the VOD menu and determine what I want to record and
> how long it will last.
> 4. I set-up a manual record on channel 1 to start at a specified time
> and record for the specified length.
> 5. I start the VOD program then immediately pause.
> 6. Once recording stops, I un-pause and walk away
>
> Bob
>
> On 2/19/23 13:30, Jay Harbeston wrote:
>>
>> I’m wondering how this would work using the external video recorder as
>> the tuner.  I’d like to be able to start ‘watching’ the video input,
>> with no tuning required.
>>
>> While ‘watching ‘ the tuner, I’d like to be able to use the record
>> button to start recording.. and then at predetermined time hit the
>> record again to stop recording.
>>
>> Again, no tuning will be involved, just starting and stopping the
>> external tuner.
>>
>> Regards,
>>
>> Jay
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users@mythtv.org
>> http://lists.mythtv.org/mailman/listinfo/mythtv-users
>> http://wiki.mythtv.org/Mailing_List_etiquette
>> MythTV Forums: https://forum.mythtv.org
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner [ In reply to ]
On Sun, Feb 19, 2023 at 12:32 PM Jay Harbeston <jharbestonus@gmail.com>
wrote:

>
> I’m wondering how this would work using the external video recorder as the
> tuner. I’d like to be able to start ‘watching’ the video input, with no
> tuning required.
>
> While ‘watching ‘ the tuner, I’d like to be able to use the record button
> to start recording.. and then at predetermined time hit the record again to
> stop recording.
>
> Again, no tuning will be involved, just starting and stopping the external
> tuner.
>

Hi Jay,

I don't know if it will help you, but as of Mythtv v33, the
mythexternrecorder application now lets you set "per channel" tuning
command. See:
https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example

That means your tuning command could be a no-op for specific channels that
you have defined.

John
Re: Recording from input video on demand, no tuner [ In reply to ]
> On Feb 25, 2023, at 1:21 PM, John P Poet <jppoet@gmail.com> wrote:
>
> On Sun, Feb 19, 2023 at 12:32 PM Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>
>> I’m wondering how this would work using the external video recorder as the tuner. I’d like to be able to start ‘watching’ the video input, with no tuning required.
>>
>> While ‘watching ‘ the tuner, I’d like to be able to use the record button to start recording.. and then at predetermined time hit the record again to stop recording.
>>
>> Again, no tuning will be involved, just starting and stopping the external tuner.
>
> Hi Jay,
>
> I don't know if it will help you, but as of Mythtv v33, the mythexternrecorder application now lets you set "per channel" tuning command. See:
> https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example
>
> That means your tuning command could be a no-op for specific channels that you have defined.
>
> John


Thanks all, I will check that out

Regards!
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
>
>>
>> I don't know if it will help you, but as of Mythtv v33, the mythexternrecorder application now lets you set "per channel" tuning command. See:
>> https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example
>>
>> That means your tuning command could be a no-op for specific channels that you have defined.
>>
>> John
>
>

So I have been ‘experimenting’ with this and I think I have set up something incorrect for incoming video.

The hdmi device is usb, one of those that are 10-20 bucks, and from what I can tell it is creating a v4l2 mjpeg video stream with a PCM audio stream on USB audio.

Using ffmpeg, I can create an avi with it, and also an mkv with it , and have tried multiple ways to create an output stream for mythtv to use.

I am trying to keep processing down to a minimal amount since I am trying to use a Raspberry Pi 4b with 4GB ram running mythbackend to capture the video stream.

If I try to use any mpeg2 or mp4 transcoding, I get in trouble with using too much cpu. Any ideas as to what I can try to capture with little or no transcoding effort on the RPI 4b? Or am I asking too much from the RPI4 to capture it.

Regards!
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On Tue, 28 Feb 2023 14:39:03 -0500, you wrote:

>
>
>>
>>>
>>> I don't know if it will help you, but as of Mythtv v33, the mythexternrecorder application now lets you set "per channel" tuning command. See:
>>> https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example
>>>
>>> That means your tuning command could be a no-op for specific channels that you have defined.
>>>
>>> John
>>
>>
>
>So I have been ?experimenting? with this and I think I have set up something incorrect for incoming video.
>
>The hdmi device is usb, one of those that are 10-20 bucks, and from what I can tell it is creating a v4l2 mjpeg video stream with a PCM audio stream on USB audio.
>
>Using ffmpeg, I can create an avi with it, and also an mkv with it , and have tried multiple ways to create an output stream for mythtv to use.
>
>I am trying to keep processing down to a minimal amount since I am trying to use a Raspberry Pi 4b with 4GB ram running mythbackend to capture the video stream.
>
>If I try to use any mpeg2 or mp4 transcoding, I get in trouble with using too much cpu. Any ideas as to what I can try to capture with little or no transcoding effort on the RPI 4b? Or am I asking too much from the RPI4 to capture it.
>
>Regards!

I know nothing about those cheap devices, but the first thing I would
try would be to just store the data directly to a .ts file, as
mythbackend does for DVB streams. If mythfrontend can play the
result, then all is well. If not, then you can set up an automatic
non-real time transcoding job to be run at low priority after the
recording finishes (or the job can be run in parallel with the
recording).
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On 2/28/23 2:39 PM, Jay Harbeston wrote:
> I am trying to keep processing down to a minimal amount since I am
> trying to use a Raspberry Pi 4b with 4GB ram running mythbackend to
> capture the video stream.
>
> If I try to use any mpeg2 or mp4 transcoding, I get in trouble with
> using too much cpu. Any ideas as to what I can try to capture with
> little or no transcoding effort on the RPI 4b? Or am I asking too much
> from the RPI4 to capture it.

I'd suggest using the mkv codec. Various people have done comparison
charts that show the tradeoff between compression speed, file size and
quality when using the different presets. Here is one example:

https://write.corbpie.com/ffmpeg-preset-comparison-x264-2019-encode-speed-and-file-size/

Watch the frame rate as it's encoding. If the FPS drops below the rate
of the material being recorded for more than a short time, you know
you're overtaxing the CPU.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On 2/28/23 20:52, Stephen Worthington wrote:
> On Tue, 28 Feb 2023 14:39:03 -0500, you wrote:
>
>>
>>>> I don't know if it will help you, but as of Mythtv v33, the mythexternrecorder application now lets you set "per channel" tuning command. See:
>>>> https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example
>>>>
>>>> That means your tuning command could be a no-op for specific channels that you have defined.
>>>>
>>>> John
>>>
>> So I have been ‘experimenting’ with this and I think I have set up something incorrect for incoming video.
>>
>> The hdmi device is usb, one of those that are 10-20 bucks, and from what I can tell it is creating a v4l2 mjpeg video stream with a PCM audio stream on USB audio.
>>
>> Using ffmpeg, I can create an avi with it, and also an mkv with it , and have tried multiple ways to create an output stream for mythtv to use.
>>
>> I am trying to keep processing down to a minimal amount since I am trying to use a Raspberry Pi 4b with 4GB ram running mythbackend to capture the video stream.
>>
>> If I try to use any mpeg2 or mp4 transcoding, I get in trouble with using too much cpu. Any ideas as to what I can try to capture with little or no transcoding effort on the RPI 4b? Or am I asking too much from the RPI4 to capture it.
>>
>> Regards!
> I know nothing about those cheap devices, but the first thing I would
> try would be to just store the data directly to a .ts file, as
> mythbackend does for DVB streams. If mythfrontend can play the
> result, then all is well. If not, then you can set up an automatic
> non-real time transcoding job to be run at low priority after the
> recording finishes (or the job can be run in parallel with the
> recording).

FWIW I have been using those USB devices for about 2 years as my main
MythTV capture devices. The scripts and info are here:

https://github.com/bennettpeter/MythTV-LeanCapture#readme

My scripts encode to H264. The RPI is far too slow to encode the stream
(as noted in the readme). You may be able to change the ffmpeg
parameters to output an MJPEG TS without any encoding.

Peter

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
> On Mar 1, 2023, at 9:13 AM, Peter Bennett <pb.mythtv@gmail.com> wrote:
>
>
> On 2/28/23 20:52, Stephen Worthington wrote:
>> On Tue, 28 Feb 2023 14:39:03 -0500, you wrote:
>>
>>>
>>>>> I don't know if it will help you, but as of Mythtv v33, the mythexternrecorder application now lets you set "per channel" tuning command. See:
>>>>> https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example
>>>>>
>>>>> That means your tuning command could be a no-op for specific channels that you have defined.
>>>>>
>>>>> John
>>>>
>>> So I have been ‘experimenting’ with this and I think I have set up something incorrect for incoming video.
>>>
>>> The hdmi device is usb, one of those that are 10-20 bucks, and from what I can tell it is creating a v4l2 mjpeg video stream with a PCM audio stream on USB audio.
>>>
>>> Using ffmpeg, I can create an avi with it, and also an mkv with it , and have tried multiple ways to create an output stream for mythtv to use.
>>>
>>> I am trying to keep processing down to a minimal amount since I am trying to use a Raspberry Pi 4b with 4GB ram running mythbackend to capture the video stream.
>>>
>>> If I try to use any mpeg2 or mp4 transcoding, I get in trouble with using too much cpu. Any ideas as to what I can try to capture with little or no transcoding effort on the RPI 4b? Or am I asking too much from the RPI4 to capture it.
>>>
>>> Regards!
>> I know nothing about those cheap devices, but the first thing I would
>> try would be to just store the data directly to a .ts file, as
>> mythbackend does for DVB streams. If mythfrontend can play the
>> result, then all is well. If not, then you can set up an automatic
>> non-real time transcoding job to be run at low priority after the
>> recording finishes (or the job can be run in parallel with the
>> recording).
>
> FWIW I have been using those USB devices for about 2 years as my main MythTV capture devices. The scripts and info are here:
>
> https://github.com/bennettpeter/MythTV-LeanCapture#readme
>
> My scripts encode to H264. The RPI is far too slow to encode the stream (as noted in the readme). You may be able to change the ffmpeg parameters to output an MJPEG TS without any encoding.
>
> Peter

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.

I did try just copying to mpegts , but I couldn’t view video using it, either with vlc or mythtv.

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.

Looks like I am SOL then when using the RPI4 as the capture for the USB HDMI .

UNLESS there is some other magic!?

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?

Regards!
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On Wed, 1 Mar 2023 11:00:35 -0500, you wrote:

>
>
>> On Mar 1, 2023, at 9:13 AM, Peter Bennett <pb.mythtv@gmail.com> wrote:
>>
>>
>> On 2/28/23 20:52, Stephen Worthington wrote:
>>> On Tue, 28 Feb 2023 14:39:03 -0500, you wrote:
>>>
>>>>
>>>>>> I don't know if it will help you, but as of Mythtv v33, the mythexternrecorder application now lets you set "per channel" tuning command. See:
>>>>>> https://www.mythtv.org/wiki/Example_Configuration_files#Mythtv_v33_Example
>>>>>>
>>>>>> That means your tuning command could be a no-op for specific channels that you have defined.
>>>>>>
>>>>>> John
>>>>>
>>>> So I have been ?experimenting? with this and I think I have set up something incorrect for incoming video.
>>>>
>>>> The hdmi device is usb, one of those that are 10-20 bucks, and from what I can tell it is creating a v4l2 mjpeg video stream with a PCM audio stream on USB audio.
>>>>
>>>> Using ffmpeg, I can create an avi with it, and also an mkv with it , and have tried multiple ways to create an output stream for mythtv to use.
>>>>
>>>> I am trying to keep processing down to a minimal amount since I am trying to use a Raspberry Pi 4b with 4GB ram running mythbackend to capture the video stream.
>>>>
>>>> If I try to use any mpeg2 or mp4 transcoding, I get in trouble with using too much cpu. Any ideas as to what I can try to capture with little or no transcoding effort on the RPI 4b? Or am I asking too much from the RPI4 to capture it.
>>>>
>>>> Regards!
>>> I know nothing about those cheap devices, but the first thing I would
>>> try would be to just store the data directly to a .ts file, as
>>> mythbackend does for DVB streams. If mythfrontend can play the
>>> result, then all is well. If not, then you can set up an automatic
>>> non-real time transcoding job to be run at low priority after the
>>> recording finishes (or the job can be run in parallel with the
>>> recording).
>>
>> FWIW I have been using those USB devices for about 2 years as my main MythTV capture devices. The scripts and info are here:
>>
>> https://github.com/bennettpeter/MythTV-LeanCapture#readme
>>
>> My scripts encode to H264. The RPI is far too slow to encode the stream (as noted in the readme). You may be able to change the ffmpeg parameters to output an MJPEG TS without any encoding.
>>
>> Peter
>
>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.
>
>I did try just copying to mpegts , but I couldn?t view video using it, either with vlc or mythtv.
>
>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.
>
>Looks like I am SOL then when using the RPI4 as the capture for the USB HDMI .
>
>UNLESS there is some other magic!?
>
>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?
>
>Regards!

If you can record the raw data to disk, then transcoding later should
work. Try using ffprobe (or mythffprobe) on the raw file to see if it
is a valid format for ffmpeg to transcode. If you make a small
recording as an example and can upload it somewhere, I would be happy
have a look to see to see what works to transcode it. I have an RPi4
to test on.

With transcoding on any CPU that can not keep up with realtime
transcoding, you normally need to use nice (and possibly also ionice)
to reduce the priority of the transcoding process so that it does not
interfere with any recordings happening at the time. You can tell
mythbackend how many transcodings it is allowed to run at once, so on
an RPi4 if transcoding is a single core only process (which it often
is) then it might be able to run one per core at the same time, or run
three at once to leave one core to run recordings. It might take an
RPi4 several hours to transcode a one hour recording, or even longer,
but if you can just leave it on 24/7 and there are not too many
recordings happening, it should be able to catch up between
recordings.

There is also a big advantage to doing a transcoding from a file
rather than a recording stream, as you can use two pass transcoding
where the first pass works out where to use high or low bit rates and
the second pass does the actual transcoding to the requested average
bit rate. When you are transcoding a stream or using one pass
transcoding, the transcoding process can only buffer a small amount of
the stream to enable it to look ahead and decide what needs lots of
bits and what needs only a few bits to encode it well. So the quality
of the result is much lower.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On Wed, Mar 1, 2023 at 4:03 PM Jay Harbeston <jharbestonus@gmail.com> wrote:

> Looks like I am SOL then when using the RPI4 as the capture for the USB HDMI .
>
> UNLESS there is some other magic!?

There are some (typically very expensive) HDMI to USB
encoders that will output a H.264 transport stream. It
may be cheaper to purchase a faster PC.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On 3/1/23 11:00, Jay Harbeston wrote:
> 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.
>
> I did try just copying to mpegts , but I couldn’t view video using it,
> either with vlc or mythtv.
>
> 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.
>
> Looks like I am SOL then when using the RPI4 as the capture for the
> USB HDMI .
>
> UNLESS there is some other magic!?
>
> 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?
>
Did you try using ffmpeg using copy to prevent encoding and specifying
ts output, something like this -

ffmpeg -hide_banner -loglevel error -f v4l2 -thread_queue_size 256
-input_format mjpeg \
  -framerate 60 -video_size 1280x720 \
  -use_wallclock_as_timestamps 1 \
  -i /dev/video0 -f alsa -ac 2 -ar 48000 -thread_queue_size 1024 \
  -itsoffset 0.150 -i hw:2.0 \
  -c:v copy -vf format=yuv420p  -c:a copy \
  -f mpegts outfile.ts

This may not work if ts format does not support mjpeg or the audio format.

The alsa audio requires you to find the correct audio device and to
disable pulseaudio. I have a script to find the alsa device.

Peter



_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
> On Mar 1, 2023, at 1:12 PM, Peter Bennett <pb.mythtv@gmail.com> wrote:
>
>
> On 3/1/23 11:00, Jay Harbeston wrote:
>> 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.
>>
>> I did try just copying to mpegts , but I couldn’t view video using it, either with vlc or mythtv.
>>
>> 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.
>>
>> Looks like I am SOL then when using the RPI4 as the capture for the USB HDMI .
>>
>> UNLESS there is some other magic!?
>>
>> 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?
>>
> Did you try using ffmpeg using copy to prevent encoding and specifying ts output, something like this -
>
> ffmpeg -hide_banner -loglevel error -f v4l2 -thread_queue_size 256 -input_format mjpeg \
> -framerate 60 -video_size 1280x720 \
> -use_wallclock_as_timestamps 1 \
> -i /dev/video0 -f alsa -ac 2 -ar 48000 -thread_queue_size 1024 \
> -itsoffset 0.150 -i hw:2.0 \
> -c:v copy -vf format=yuv420p -c:a copy \
> -f mpegts outfile.ts
>
> This may not work if ts format does not support mjpeg or the audio format.
>
> The alsa audio requires you to find the correct audio device and to disable pulseaudio. I have a script to find the alsa device.

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.


I tried the above example, modified slightly to suit my command, and the following occurred:

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.

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

The output encoder is having troubles as shown in the error:

libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
Duration: N/A, start: 1677702787.763392, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[mjpeg @ 0x1606550] EOI missing, emulating
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 1677702788.117759, bitrate: N/A
Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Unknown encoder 'yuv420p'


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.

The bit rate for mkv is ~34,000 kbps while Avi below is ~45,000kbps.

###################################################################################

ffmpeg to create mkv stream that works correctly, including being able to watch using vlc while recording:

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


ffprobe file.mkv

libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[mjpeg @ 0x16e0c60] EOI missing, emulating
[matroska,webm @ 0x16de540] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'file.mkv':
Metadata:
ENCODER : Lavf58.45.100
Duration: 01:25:19.33, start: 0.000000, bitrate: 1536 kb/s
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)


#######################################################################################

ffmpeg to create avi stream that works correctly including being able to watch using vlc while recording:

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

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.

Regards!
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On 3/1/23 15:58, Jay Harbeston wrote:
>
>
>> On Mar 1, 2023, at 1:12 PM, Peter Bennett <pb.mythtv@gmail.com> wrote:
>>
>>
>> On 3/1/23 11:00, Jay Harbeston wrote:
>>> 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.
>>>
>>> I did try just copying to mpegts , but I couldn’t view video using
>>> it, either with vlc or mythtv.
>>>
>>> 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.
>>>
>>> Looks like I am SOL then when using the RPI4 as the capture for the
>>> USB HDMI .
>>>
>>> UNLESS there is some other magic!?
>>>
>>> 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?
>>>
>> Did you try using ffmpeg using copy to prevent encoding and
>> specifying ts output, something like this -
>>
>> ffmpeg -hide_banner -loglevel error -f v4l2 -thread_queue_size 256
>> -input_format mjpeg \
>>   -framerate 60 -video_size 1280x720 \
>>   -use_wallclock_as_timestamps 1 \
>>   -i /dev/video0 -f alsa -ac 2 -ar 48000 -thread_queue_size 1024 \
>>   -itsoffset 0.150 -i hw:2.0 \
>>   -c:v copy -vf format=yuv420p  -c:a copy \
>>   -f mpegts outfile.ts
>>
>> This may not work if ts format does not support mjpeg or the audio
>> format.
>>
>> The alsa audio requires you to find the correct audio device and to
>> disable pulseaudio. I have a script to find the alsa device.
>
> 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.
>
>
> I tried the above example, modified slightly to suit my command, and
> the following occurred:
>
> 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.
>
> 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
>
> The output encoder is having troubles as shown in the error:
>
>  libavutil      56. 51.100 / 56. 51.100
>  libavcodec     58. 91.100 / 58. 91.100
>  libavformat    58. 45.100 / 58. 45.100
>  libavdevice    58. 10.100 / 58. 10.100
>  libavfilter     7. 85.100 /  7. 85.100
>  libavresample   4.  0.  0 /  4.  0.  0
>  libswscale      5.  7.100 /  5.  7.100
>  libswresample   3.  7.100 /  3.  7.100
>  libpostproc    55.  7.100 / 55.  7.100
> Guessed Channel Layout for Input Stream #0.0 : stereo
> Input #0, pulse, from 'default':
>  Duration: N/A, start: 1677702787.763392, bitrate: 1536 kb/s
>    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
> [mjpeg @ 0x1606550] EOI missing, emulating
> Input #1, video4linux2,v4l2, from '/dev/video0':
>  Duration: N/A, start: 1677702788.117759, bitrate: N/A
>    Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc,
> bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
> Unknown encoder 'yuv420p'
>
>
> 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.
>
> The bit rate for mkv is ~34,000 kbps while Avi below is ~45,000kbps.
>
> ###################################################################################
>
> ffmpeg to create mkv stream  that works correctly, including being
> able to watch using vlc while recording:
>
> 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
>
>
> ffprobe file.mkv
>
>  libavutil      56. 51.100 / 56. 51.100
>  libavcodec     58. 91.100 / 58. 91.100
>  libavformat    58. 45.100 / 58. 45.100
>  libavdevice    58. 10.100 / 58. 10.100
>  libavfilter     7. 85.100 /  7. 85.100
>  libavresample   4.  0.  0 /  4.  0.  0
>  libswscale      5.  7.100 /  5.  7.100
>  libswresample   3.  7.100 /  3.  7.100
>  libpostproc    55.  7.100 / 55.  7.100
> [mjpeg @ 0x16e0c60] EOI missing, emulating
> [matroska,webm @ 0x16de540] Estimating duration from bitrate, this may
> be inaccurate
> Input #0, matroska,webm, from 'file.mkv':
>  Metadata:
>    ENCODER         : Lavf58.45.100
>  Duration: 01:25:19.33, start: 0.000000, bitrate: 1536 kb/s
>    Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc,
> bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1k tbn, 1k tbc
> (default)
>    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
> (default)
>
>
> #######################################################################################
>
> ffmpeg to create avi stream that works correctly including being able
> to watch using vlc while recording:
>
> 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
>
> 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.
>
> Regards!
>
> _______________________________________________

Looks good, so if you change your format to -f mpegts and the file to
have a ts extension, does that work? If so you may be able to use that
ffmpeg command to create a stream into mythtv using the external recorder.

Peter
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
> On Mar 2, 2023, at 9:39 AM, Peter Bennett <pb.mythtv@gmail.com> wrote:
> Looks good, so if you change your format to -f mpegts and the file to have a ts extension, does that work? If so you may be able to use that ffmpeg command to create a stream into mythtv using the external recorder.
>
> Peter
>

So I took the commands to create the mkv and avi files and changed the output to -f mpegts, and while it created a file with what looks like the same bit rate, mythffprobe/ffprobe didn’t like the resulting .ts file.

I don’t think it matters which command I try to modify to become the ts file since the inputs for audio and video are the same.

I am pasting information here regarding the creation of the ts file as follows:

#############################################################################

Using the mkv version of the command line and changing -f matroska to -f mpegts

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 mpegts -codec copy pipe:1 > ~/file.ts



libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
Duration: N/A, start: 1677770329.137014, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 1187563.678101, bitrate: N/A
Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Output #0, mpegts, to 'pipe:1':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn, 1000k tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x7af170] Stream 0, codec mjpeg, is muxed as a private data stream and may not be recognized upon reading.
[mpegts @ 0x7af170] Stream 1, codec pcm_s16le, is muxed as a private data stream and may not be recognized upon reading.
frame= 16 fps=0.0 q=-1.0 size= 4030kB time=00:00:00.52 bitrate=62506.7kbits
frame= 31 fps= 31 q=-1.0 size= 6697kB time=00:00:01.02 bitrate=53353.8kbits

and the bit rate reflects that there is video/audio being captured, but ffprobe doesn’t like it.

######################################################################################

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 -f mpegts -codec copy vid_1080p_30.ts


libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[mjpeg @ 0x2194eb0] EOI missing, emulating
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 1191788.917809, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, pulse, from 'default':
Duration: N/A, start: 1677774554.726233, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'vid_1080p_30.ts' already exists. Overwrite? [y/N] y
Output #0, mpegts, to 'vid_1080p_30.ts':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn, 1000k tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x219e880] Stream 0, codec mjpeg, is muxed as a private data stream and may not be recognized upon reading.
[mpegts @ 0x219e880] Stream 1, codec pcm_s16le, is muxed as a private data stream and may not be recognized upon reading.
[mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous: 13490, current: 13485; changing to 13491. This may result in incorrect timestamps in the output file.
[mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous: 16219, current: 16201; changing to 16220. This may result in incorrect timestamps in the output file.
[mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous: 34791, current: 34788; changing to 34792. This may result in incorrect timestamps in the output file.
[mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous: 110242, current: 110233; changing to 110243. This may result in incorrect timestamps in the output file.
frame= 45 fps=0.0 q=-1.0 size= 6400kB time=00:00:03.16 bitrate=16568.0kbits
frame= 60 fps= 59 q=-1.0 size= 10752kB time=00:00:03.66 bitrate=24035.9kbits
frame= 75 fps= 49 q=-1.0 size= 15104kB time=00:00:04.16 bitrate=29710.3kbits

Results from above:

ffprobe vid_1080p_30.ts

libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mpegts, from 'vid_1080p_30.ts':
Duration: N/A, bitrate: N/A



I’m guessing that I’m gonna have to give up on trying to capture directly into mythtv? I can create a test file as either the mkv or avi, or the ‘broken’ ts file If needed.


Thanks in advance, and Regards!
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
On 02/03/2023 16:39, Jay Harbeston wrote:
>
>
>> On Mar 2, 2023, at 9:39 AM, Peter Bennett <pb.mythtv@gmail.com> wrote:
>>
>> Looks good, so if you change your format to -f mpegts and the file to
>> have a ts extension, does that work? If so you may be able to use that
>> ffmpeg command to create a stream into mythtv using the external recorder.
>>
>> Peter
>>
>
> So I took the commands to create the mkv and avi files and changed the
> output to -f mpegts, and while it created a file with what looks like
> the same bit rate, mythffprobe/ffprobe didn’t like the resulting .ts file.
>
> I don’t think it matters which command I try to modify to become the ts
> file since the inputs for audio and video are the same.
>
> I am pasting information here regarding the creation of the ts file as
> follows:
>
> #############################################################################
>
> Using the mkv version of the command line and changing -f matroska to -f
> mpegts
>
> 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 mpegts -codec copy pipe:1 > ~/file.ts
>
>
>
>  libavutil      56. 51.100 / 56. 51.100
>  libavcodec     58. 91.100 / 58. 91.100
>  libavformat    58. 45.100 / 58. 45.100
>  libavdevice    58. 10.100 / 58. 10.100
>  libavfilter     7. 85.100 /  7. 85.100
>  libavresample   4.  0.  0 /  4.  0.  0
>  libswscale      5.  7.100 /  5.  7.100
>  libswresample   3.  7.100 /  3.  7.100
>  libpostproc    55.  7.100 / 55.  7.100
> Guessed Channel Layout for Input Stream #0.0 : stereo
> Input #0, pulse, from 'default':
>  Duration: N/A, start: 1677770329.137014, bitrate: 1536 kb/s
>    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
> Input #1, video4linux2,v4l2, from '/dev/video0':
>  Duration: N/A, start: 1187563.678101, bitrate: N/A
>    Stream #1:0: Video: mjpeg (Baseline), yuvj422p(pc,
> bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
> Output #0, mpegts, to 'pipe:1':
>  Metadata:
>    encoder         : Lavf58.45.100
>    Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc,
> bt470bg/unknown/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn,
> 1000k tbc
>    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
> Stream mapping:
>  Stream #1:0 -> #0:0 (copy)
>  Stream #0:0 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [mpegts @ 0x7af170] Stream 0, codec mjpeg, is muxed as a private data
> stream and may not be recognized upon reading.
> [mpegts @ 0x7af170] Stream 1, codec pcm_s16le, is muxed as a private
> data stream and may not be recognized upon reading.
> frame=   16 fps=0.0 q=-1.0 size=    4030kB time=00:00:00.52
> bitrate=62506.7kbits
> frame=   31 fps= 31 q=-1.0 size=    6697kB time=00:00:01.02
> bitrate=53353.8kbits
>
> and the bit  rate reflects that there is  video/audio being captured,
> but ffprobe doesn’t like it.
>
> ######################################################################################
>
> 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 -f mpegts -codec copy vid_1080p_30.ts
>
>

>  libpostproc    55.  7.100 / 55.  7.100
> [mjpeg @ 0x2194eb0] EOI missing, emulating
> Input #0, video4linux2,v4l2, from '/dev/video0':
>  Duration: N/A, start: 1191788.917809, bitrate: N/A
>    Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc,
> bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
> Guessed Channel Layout for Input Stream #1.0 : stereo
> Input #1, pulse, from 'default':
>  Duration: N/A, start: 1677774554.726233, bitrate: 1536 kb/s
>    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
> File 'vid_1080p_30.ts' already exists. Overwrite? [y/N] y
> Output #0, mpegts, to 'vid_1080p_30.ts':
>  Metadata:
>    encoder         : Lavf58.45.100
>    Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc,
> bt470bg/unknown/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn,
> 1000k tbc
>    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
> Stream mapping:
>  Stream #0:0 -> #0:0 (copy)
>  Stream #1:0 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [mpegts @ 0x219e880] Stream 0, codec mjpeg, is muxed as a private data
> stream and may not be recognized upon reading.
> [mpegts @ 0x219e880] Stream 1, codec pcm_s16le, is muxed as a private
> data stream and may not be recognized upon reading.
> [mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous:
> 13490, current: 13485; changing to 13491. This may result in incorrect
> timestamps in the output file.
> [mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous:
> 16219, current: 16201; changing to 16220. This may result in incorrect
> timestamps in the output file.
> [mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous:
> 34791, current: 34788; changing to 34792. This may result in incorrect
> timestamps in the output file.
> [mpegts @ 0x219e880] Non-monotonous DTS in output stream 0:1; previous:
> 110242, current: 110233; changing to 110243. This may result in
> incorrect timestamps in the output file.
> frame=   45 fps=0.0 q=-1.0 size=    6400kB time=00:00:03.16
> bitrate=16568.0kbits
> frame=   60 fps= 59 q=-1.0 size=   10752kB time=00:00:03.66
> bitrate=24035.9kbits
> frame=   75 fps= 49 q=-1.0 size=   15104kB time=00:00:04.16
> bitrate=29710.3kbits
>
>
>
>
> I’m guessing that I’m gonna have to give up on trying to capture
> directly into mythtv?  I can create a test file as either the mkv or
> avi, or the ‘broken’ ts file If needed.
>
>
> Thanks in advance, and Regards!
>

I've seen the 'non-monotonous' complaint before (and think it ought to
be non-monotonic). For file-to-file stuff I use

ionice -c3 mythffmpeg -hide_banner -ignore_unknown -fflags +genpts \
-i infile.ts -vcodec copy -acodec copy -avoid_negative_ts make_zero \
-f mpegts outfile.ts

where the '-fflags +genpts' before the -i seems important. I think the
'avoid_negative make_zero' bits affect concatenation, and IDK whether
they would help here.

John P


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Recording from input video on demand, no tuner; update: troubles capturing video using RPI4 [ In reply to ]
> On Mar 2, 2023, at 3:02 PM, John Pilkington <johnpilk222@gmail.com> wrote:
>
>
> I've seen the 'non-monotonous' complaint before (and think it ought to be non-monotonic). For file-to-file stuff I use
>
> ionice -c3 mythffmpeg -hide_banner -ignore_unknown -fflags +genpts \
> -i infile.ts -vcodec copy -acodec copy -avoid_negative_ts make_zero \
> -f mpegts outfile.ts
>
> where the '-fflags +genpts' before the -i seems important. I think the 'avoid_negative make_zero' bits affect concatenation, and IDK whether they would help here.
>
> John P
>

I have modified my ffmpeg command to incorporate the additional arguments as follows, and include the output(abbreviated) as follows:


ffmpeg -hide_banner -f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 1920x1080 -framerate 30 -ignore_unknown -fflags +genpts -i /dev/video0 -f pulse -thread_queue_size 1024 -i default -f mpegts -codec copy -avoid_negative_ts make_zero vid_1080p_30.ts

Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 1205729.839641, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, pulse, from 'default':
Duration: N/A, start: 1677788495.641996, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'vid_1080p_30.ts' already exists. Overwrite? [y/N] y
Output #0, mpegts, to 'vid_1080p_30.ts':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn, 1000k tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x23ab9b0] Stream 0, codec mjpeg, is muxed as a private data stream and may not be recognized upon reading.
[mpegts @ 0x23ab9b0] Stream 1, codec pcm_s16le, is muxed as a private data stream and may not be recognized upon reading.
frame= 45 fps=0.0 q=-1.0 size= 14080kB time=00:00:02.86 bitrate=40267.4kbits
frame= 61 fps= 60 q=-1.0 size= 18944kB time=00:00:03.39 bitrate=45690.5kbits
frame= 76 fps= 50 q=-1.0 size= 23808kB time=00:00:03.89 bitrate=50052.8kbits


libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mpegts, from 'vid_1080p_30.ts':
Duration: N/A, bitrate: N/A


mythffprobe vid_1080p_30.ts
ffprobe version v32.0-40-g7bb5162be0 Copyright (c) 2007-2021 the FFmpeg developers
built with gcc 10 (Raspbian 10.2.1-6+rpi1)
configuration: --arch=arm --sysinclude=/usr/include --cc='ccache gcc' --cxx='ccache g++' --ld=gcc --cpu=cortex-a7 --target_os=linux --pkg_config=pkg-config --prefix=/usr --libdir=/usr/lib --as=gcc --objcc=gcc --dep_cc=gcc --host_cc=gcc --host_ld=gcc --ar=ar --nm='nm -g' --ranlib='ranlib -D' --disable-cross-compile --enable-libmp3lame --disable-libx264 --disable-libx265 --disable-libvpx --disable-libxvid --disable-vdpau --enable-libxml2 --enable-libass --disable-dxva2 --enable-libbluray --disable-libfontconfig --disable-libfreetype --disable-libiec61883 --disable-crystalhd --disable-sdl2 --disable-ffplay --enable-mmal --enable-libdrm --enable-gnutls --extra-cflags=' -mfpu=neon -w' --extra-ldflags= --extra-libs= --enable-stripping --strip='echo skipping strip' --disable-manpages --disable-podpages --disable-doc --disable-nvenc --enable-shared --disable-static --enable-gpl --enable-pic --disable-demuxer=mpegtsraw --disable-indev=dshow
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mpegts, from 'vid_1080p_30.ts':
Duration: N/A, bitrate: N/A

Still the same results as far as the mythffprobe is concerned.

Does the statements when capturing about the private data stream have any bearing on the problem?

[mpegts @ 0x23ab9b0] Stream 0, codec mjpeg, is muxed as a private data stream and may not be recognized upon reading.
[mpegts @ 0x23ab9b0] Stream 1, codec pcm_s16le, is muxed as a private data stream and may not be recognized upon reading.

When I do the capture using the mkv or avi versions of the command, those do not show I believe.

Regards!