bennettpeter / android-MythTV-Leanfront

:tv: MythTV Android TV frontend
GNU General Public License v3.0
45 stars 9 forks source link

Unable to play recordings or live tv #78

Closed davepearson1628 closed 8 months ago

davepearson1628 commented 9 months ago

Hi,

I've just taken delivery of an Amazon Omni QLED TV and I've installed Leanfront on it. Unfortunately I cannot playback any of my recordings, which are from Hauppauge HD PVR 2 capture devices at 1080P, I cannot play live tv either from the HD PVR 2 devices, however I can play live TV from a DVB-T card. Videos also seem to play back ok.

Are there any settings I need on my backend to get this working (v34 on Ubuntu 23:10)?

I have the same problem on a Fire TV Stick, but I put it down to the stick not being powerful enough.

When I press play, I get a black screen with a spinning circle for a few minutes, then a completely black screen for a few minutes, followed by the spinning circle again.

Eventually, the error message appears:

Playback Failed.

Unexpected Runtime Exception Unexpected runtime error

You should be able to download a sample video file from here: (Link Removed)

Regards, Dave.

bennettpeter commented 9 months ago

That link gives me the message:

Page not found

davepearson1628 commented 9 months ago

My Apologies, please try (Link Removed)

Regards, Dave

Jpilk commented 9 months ago

The file has only video h264 and audio ac3 streams, and mythcommflag --rebuild finds keyframe separations of several hundred frames.

It plays for me in leanfront after

ionice -c3 mythffmpeg -hide_banner -ignore_unknown -fflags +genpts -i -vcodec copy -acodec copy -scodec copy -avoid_negative_ts make_zero -f mpegts

In this line the infile and outfile references have been hidden by github. I'll try again:

ionice -c3 mythffmpeg -hide_banner -ignore_unknown -fflags +genpts -i INFILE.ts -vcodec copy -acodec copy -scodec copy -avoid_negative_ts make_zero -f mpegts OUTFILE.ts

davepearson1628 commented 9 months ago

Thanks Peter,

I'll try that on my existing recordings, meanwhile, can you see anything in my HD PVR 2 configuration file that might help to avoid me having to run that command:

input: 0=COMPOSITE, 1=COMPONENT, 2=SDI, 3=HDMI

input=3

audio: 0=RCA, 1=SPDIF, 2=SDI, 3=HDMI

audio=3

codec: 1=MPEG, 2=AC3, 3=AAC, 6=MP3, 8=PCM, 9=PASSTHROUGH)

codec=2

Boost audio input gain.

boost

audiosamplerate: -1=FOLLOW_INPUT, 0=NONE, 1=32KHz, 2=44.1KHz,

3=48KHz, 4=96KHz, 5=192KHz, 6=16KHz

audiosamplerate=3

audiobitrate: -1=NONE, 0=32Kbps, 1=48Kbps, 2=56Kbps, 3=64Kbps,

4=80Kbps, 5=96Kbps, -6=112Kbps, 7=128Kbps, 8=160Kbps, 9=192Kbps,

10=224Kbps, 11=256Kbps, -12=320Kbps, 13=384Kbps, 14=448Kbps,

15=576Kbps, 16=16Kbps, -17=8Kbps, 18=640Kbps, 19=768Kbps,

20=960Kbps, 21=1024Kbps, -22=1152Kbps, 23=1280Kbps, 24=1344Kbps,

25=1408Kbps, 26=1411Kbps, -27=1472Kbps, 28=1536Kbps, 29=MAX

audiobitrate=29

videobitrate: Video bitrate

videobitrate=8000000

videoratecontrol: 0=CBR, 1=VBR, 2=CAPPED_VBR

videoratecontrol=1

minvbrrate: Mininum VBR bitrate

minvbrrate=9000000

maxvbrrate: Maximum VBR bitrate

maxvbrrate=20000000

tsbitrate: Transport Stream bitrate

tsbitrate=20000000

profile: 0=Constrained baseline, 3=Main, 4=High

profile=4

level: 100=LEVEL_1, 105=LEVEL_1B,110=LEVEL_1.1, 120=LEVEL_1.2,

130=LEVEL_1.3, 200=LEVEL_2, 210=LEVEL_2.1, 220=LEVEL_2.2,

300=LEVEL_3, 310=LEVEL_3.1, 320=LEVEL_3.2, 400=LEVEL_4,

