Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#12430 closed Bug Report - General (fixed)

HLS transcoding broken on 0.27.4

Reported by: Frank Phillips <fphillips81@…> Owned by: JYA
Priority: minor Milestone: 0.27.6
Component: MythTV - HTTP Streaming Version: 0.27-fixes
Severity: medium Keywords: HLS, transcoding, audio
Cc: Ticket locked: no

Description

On 0.27.4, when doing an HLS transcode of a HD (MCH audio) recording, the end result is all of the video is in the final segment file, and there is no audio track.

I hear that master doesn't have this problem.

---

This is a compound problem. The last good commit is 3.152.926bb8d. The next commit 3.153.db74cee creates normal segment files, but has garbled audio. That is the first problem.

After that, 3.154.07d4b2c puts all the video in the final av segment file and no audio tracks are written anywhere. I watched the files being written, only html/m3u8 get data until it gets to the final av and seems to write it all out of a buffer.

I noticed the 3.152.mi has "Mode extension: MS Stereo" and 3.153.mi does not.

-rw-r--r-- 1 mythtv mythtv 193M Apr 14 12:43 1421_20150414000000.mpg.480x272_800kV_64kA.av.000180.ts
-rw-r--r-- 1 mythtv mythtv  13K Apr 14 12:43 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.m3u8
-rw-r--r-- 1 mythtv mythtv  13K Apr 14 12:43 1421_20150414000000.mpg.480x272_800kV_64kA.av.m3u8
-rw-r--r-- 1 mythtv mythtv  297 Apr 14 12:35 1421_20150414000000.mpg.480x272_800kV_64kA.html
-rw-r--r-- 1 mythtv mythtv  210 Apr 14 12:35 1421_20150414000000.mpg.480x272_800kV_64kA.m3u8
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:35 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000001.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000002.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000003.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000004.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000005.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000006.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.ao_32kA.000007.ts
...
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:35 1421_20150414000000.mpg.480x272_800kV_64kA.av.000001.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000002.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000003.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000004.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000005.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000006.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000007.ts
-rw-r--r-- 1 mythtv mythtv    0 Apr 14 12:36 1421_20150414000000.mpg.480x272_800kV_64kA.av.000008.ts
...

mythbackend --version Please attach all output as a file in bug reports. MythTV Version : v0.27.4-42-g628183a-dirty MythTV Branch : makepkg Network Protocol : 77 Library API : 0.27.20141016-1 QT Version : 4.8.6 Options compiled in:

linux debug use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_dvb using_frontend using_joystick_menu using_libcrypto using_libdns_sd using_libfftw3 using_libxml2 using_libudf using_lirc using_mheg using_opengl using_opengl_video using_qtwebkit using_qtscript using_qtdbus using_taglib using_x11 using_xrandr using_xv using_debugtype using_bindings_perl using_bindings_python using_bindings_php using_mythtranscode using_opengl using_vaapi using_vdpau using_ffmpeg_threads using_mheg using_libass using_libxml2 using_libudf

libx264 144.20150223

lame 3.99.5

Attachments (9)

3.152.mi (3.3 KB) - added by Frank Phillips <fphillips81@…> 5 years ago.
mediainfo for last good commit
3.152.ts (1.4 MB) - added by Frank Phillips <fphillips81@…> 5 years ago.
First segment, last good commit
3.153.mi (3.3 KB) - added by Frank Phillips <fphillips81@…> 5 years ago.
mediainfo, garbled audio
3.153.ts (1.5 MB) - added by Frank Phillips <fphillips81@…> 5 years ago.
garbled audio
3.154.mi (2.5 KB) - added by Frank Phillips <fphillips81@…> 5 years ago.
mediainfo, no audio track
3.154.cut.ts (1.1 MB) - added by Frank Phillips <fphillips81@…> 5 years ago.
no audio track
dvd-ac3.log (13.1 KB) - added by jheizer@… 5 years ago.
DVD-AC3 log
3.152.1.log (23.3 KB) - added by Frank Phillips <fphillips81@…> 4 years ago.
3.154.1.log (23.4 KB) - added by Frank Phillips <fphillips81@…> 4 years ago.

Change History (23)

Changed 5 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.152.mi added

mediainfo for last good commit

Changed 5 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.152.ts added

First segment, last good commit

Changed 5 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.153.mi added

mediainfo, garbled audio

Changed 5 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.153.ts added

garbled audio

Changed 5 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.154.mi added

mediainfo, no audio track

Changed 5 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.154.cut.ts added

no audio track

comment:1 Changed 5 years ago by skd5aner@…

I think I'm getting bit by this bug as well. Does your mythtranscode files get flooded with:

2015-04-17 21:06:22.355462 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.396864 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.411912 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.426489 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.454997 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.483471 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.518768 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.520174 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.539793 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.558419 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed
2015-04-17 21:06:22.587126 I [2979/2997] VideoDecodeBuffer avformatdecoder.cpp:4747 (ProcessAudioPacket) - AFD: Audio stream changed

