Repository navigation
Option to use LPCM for audio when streaming with mencoder and tsmuxer - #10
Conversation
|
Nice, thanks! I'm not much of an audio buff myself, so I'll leave merging to someone who knows more. :-) |
|
Hi. |
|
ExSport, I think you exaggerate effect of this patch on PS3MS behavior. Please take look on the code. "Keep DTS audio" has higher priority so it'll be remuxed (with wav hack if necessary) regardless of LPCM setting. Same with "Keep AC3 audio", it'll never be reencoded to LPCM if checked. So it is exactly the same behavior you can see now. The only difference is less common codecs handling like AAC or WMA. Right now PS3MS always reencode them to AC3, with this patch user can chose between AC3 reencoding for them (old behaviour) or LPCM reencoding. Maybe you can provide usage cases when you see undesirable effects? We can think about additional config option to keep "perfect" backward compatibility if needed. |
There was a problem hiding this comment.
DTS remuxing has higher priority and will be used regardless of isMencoderUsePcm option.
|
As I said, I had no time to check the code so mentioned some scenarios so maybe I was wrong. |
|
Now when audio is not compatible it is reencoded to AC3. |
Behavior proposed in patch:
Result: reencoding to LPCM for all audio codecs,
Result: reencoding to LPCM for all audio codecs except AC3. Remux AC3 without reencoding.
Result: reencoding to LPCM for all audio codecs except DTS. Remux DTS without reencoding (with WAV header hack if requested in renderer's config).
Result: reencoding to LPCM for all audio codecs except AC3 and DTS. Remux AC3 without reencoding. Remux DTS without reencoding (with WAV header hack if requested in renderer's config).
Result: same behavior as above, Use AC3 reencoding instead of LPCM reencoding. If I understand you right you want to add separate option Use LPCM only for DTS. Is this right? |
|
Use LPCM is checked With new patch I have to disable LPCM to not reencode other codecs but then I will loose DTS reeencoding to LPCM:
|
|
I think what you want is (GUI mockup): Is it correct? |
|
Yes, but didn't wanted to mess up GUI with another new settings and also didn't think about it if it should be configurable on renderer level or global level:-) But above you mentioned is quite straightforward. |
|
Ok. For now we can live with this simple GUI: and additional hidden config option MencoderUsePcmForHQAudioOnly to retain full backward compatibility with previous PS3MS versions. Will update the branch. In the future we can consider full GUI revamp to make it more intuitive, something like this: |
|
Seem to me perfect! Thanks. Nobody will loose old behavior so I am fine with it:-) |
…ain backwards compatibility with previous PS3MS behaviour
|
Changes committed. |
|
For me the audio channels don't seem to be properly assigned when passing audio via LPCM. The center channel sounds more like a rear surround channel. Am I doing something wrong? |
|
https://github.com/ps3mediaserver/ps3mediaserver/blob/master/src/main/java/net/pms/util/CodecUtil.java#L178 |
|
Bad channel ordering should be fixed by applying this: #21 |
|
Thanks, @ExSport . I'll check it out. |
|
@Lycanthor |
|
Ok, channel mapping for PCM is clearly wrong. At least for AC3 sources. Time for more testing. |
|
I found this information. I think we need to remap channels when going from ac3/dts to pcm. Why for God's sake mencoder can't do this automatically? |
|
Thanks for update. I tested it mainly on anything to LPCM conversion with 7.1 sample and it worked ok. Maybe conversion to AC3 needs reordering but to LPCM not? |
|
@ExSport I found this test file to be quite convenient to test 5.1 sound. It is MPEG-2/AC3 vob so you can play it on PS3 both natively and with mencoder transcoding to compare results. From my experience:
I think table above explains it. We need to manually change channel order when going from AC3 to LPCM. |
|
will try to test it. |
|
I am focused on making 5.1 work at first. It appears we still have to remap channel for PCM output even with latest mencoder (SB28). With my last commits 5.1 AC3 and 5.1 AAC work fine both with AC3 and LPCM transport. WMA9 is still buggy though and works only with AC3 transcoding. Here you can find AAC and WMA9 test files: Does anyone have 5.1 DTS test video file? |
|
When I tested it last time I was fighting with 7.1 output if possible so that I spotted reordered channels it was a bonus. |
|
Ok so the corrections follow from new testing, latest PMS(with removed reordering from old PMS builds): |
|
How do you fixed DTS/AC3 to LPCM conversion? Without reordering matrix used in MEncoder parameters, Rear Right is missing so how you regenerated it? OK shifted Rear left can be switched to right but Rear right is missing so can't be reconstructed without quality loss(so 2AC3 transcoding is better in this case) |
|
I have tested with last commits on this branch:
DTS test file you linked is huge (~800 Mb) and split on several parts on very slow server so it is still downloading |
|
After remaining bugs were fixed I have these tests results:
With positive results from other members I think this patch is ready to be merged with master. |
|
Nice work, @Happy-Neko and @ExSport ! |
|
Great work Happy-Neko:-) |
|
I managed to fix 7.1 Dolby TrueHD playback. At least it works as it should on 5.1 speakers. I can't test surround and rare channels on the same side (left or right) because they play through same speakers on 5.1 so they can be in wrong order. If anyone can confirm this on real 7.1 system that'll be great. Other test results:
@ExSport if you had missing channels with 7.1 files thats because previously PS3MS parsed them as 6 channel tracks, not 8 (check last commits). |
|
No, I fixed this in code so it wasn't problem. Problem is that Mplayer/MEncoder can't decode 7.1 channels from DTS tracks. Decoder is limited to 5.1 only. What I remember I demuxed audio with eac3to so final 7.1 file was ok on PS3. |
|
I think it's time to merge into master. The growing distance between this branch and HEAD is frightening. |
|
If you don't mind I'll merge this request with master. |
follow-up to issue 1368 and pull request test :)
Right now LPCM streaming is limited to files with flac and DTS audio tracks. What is the reason behind this decision?
Below is simple patch to enable LPCM transport for ac3, mp3, aac, ogg, wma, mpeg and truehd tracks. I haven't done extensive testing but it seems to work fine. Advantages are obvious:
Bandwidth requirements are about 1.5 Mbit/s for 2.0 and 4.6 Mbit/s for 5.1 audio. No problems for wired connection.
Patch also includes some minor GUI corrections. For example label "You need an HDMI receiver for streaming LPCM 5.1" is misleading because you don't. PS3 will automatically re-encode audio to DD or DTS if its the only available audio output format.