On 9/25/22 21:38, John P Poet wrote:
> On Sun, Sep 25, 2022 at 8:17 PM Scott Theisen
> <scott.the.elm@gmail.com> wrote:
>
> On 9/25/22 18:48, John P Poet wrote:
>> On Sun, Sep 25, 2022 at 3:16 PM Scott Theisen
>> <scott.the.elm@gmail.com> wrote:
>>
>>
>>
>> On 9/25/22 12:42, John P Poet wrote:
>>> On Sun, Sep 25, 2022 at 10:40 AM John P Poet
>>> <jppoet@gmail.com> wrote:
>>>
>>> On Sun, Sep 25, 2022 at 10:33 AM Scott Theisen
>>> <scott.the.elm@gmail.com> wrote:
>>>
>>> On 9/25/22 11:43, John P Poet wrote:
>>>>
>>>>
>>>> Thank you Scott. I just uploaded a HEVC sample to
>>>> dropbox. It should be shared with you.
>>>
>>> I have the sample.
>>>
>>>>
>>>> Without 7b2ac1eeb5, HEVCParser::parseSPS detects the
>>>> sps_id: 0
>>>> width, height: 1920x1088
>>>> unitsInTick / timeScale: 166817 / 10000000
>>>>
>>>> With 7b2ac1eeb5, HEVCParser::parseSPS the spd_id,
>>>> width and height are garbage and the unitsinTick /
>>>> timeScale are never decoded -- vps_extension_flag
>>>> is zero.
>>>>
>>>> My best guess is that there is an alignment issue
>>>> and the BitReader that is being passed into
>>>> HEVCParser::parseSPS is not pointing at the correct
>>>> position.
>>>>
>>>
>>> OK, but how are you getting the code to execute on
>>> the sample? mythcommflag --rebuild something?
>>> Adding to Videos and scanning for changes?
>>>
>>> Thanks,
>>>
>>> Scott
>>>
>>>
>>> I am using an ExternalRecorder
>>> (https://github.com/jpoet/Magewell2TS). Using the
>>> mythfilerecorder ExternalRecorder that is packaged with
>>> Myth should provide the same result. I am pretty sure
>>> that `mythcommflag --rebuild` results in a different
>>> code path and I have not tried it.
>>>
>>> If you have trouble setting up mythfilerecorder I will
>>> do that this afternoon and then send you instructions.
>>>
>>>
>>> Actually, I won't. I keep forgetting that I don't currently
>>> have access to my development machine and my production
>>> machine will be recording football today. So, that would
>>> have to wait until tomorrow sometime.
>>>
>>> John
>>
>> I couldn't figure out how to get mythfilerecorder to work, so
>> instructions from you, or anyone, would be appreciated.
>>
>> Scott
>>
>>
>> I cannot test this until tomorrow, but this should work...
>>
>> Put the attached config files in /home/mythtv/etc/ . Modify
>> externfile.conf so it can find the sample hevc file.
>>
>> Create a new "capture card" of type "External (blackbox)
>> Recorder". For the command path use
>> "/usr/local/bin/mythexternrecorder --conf
>> /home/mythtv/etc/externfile.conf". Modify that if your
>> mythexternrecorder is not in /usr/local/bin.
>>
>> You may want/need to create a new source for this capture card.
>>
>> You can do a "channel scan" for the new input and it will pick up
>> the test channel defined in channels.conf. You can then create a
>> manual record for that channel and it will effectively "record"
>> the hevc sample file.
>>
>>
>
> Thanks, that worked, adjusting the paths to the real values.
> However, it loops the input file and creates recordings far longer
> than the specified manual recording duration.
>
> I can confirm that parsing is broken. :(
>
> Let me know if you want me to open a pull request reverting the
> change to BitReader, while I investigate.
>
> Thanks,
>
> Scott
>
> PS--Unrelated, but apparently "HEVC" is not a valid registration
> descriptor according to MythTV:
> ```
> 2022-09-25 20:57:29.612931 D [17701/17792] ExternSH
> mpegstreamdata.cpp:463 (CreatePMTSingleProgram) -
> MPEGStream[8](0x7f2f840261b0): Program Map Section
> PSIP tableID(0x2) length(35) extension(0x1)
> version(0) current(1) section(0) last_section(0)
> pnum(1) pid(0x1000) pcrpid(0x100)
> Stream #0 pid(0x100) type(0x24 video-h265)
> Registration Descriptor: 'HEVC' Unknown, see
> http://www.smpte-ra.org/mpegreg/mpegreg.html
> Stream #1 pid(0x101) type(0x81 audio-ac3)
> Registration Descriptor: 'AC-3' ATSC audio stream A/52
> ```
>
>
> Interesting about the HEVC descriptor. I will look into that. I will
> also look into the looping you mention. I will probably wait until I
> have direct access to my "dev" machine first, though, since doing that
> kind of debugging is inconvenient on a live system.
>
> If you can figure out the problem within the next few of days, then
> you can leave it. If you think it will take longer, then yes I would
> like that commit to be reversed.
>
> Thank you,
>
> John
Non byte aligned skip_bits() is broken, try this:
```
diff --git a/mythtv/libs/libmythtv/bitreader.h
b/mythtv/libs/libmythtv/bitreader.h
index a40707e08f..dd31b4efdd 100644
--- a/mythtv/libs/libmythtv/bitreader.h
+++ b/mythtv/libs/libmythtv/bitreader.h
@@ -47,14 +47,16 @@ class BitReader
void skip_bits(unsigned n = 1)
{
- if (m_cacheSize >= n)
+ if (m_cacheSize > n)
{
m_cache <<= n;
m_cacheSize -= n;
}
else
{
+ n -= m_cacheSize;
m_cacheSize = 0;
+ m_cache = 0;
m_bitIndex += n;
int quotient = m_bitIndex / CHAR_BIT;
m_bitIndex %= CHAR_BIT;
```
It seemed to work for me, but I get `HEVCParser PPS Id 0 not valid yet.
Skipping parsing of slice.` in the log even with the switch to BitReader
reverted with your sample.
I thought maybe FFmpeg was doing something to the file, so I switched
the external recorder command to `command="cat
/media/data/htpc/hevc-sample.ts"`, but that had no effect.
Regarding looping,
https://www.mythtv.org/wiki/ExternalRecorder#mythfilerecorder mentions a
--noloop option for mythfilerecorder, but we aren't using that directly.
I will also make the BitReader unit test more comprehensive before
creating a pull request with the above fix.
Regards,
Scott