comment:2 Changed 5 years ago by skd5aner@…

FYI, I think I've tracked down the problem to any video that has AC3 audio. I'm able to succesfully do HLS transodes on non-AC3 videos, but all of my videos that contain AC3 audio fail.

comment:3 Changed 5 years ago by jheizer@…

I've been trying different combinations for skd5aner and the only one that fails for me is also ones with ac3 audio. Attaching the mythtranscode log and ffmpeg -i on a segment file.

Changed 5 years ago by jheizer@…

Attachment: dvd-ac3.log added

DVD-AC3 log

comment:4 Changed 4 years ago by Frank Phillips <fphillips81@…>

It's not the AC3, it's the MCH->2CH that bugs it. I tested 6ch AC3/DTS/AAC (all failed) and 2ch AC3/AAC (all passed).

Changed 4 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.152.1.log added

Changed 4 years ago by Frank Phillips <fphillips81@…>

Attachment: 3.154.1.log added

comment:5 Changed 4 years ago by Frank Phillips <fphillips81@…>

Please tag with audio keyword, since this is all audio code.

comment:6 Changed 4 years ago by Stuart Auchterlonie

Keywords: audio added

Looking at where the problem commit is included

$ git tag --contains 926bb8d
v0.27.4
v0.27.5

as well as in master

$ git branch --contains 0641cd9ac3eb142f239b70085bac459f3694eadd
* master

The change itself is pretty trivial https://code.mythtv.org/cgit/mythtv/commit/?id=0641cd9ac3eb142f239b70085bac459f3694eadd

So the questions are, what is the readInternalMode designed to do, and why isn't the read ahead thread running?

Regards Stuart

comment:7 Changed 4 years ago by Frank Phillips <fphillips81@…>

Thanks, but that was the last good commit. The problem is the two commits that followed it, both in avformatdecoder.cpp.

Something in db74cee causes garbled audio.

In the third hunk of 07d4b2c, ctx->channels is replaced with requested_channels which aren't equivalent. When going from MCH->2ch, ctx->channels is likely 6 and requested_channels is 2. I think this causes the loop at SetupAudioStream? (info==audioIn) and no audio is written.

I have looked at avformatdecoder.cpp changes in master and didn't see anything of interest.

comment:8 Changed 4 years ago by Stuart Auchterlonie

Owner: changed from cpinkham to JYA
Status: newassigned

jya, the changesets that are indicated to be causing problems are ones you've committed. Are you able to comment on what is happening here?

comment:9 Changed 4 years ago by skd5aner@…

There is a lot of feedback, logs, and even work that track down the specific changesets that caused this failure. I know it's generally frowned up to bump a ticket, but are there any devs that can take this on? HLS is completely broken on all of my recordings within 0.27-fixes due to this bug and it makes it impossible to use any of the apps out there that I'd love to be able to let my family leverage while away from the house.

comment:10 Changed 4 years ago by Jean-Yves Avenard <jyavenard@…>

Resolution: fixed
Status: assignedclosed

In 3a1506c6b6e20256f776c201af7a73cb7a511ad2/mythtv:

Revert "Have info and playback screen show proper number of channels"

This reverts commit 07d4b2cf93b6750f15ded5252ea5f1da0f3151a4.

Fixes #12430

comment:11 in reply to:  10 ; Changed 4 years ago by Frank Phillips <fphillips81@…>

Replying to Jean-Yves Avenard <jyavenard@…>:

In 3a1506c6b6e20256f776c201af7a73cb7a511ad2/mythtv:

Revert "Have info and playback screen show proper number of channels"

This reverts commit 07d4b2cf93b6750f15ded5252ea5f1da0f3151a4.

Fixes #12430

07d4b2cf93b6750f15ded5252ea5f1da0f3151a4 has also been reverted. Confirmed it is fixed.

Thanks, Jean-Yves.

comment:12 in reply to:  11 Changed 4 years ago by Frank Phillips <fphillips81@…>

Replying to Frank Phillips <fphillips81@…>:

Replying to Jean-Yves Avenard <jyavenard@…>:

In 3a1506c6b6e20256f776c201af7a73cb7a511ad2/mythtv:

Revert "Have info and playback screen show proper number of channels"

This reverts commit 07d4b2cf93b6750f15ded5252ea5f1da0f3151a4.

Fixes #12430

07d4b2cf93b6750f15ded5252ea5f1da0f3151a4 has also been reverted. Confirmed it is fixed.

Thanks, Jean-Yves.

I meant db74cee06907c91cc9747d24381b8b7231352e59 has also been reverted

comment:13 Changed 4 years ago by JYA

The surprising thing is that it works in master; which at the time was using exactly the same ffmpeg and has almost identical playback code

comment:14 Changed 4 years ago by Karl Egly

Milestone: unknown0.27.6
Note: See TracTickets for help on using tickets.