410=LEVEL_4.1, 420=LEVEL_4.2, 500=LEVEL_5, 510=LEVEL_5.1

level=420

bframes: 0-7

bframes=3

videoLatency: 0=low latency, 1=high latency

videoLatency=1

aspect: aspect ratio

aspect=1.0

serial: Serial number of device.

serial=E585-00-00D8CC08

Description used in MythTV logs

description="hdpvr2-1"

description="Colossus2"

output: Output destination

output=hdpvr2.ts

mythtv: MythTV External Recorder mode.

mythtv=true

logpath: Location of log file

logpath=/var/log/mythtv

override-logleve: emerg, alert, crit, err, warning, notice, info, debug

If specified, overrides the loglevel command-line option

override-loglevel=notice

quiet: Don't log to console

quiet

Regards, Dave.

-----Original message----- From: @.> Sent: Tuesday 5th December 2023 10:13 To: bennettpeter/android-MythTV-Leanfront @.> Cc: Dave Pearson @.>; Author @.> Subject: Re: [bennettpeter/android-MythTV-Leanfront] Unable to play recordings or live tv (Issue #78)

The file has only video h264 and audio ac3 streams, and mythcommflag --rebuild finds keyframe separations of several hundred frames.

It plays for me in leanfront after

ionice -c3 mythffmpeg -hide_banner -ignore_unknown -fflags +genpts -i -vcodec copy -acodec copy -scodec copy -avoid_negative_ts make_zero -f mpegts

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Jpilk commented 9 months ago

Please note that I have edited my earlier comment so that it now displays the INFILE and OUTFILE correctly.

Here, for info, is the stream analysis of part of the processed file.

Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 384 kb/s

davepearson1628 commented 9 months ago

Thanks Peter, 

Could you remove the error messages from your post about the incorrect file link, please.

Regards, Dave.

-----Original message----- From: @.> Sent: Tuesday 5th December 2023 11:27 To: bennettpeter/android-MythTV-Leanfront @.> Cc: Dave Pearson @.>; Author @.> Subject: Re: [bennettpeter/android-MythTV-Leanfront] Unable to play recordings or live tv (Issue #78)

Please note that I have edited my earlier comment so that it now displays the INFILE and OUTFILE correctly.

Here, for info, is the stream analysis of part of the processed file.

Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 384 kb/s

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

bennettpeter commented 9 months ago

Dave Note that all of the comments about the file format are from John Pilkington. I have not yet looked at your file. Peter

davepearson1628 commented 9 months ago

Oops - sorry @Jpilk Peter, do you need the link for the file again - I removed it from my earlier post?

bennettpeter commented 9 months ago

Yes please, I have not yet downloaded the file.

davepearson1628 commented 9 months ago

HI Peter,

Please download if from (link removed) Regards, Dave.

davepearson1628 commented 9 months ago

@Jpilk modifying that file with your mythffmpeg command made it instantly playable on my Fire Tv. It would be really good, though if I could modify my HD PVR2 configuration file to avoid the problem.

If that’s not possible, I will just have to create a user job to fix the files.

Thanks for your help on this. Regards, Dave

bennettpeter commented 9 months ago

The error message from exoplayer is Target buffer size reached with less than 500ms of buffered media data. (many times) Followed by Playback stuck buffering and not loading.

It looks like John has identified the problem. I don't know anything about HDPVR settings. There are people who use HDPVR successfully with leanfront, perhaps if you post a message in the mailing list somebody may have a setting you can use.

In the meantime I have the test video. I will see if there is a way to increase the buffer size or if there is anything else that will fix the problem.

Jpilk commented 9 months ago

I have tried dropping the "avoid negative" and "make_zero" arguments from the command line quoted above; they were said to be needed in ffmpeg concatenation but don't seem to make a difference here.

But seektables created either before or after that process are flawed, with step lengths in frames being wildly inconsistent; so I can't edit as I usually do with dvb-t/t2 recordings.

davepearson1628 commented 9 months ago

@Jpilk @bennettpeter

Thanks to you both for your help on this. I was able to edit my test recording after using John's original mythffmpeg command, so I'm happy to use that if I cannot get the HD PVR 2 config file to resolve the problem.

I shall take Peter's advice and ask in the mailing list if anyone has a config file that works with Leanfront. Dave.

Jpilk commented 9 months ago

It's perhaps woth noting here that there's a still-open MythTV issue that has similarities.

https://github.com/MythTV/mythtv/issues/600#issuecomment-1374827390

bennettpeter commented 9 months ago

I recommend running mkvmerge to convert the file to mkv. mkvmerge -o outfile.mkv infile.ts I tested this with your test file. It is very fast and the resulting mkv file will have better performance in leanfront. You can also copy the resulting output mkv file over the original ts file. Both mythfrontend and leanfront will play the resulting file (mkv video with ts extension) correctly.

Also see the leanfront documentation https://github.com/bennettpeter/android-MythTV-Leanfront#problems

davepearson1628 commented 9 months ago

-----Original message----- From: Peter @.> Sent: Thursday 7th December 2023 23:55 To: bennettpeter/android-MythTV-Leanfront @.> Cc: Dave Pearson @.>; Author @.> Subject: Re: [bennettpeter/android-MythTV-Leanfront] Unable to play recordings or live tv (Issue #78)

I recommend running mkvmerge to convert the file to mkv. mkvmerge -o outfile.mkv infile.ts I tested this with your test file. It is very fast and the resulting mkv file will have better performance in leanfront. You can also copy the resulting output mkv file over the original ts file. Both mythfrontend and leanfront will play the resulting file (mkv video with ts extension) correctly.

Also see the leanfront documentation https://github.com/bennettpeter/android-MythTV-Leanfront#problems

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

Thanks Peter,

I'll try that - I've been using the mythffmpeg command suggested by John, but I'll see what mkvemerge does too

Regards, Dave.

Message ID: @.***>

Jpilk commented 9 months ago

I already had a script to use the ffmpeg option and thought the result might reassure Dave about his new TV.

I've tended to stay with mpeg2ts, not mkv, because I can then usually cut recordings using cutlists defined with the mythfrontend editor. At present, for this test recording, neither format lets me do that.

davepearson1628 commented 9 months ago

Thanks to you both for your comments and suggestions - I tried both John's ffmpeg command and Peter's mkvmerge and Found ffmpeg to be the better option as I can then build a seektable and edit the file to remove padding and adverts from my recordings, which I cannot do with mkvmerge.

Regards, Dave.

Jpilk commented 9 months ago

I'm puzzled again. mythcommflag --rebuild on the download gave me a seektable that was no use for editing. My scripts cut at keyframes, and those found were too far apart.

But my mythtv issue #600 linked to a forum thread and onwards to an .scm file, apparently machine generated and difficult to follow. The souce code is here. Could repay study.

https://git.sdf.org/nb0yjxtr/ffmpeg-mythtv/src/branch/master/

davepearson1628 commented 9 months ago

On 10 Dec 2023, at 10:18, Jpilk @.***> wrote:



I'm puzzled again. mythcommflag --rebuild on the download gave me a seektable that was no use for editing. My scripts cut at keyframes, and those found were too far apart.

But my mythtv issue #600 linked to a forum thread and onwards to an .scm file, apparently machine generated and difficult to follow. The souce code is here. Could repay study.

https://git.sdf.org/nb0yjxtr/ffmpeg-mythtv/src/branch/master/

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

Yes, I found that mythcommflag didn’t work, the tinestamps were completely haywire and it was almost impossible to select the cut points I wanted. 

This command seems to do the trick:

mythtranscode --buildindex --allkeys --showprogress --infile "$inputfile

Regards, Dave

Message ID: @.***>

Jpilk commented 9 months ago

Yes, that works for me too. I don't see anything for 'showprogress', though, and STR that --allkeys was redundant. I'll probably retain the mythcommflag --rebuild for my normal dvb-t/t2 recordings 'because it ain't broke' for them.

Cheers, John.

Jpilk commented 8 months ago

All my tests above were done with leanfront installed on my Sony BRAVIA_TL Android tv, which gives a good 1360x768 picture. I just tried my FireTVstick 4K via HDMI on the same tv with the same build of leanfront.

Both setups fail to play the raw file and both play both remuxes. But on starting playback with the Firestick I see:

'There is no suitable refresh rate for frame rate 23.98'.

Playback then looks fine although the rolling credits on both setups are not as smooth as, say, a current BBC production. I don't guarantee that the config parameters in use are identical.

davepearson1628 commented 8 months ago

Yes, I get that Frame Rate message too, it doesn't seem to affect my viewing pleasure, though