Opened 15 years ago

Closed 14 years ago

#6395 closed enhancement (fixed)

AVFormatDecoder Language/codec detection improvements

Reported by: robert.mcnamara@… Owned by: tralph
Priority: trivial Milestone: 0.24
Component: MythTV - Video Playback Version: head
Severity: low Keywords: Language detection MLP TrueHD
Cc: Ticket locked: no

Description

Two small improvements for AVFormatDecoder/The internal player.

The first improvement pertains to HD-DVD and Blu Ray support. TrueHD audio is a mandatory primary audio format on HD-DVD (although not all disks include it as required). It's a non-mandatory codec on Blu-ray. That said, it is guaranteed to be more likely to be the primary audio track than DTS or AC3 when present. This adds a preference for TrueHD over those two codecs. This makes the audio track selection for all my HD-DVD rips correct (Trunk has some other issues with this content but those appear to be resolved in ffmpeg SVN so the next resync should fix them).

Note that in FFMpeg trunk the MLP codec has been split out into two codecs, CODEC_ID_MLP and CODEC_ID_TRUEHD. This patch works with current trunk but on the next ffmpeg sync it will need to be changed to CODEC_ID_TRUEHD.

The second improvement pertains to Language selection. Myth attempts to select an audio track first by language, then without. Regrettably, the setting for which language it chooses is hidden in appearance and called "Guide Language Preference" #1 and #1. It doesn't even indicate that it pertains to audio track selection. A complaint from a user today got me thinking about this.

As a solution, I have changed the primary selection method to first try a track matching the Frontend language, then to fall back to the guide language preferences. I think this is much more intuitive and saves having to shuffle those settings around for no good reason.

Attachments (3)

avfd_languagefix.diff (3.1 KB) - added by robert.mcnamara@… 15 years ago.
AVFD Language and codec selection fixes.
avfd_langprefs.070809.diff (3.4 KB) - added by robert.mcnamara@… 15 years ago.
Post-sync version of patch, adds E-AC3 preference
avfd_langprefs.072509.diff (3.3 KB) - added by robert.mcnamara@… 15 years ago.
Fix bug w/ DTS language selection

Download all attachments as: .zip

Change History (8)

Changed 15 years ago by robert.mcnamara@…

Attachment: avfd_languagefix.diff added

AVFD Language and codec selection fixes.

comment:1 Changed 15 years ago by danielk

Owner: changed from Isaac Richards to danielk
Priority: minortrivial
Severity: mediumlow
Status: newassigned
Type: patchenhancement

Changed 15 years ago by robert.mcnamara@…

Attachment: avfd_langprefs.070809.diff added

Post-sync version of patch, adds E-AC3 preference

comment:2 Changed 15 years ago by robert.mcnamara@…

Added a new version of this patch to work post ffmpeg resync.

Preferences for audio now go: TrueHD->E-AC-3->DTS->AC3

Notable in this patch is the addition of a preference for E-AC-3 audio. This makes the codec selection on HD-DVD tracks mostly-right. There are a few instances where the codecs in the container are still misidentified, but that is unrelated to the patch.

Patch also adds an attempt to select the audio first by the frontend language, then by falling back to the Guide Language preference.

Changed 15 years ago by robert.mcnamara@…

Attachment: avfd_langprefs.072509.diff added

Fix bug w/ DTS language selection

comment:3 Changed 15 years ago by robert.mcnamara@…

New patch is more or less identical to the last one, but it corrects a flaw in the original code where DTS would never be selected as the audio track unless DTS passthrough was enabled. I can only conclude that at the time it was written, ffmpeg could not properly decode DTS audio in software. This is possible now and works nicely.

The new version of the patch now happily selects the DTS-HD MA tracks in Blu ray material, as it should (it will generally be the primary audio track). In testing with all my Blu ray material (50ish disks) and HD-DVD stuff too (about the same), the primary audio track is correctly chosen in every case. The one exception is LPCM audio in blu ray, which is not correctly parsed in mpegts.c yet. When it's possible, I'll submit a patch.

This patch doesn't cause this bug, but it does highlight it-- Myth will not handle 8 channel audio. At all. It just plays white noise/static and halves the video framerate. An LPCM track or a TrueHD 7.1 track will produce white noise. The reason the white noise issue didn't exist in TrueHD tracks before the ffmpeg sync is because the prior version of the MLP decoder decoded two channels and tossed out the rest. Since it now decodes all channels, this limitation of myth is highlighted. It might be nice to create a similar workaround that ignores the last couple channels until myth has 7.1 capabilities.

comment:4 Changed 14 years ago by tralph

Milestone: unknown0.24
Owner: changed from danielk to tralph

comment:5 Changed 14 years ago by tralph

Resolution: fixed
Status: assignedclosed

(In [23874]) Add improved audio track selection with the inclusion of more modern codecs.

Since we can't distinguish DTS from DTSHD the logic might select E-AC3 over DTSHD but it's highly unlikely the two will ever co-exit.

Patch by Robert McNamara?.

Fixes #6395.

Note: See TracTickets for help on using tickets.