FAQ  •  Register  •  Login

Transcoding from Windows to VR headset in Stereo

<<

Downunder35m

Serviio newbie

Posts: 4

Joined: Mon Jul 20, 2020 4:51 am

Post Mon Jul 20, 2020 5:20 am

Transcoding from Windows to VR headset in Stereo

I have searched through the forum for days now and tried about 20 different "solutions" that seemed to do the trick for other people.
Not so much here though.

The basics:
Latest Serviio running on an old Windows PC.
Recieving device(s): Oculus VR headset.

Problem in short:
I have no issues at all watching basically every video I have when using Serviio from the PC.
Especially the profile for the Roku 4K Media Player w/MPEG2 provides an excellent image quality.
However, when streaming videos with multiple audio tracks or DTS I get no sound at all.
For some videos I do get the music and background noises but no dialogs from the actors.

A few more details that might be relevant:
The PC basically acts as my media center with the benefits of having a browser and Email client.
Using Serviio to watch things on other devices, even "older" phones works just fine, with a few silent videos still - don't care to much about those.
So far the only really working option is use a dedicated program that acts as the video server and remote desktop on the VR headset.
But this results in a realy crappy quality for videos and the thing only seems to utilise about 70% of the "screen".
On top of that it turns my old PC into a heater while transcoding.
I found a lot of topics where people found solutions that worked for them but not for me.
Like forcing stero output, forcing to encode all files regardsless and lots more.
Very helpful in terms of learning new things, sadly not so much for my little issue.
There also seems the problem of ffmpeg being unable to turn multi channel audio into stereo and problems handling DTS and/or multi track audio.
I was unable to find the ansers I need and after spending hour after hour reading here I decided I need to ask some pro(s) here.

What I would like to accomplish:
Leave the video untouched (at a later stage I would like to transcode it to matching resolution though).
Avoid video transcoding over the CPU where possible, but don't mind if it takes some computing power.
The only thing I would like to have in profile with the Roko image quality would be a general audio transcoding to just plain stereo.

Problems I think I am aware of so far:
Multi track audio might result in the wrong language.
Skipping or fast forward/reverse might not work.
Anything else?

Question(s):
Is there a way to transcode the audio from ALL streamed video to plain 2 channel stereo?
If so, then what am I missing, is there some confirmed to work user-profiles.xml anywhere to try?
In case the problem is with the actual transcoder: Are there any options to use something that works and make it usable for Serviio?
I wasted half of this pandemic to backup my DVD collection onto an oversized hard drive.
Tried to preserve the best possible quality and all audio features, even added the bonus material for most.
Please don't tell me I have to start over and transfer all my DVD's into another set with just stereo output....

By the way: The same Audio issue happens on my smart TV when trying to access my collection but not for all files that are silent on the VR headsets.
No clue if it is relevant but though I mention it.
<<

atc98092

User avatar

DLNA master

Posts: 4021

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Mon Jul 20, 2020 2:56 pm

Re: Transcoding from Windows to VR headset in Stereo

The Roku profiles don't touch normal DTS because the players are capable of bitstreaming it to an AVR. Sounds like you need all DTS transcoded to Dolby Digital. Yes, it is possible to transcode all audio to stereo. Audio transcoding doesn't require much from the CPU, so you don't see huge CPU utilization for just audio.

So, if you start with the profile you're using now, you can add a Matches line in the first transcoding section that says "<Matches container="*" vCodec="*" aCodec="dca" />" This line inserting into the first video transcoding section will capture any DTS audio, regardless of container or video codec. Of course, it's going to be transcoded into 5.1 DD, assuming the DTS track is 5.1. If you go to the very first line of that transcoding block and add forceStereo="true" you will get two channel stereo. The complete line would be <Video targetContainer="applehttp" targetACodec="ac3" aBitrate="512" forceStereo="true">

I recommend doing this in a user-profiles.xml file, so you don't lose your work on an update, and if you mess it up you still have the working Roku profile.
Dan

Samsung NU7100 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 8 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

Downunder35m

Serviio newbie

Posts: 4

Joined: Mon Jul 20, 2020 4:51 am

Post Mon Jul 20, 2020 11:09 pm

Re: Transcoding from Windows to VR headset in Stereo

Thanks for that Atc!
I tried an awful lot but never got this audio to work, now I see why :(
Makes sense to actually define what you need - if know what you are doing LOL
Somehow I missed this DCA thing and tried to force the encoding on everything BUT this :(

Will clean up the messes I created in the profiles and report back later during the day.

One last thing (for now) :
Is there any trick I can use so by default the english audio track is used?
For some videos DTS english is the default track, for some it is German Spanish on the first DTS track but basically all have english as the first AC3 track, not all though.
I tried the documentation and help sections but unless I am mistaken Seriio has o option to prefer an audio track based on the language ?
Even tried MKVToolnix on a file to test but even if I change the numbers and set the default to the english track Serviio seems to just pick the track that is physically the first in a file.
Not a really huge deal as the few videos affected by this I could just rip again with just the english audio tracks.
<<

atc98092

User avatar

DLNA master

Posts: 4021

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Mon Jul 20, 2020 11:49 pm

Re: Transcoding from Windows to VR headset in Stereo

You can use tsMuxeR and reorder the audio tracks so the desired track is first and labeled default (that's a separate setting). Since it's not transcoding anything, it's pretty fast. That's assuming you are OK with a TS or M2TS container as output. There might be other programs that can do the same and output in MKV.
Dan

Samsung NU7100 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 8 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

Downunder35m

Serviio newbie

Posts: 4

Joined: Mon Jul 20, 2020 4:51 am

Post Tue Jul 21, 2020 12:51 am

Re: Transcoding from Windows to VR headset in Stereo

Will try that route a bit later, but it seems Serviio still does not like what I am doing.

When I add the line <Matches container="*" vCodec="*" aCodec="dca" /> I get an error in the log for the * in the vCodec.
So I changed it to <Matches container="*" vCodec="h264" aCodec="dca" /> and for h265 as well.
Fixed the error and the service started but did not fix the audio problem.
Instead some of the affected files can't be played at all now and the player states file not found.

Doubled checked a few and the only audio tracks available are DTS and AC3, only very few HDTS and Truehd, but that's all defined and should be sent as stereo.
Still, no dialogs, only sound effects, music and a few loud voices from people outside the scene LOL
Like only the channels I don't want are used :(
From what I gather the files that Serviio should change are refused while the rest still does not play with the right sound.

Am I assuming correctly that if VLC shows me it is in fact DTS or AC3 for the selected audio playing and that the video codec is H264 that Serviio should see it as the same?
The container is specified as * anyways....

Here is the user-profiles.xml I try to get going, based on the roku with mpeg2:

  Code:
<?xml version="1.0" encoding="UTF-8"?>
<Profiles version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.serviio.org/xsd/profiles/v/2.0/Profiles.xsd">

<Profile id="Oculus" name="Oculus Go Quest" extendsProfileId="RokuMPApp">
      <!-- NOTE:
      -This profile does not restrict the audio to 2 channel stereo. If you are encountering audio issues, add forceStereo="true" to the
      targetContainer line after the targetACodec setting.
      -These Roku models should be able to play videos without requiring the maxVBitrate setting. You can experiment if necessary.
      -The latest Roku players now support mepg2 video. This profile will play without transcoding supported containers, or remux unsupported containers
      -Every effort has been made to capture videos correctly. If you discover a file being transcoded unnecessarily, please report it
      in the Serviio forum in the Transcoding section.
         -->
      <Transcoding>
         <!-- Remux H.264/265 video stream, transcode audio only -->
         <Video targetContainer="applehttp" targetACodec="ac3" aBitrate="512" forceStereo="true" >
            <!-- <Matches container="matroska" /> -->
            
            <Matches container="*" vCodec="h264" aCodec="dca" />
            <Matches container="*" vCodec="h264" aCodec="ac3" />
            <Matches container="*" vCodec="h264" aCodec="truehd" />
            <Matches container="*" vCodec="h264" aCodec="dts-hd" />
            <Matches container="*" vCodec="h265" aCodec="ac3" />
            <Matches container="*" vCodec="h265" aCodec="dca" />
            <Matches container="*" vCodec="h265" aCodec="truehd" />
            <Matches container="*" vCodec="h265" aCodec="dts-hd" />
         </Video>
         <!-- Transcode VC1 video, which for some reason doesn't seem to like HLS transcoding -->
         <Video targetContainer="mpegts" targetVCodec="h264" targetACodec="ac3" aBitrate="512" >
            <Matches container="*" vCodec="vc1"/>
         </Video>
         <!-- Transcode other non-H.264 video or FLAC audio -->
         <Video targetContainer="applehttp" targetVCodec="h264" targetACodec="ac3" >
            <Matches container="*" vCodec="wmv2"/>
            <Matches container="*" aCodec="flac"/>
            <Matches container="*" vCodec="mpeg1video"/>
            <!-- transcode non-supported containers regardless of codec -->
            <Matches container="wtv"/>
            <Matches container="avi" />
            <Matches container="mpegvideo"/>
            <Matches container="mpeg"/>
         </Video>
         <!-- if you have issues playing audio files, uncomment the following section to transcode all audio to MP3 -->
         <!-- <Audio targetContainer="mp3">
            <Matches container="*" />
         </Audio> -->
      </Transcoding>
      <OnlineTranscoding>
         <Video targetContainer="applehttp"> <!-- dont transcode audio -->
            <Matches container="mp4" />
            <Matches container="flv" vCodec="h264" />
         </Video>
      </OnlineTranscoding>
      <GenericTranscoding>
         <Video targetContainer="applehttp" targetVCodec="h264" targetACodec="ac3" />
      </GenericTranscoding>
      <ThumbnailsResolution>HD</ThumbnailsResolution>
      <AllowChunkedTransfer>true</AllowChunkedTransfer>
      <MultipleAudioTrackAware>true</MultipleAudioTrackAware>
      <AutomaticImageRotation>true</AutomaticImageRotation>
      <LimitImageResolution>false</LimitImageResolution>
   </Profile>

</Profiles>


Not sure if I am missing something or if the problem already starts with the headset not even showing up in DeviceSpy...

Would be great to find something like the Surround test file from here: https://archive.org/details/5.1SurroundSoundTestFilesVariousFormatsAACAC3MP4DTSWAV but as MKV's with various audio codes.
The testfile in mp4 plays properly, just the sub is silent, would love to get that for these damn rips without having to start over LOL
All plays fine over the Shield, but well, can't really wear my TV screen...

edit:
It helps if you realise how greedy FB really is :(
The only thing their headsets support natively : AAC and MP3 :(
Explains why they want to charge you a fortune for video players that claim to support all those nice videos from DLNA - They provide the required (licensed) codecs required for playback.
Problem now is to figure out why so many movies won't play at all or why it says for a listed one that there is no file to be found.
At least I am finally making some progress :)
<<

atc98092

User avatar

DLNA master

Posts: 4021

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Tue Jul 21, 2020 1:23 pm

Re: Transcoding from Windows to VR headset in Stereo

Roku players don't appear in Device Spy either, so it does make it difficult to know what works. I finally got someone inside Roku to work with me to explain what I needed for those profiles.

Since it didn't like the wildcard for the video codec, you can probably just completely remote it from the matches line. That way it will match regardless of video codec.

You might try changing the transcoding line to use AAC instead of AC3 for the target audio codec, since that's what the headset says it supports. But you still will likely need the force stereo switch.
Dan

Samsung NU7100 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 8 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

Downunder35m

Serviio newbie

Posts: 4

Joined: Mon Jul 20, 2020 4:51 am

Post Fri Jul 24, 2020 1:25 am

Re: Transcoding from Windows to VR headset in Stereo

Thanks for yout great help here ATC!

I managed to get the major MKV and MP4 files that have a supported video codec working now.
Still only just playing with no fast forward or such that does a good job but still :)
Had to edit a few files to swap the english audio track though.

If there is one thing I learned from this bit so far then that it makes no real sense trying to provide a home streaming solution for VR headsets unless the content is already suited for it.
These toys cost a small fortune and offer less support than what you had on your phone in 2015 :(
FB seems to intentionally cripple these devices with the sole aim to make money through the additional apps you need to make them usable.
I have an old Galaxy S5 that I only use when going bush or fishing as it is now of little value, wouldn't like to lose my new phone in the dark or water.
Still, I just put a nice and free video player on it and with just the generic profile in Serviio it allows me to watch EVERYTHING.

In terms of actually learning something and wanting to share:
If you struggle to get a video playing on your device or your devices tells you the video is not available:
First check what your device can support natively, with no extras.
For most Android devices on the lower end a working combo would be MP4 with H264 and AAC with forced stereo for the audio.
Some newer devices will offer much more, so it really helps to check the manufacturers websites for the real specs.
Create a user-profiles.xml!!!
It is easy to just edit the profiles.xml but it is also very easy to mess it up, so a user profile makes double sense.
Do not make a ton of changes at a time, do one or two and then test.
If the service starts and stops shortly after it means you made an error in your profile - so make sure to restart the service after every change ;)
Keep in mind that Serviio checks for everything you define while "ignoring" the rest, this means you need to make rule for every video and audio codec your device won't support.

Remux VS transcoding....
In many cases you can find video files with a supporting video, like in my case H265, that still refuse to give you a visible video.
In other cases it might just be the audio having too many channels.
If possible and as far as uderstand, Serviio will just remux the video if the codec and container allow it.
You might have to specify max bitrates and resulutions for some files with supporting video codes!
If too much Serviio will then transcode instead of just remuxing/repacking to make your video work.

Video formats, codecs, containers - WTF?!? ;)
I do video stuff now for quite a few years but still get confused every now and then, especially when it comes to my collection of vintage files.
Yes, I still have videos from my old Nokia phone in 3GP and a bunch of home videos that back in the day were transfered from VHS to AVI.
Basically for every video codec used you might find some files in my collection.
You can imgine that finding something capable of playing basically everything from vintage to modern 7.1 channel 4K HDR is a hard task.
Serviio can do an awful lot to help out, but you can too.
In most cases a user will use a computer or TV to watch videos, my VR set must be an exception I guess.
For the rest it is down to phones and tablets.
I found it rather helpful to start with Serviio in the generic profile and then to test what my devices can and can't play porperly.
My PC does not really care what I feed it, basically everything just plays when using VLC as a free player.
My tablet is an old Nexus7 and also has little to no struggles, thanks to Nvidia I guess.
The TV's though are a different story.
The small one only likes MP4 with AAC or AC3 sound, the later often comes with weird volume mixes.
It does support H264 and H265 as well as AVI but is rather limited in terms of processing something with high bit reates.
The big one claims to support much more, including DTS, TrueHD, HDR and such fancy stuff.
I fell for the datasheet only to find out that this claim is not true for build in player - it only supports the most basic Android profiles.
To actually use what is advertised I need a video player capable of using the provided libraries.

Routers, hard drives, CPU and WiFi....
Had to learn the hard way that these four can play a vital role in your video experience.
Transcoding often requires a lot of hard drive activity.
Some old, standard drive might not cope well here when it comes to 4K and multi channel audio to be transcoded.
SSD's or a RAM drive will bring a big performance boost if your files are not processed fast enough.
Transcoding also needs a lot of CPU power, meaning it might be quite a wait until a video actually starts playing - be patient before you think it failed.
Not sure if the PC version of Serviio supports GPU use for transcoding but would be a great feature.
In terms of WiFi I have to say that 5GHz does work better here, especially if you only use it for your streaming devies and keep the rest on the 2GHz band.
Bandwidth should not be a bottleneck anymore, however bad signal quality will!
Keep that in mind when troubleshooting and check that you actually get enough data through to your device.
Some routers are special, like those from your ISP....
In my case the router recognises DLNA traffic and provides some sort of prioritisation for it.
Sounds great but can mean that if you get the source already over WiFi and have busy kids in lockdown that everything else comes to a crawl if you stream 4K content.
Sadly it can also mean that your ISP messes up your experience by not properly forwarding control commands.
Most people won't need to control the player through the sending device but if you do and I does not work at all chack your router setting for something to disable DLNA.
Most have a section for what's connected to the USB port.
Sometimes you find the general setting in there, sometimes it has it's own section.
If you find nothing then don't worry too much ;)

Ok then, how did I get the unsupported formats playing in VR?
By making a list, on one side the files I wanted to watch, on the other side the container, codecs, track numbers and audio channels.
Thanks to modern technology it was then just a few clicks to sort the list by the things I needed.
I ticked the ones off that my headset played properly and noted what was supported.
Then I tried various profiles to check if any of them provide support without transcoding.
The few files that worked this way were noted and the corresponding rules taken from that section in the profile to be used in a user-profile.xml.
Tested that with that the files still play fine.
As MP4 was my target I sorted the remaining files for this and first focussed on the audio stream.
Whatever unsupported audio container or codec I found that still provided a video got a transcoding rule with an * for the video container.
Again in the user-profiles.xml.
Tested that the videos now had sound but ignored if they had the wrong language.
IMHO the important step right after was to change those rules so instead of the * the actual container type was set.
I did without this at first but realised it becomes hard to troubleshoot if make too generic.
Serviio seems to need a specific approach here.
With that I had all the formats sorted that my device could play natively for the video and also had a good starting point for unsupported audio formats.
The rest of my still rather long list of files contains videos in containers or with codecs my headset just won't play.
That means the only way out is to actually transcode them.
Sadly for this step it is not possible to start with just the audio as in most cases the player won't start.
And with the need to transcode the video and audio comes the question of: How much time do you have for it?
I mean both in terms of waiting for a transcoded file to play and defining all the required rules correctly.
Just because my PC can convert a 4K HDR video with True HD sound into a MP4 with AAC stereo about 20 times faster than it play in realtime does not mean it works the same way for streaming it through Serviio.
Makes a lot of sense to prepare some short clips cut out from the original to do the testing.
I found that in many cases Serviio seems to fully convert the file first before even starting to stream it - for a 15GB file that can mean a very very long time until you see something.
The less your device supports the more you need to define rules for and the more transcoding you need.

Is it really worth the hassle?
Don't really know...
It is rewarding though to see more and more files play properly.
IMHO it all depends on how powerful your server machine is and how much your playing device can support.
And I say: If you can cheat than do so first! ;)
Means for things like sound bars and home cinema setups check first if you can simply set your devices to do the required transcoding, especially in terms of audio.
Your amp might accept all sorts of audio codecs but is utterly uselss if your TV as the main receiver won't pass the signal through correctly.
But you might have a setting on both that allows them to deal with the native audio stream in an acceptable way ;)
As long as you don't need to transcode the video of some huge files and a remux wil do I guess Serviio does a really good job.
If you create your own collection from your own DVD's it makes sense to rip them in the best possible way, meaning just the audio you need and all in a container your devices accept without transcoding.
<<

atc98092

User avatar

DLNA master

Posts: 4021

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Fri Jul 24, 2020 1:46 pm

Re: Transcoding from Windows to VR headset in Stereo

Wow, your fingers must have been tired after all that! :D Nice writeup. I concur with using the User-profiles file while experimenting, and with only making small changes at one time. And yes, you really need to know what the device supports natively before beginning to develop a profile.

Fast forward, rewind and resume (called trick play) is seldom supported by players when the files are transcoded, unless the trasncoding format is HLS/AppleHTTP. But it is player dependent, as Roku will not trick play TS files that are not being transcoded. They do just fine with MKV and MP4 files, just not TS. But that's one of the main reasons I use HLS for transcoding in the Roku profiles.
Dan

Samsung NU7100 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 8 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

Ava111-

Serviio newbie

Posts: 1

Joined: Sat Aug 08, 2020 11:56 am

Post Sat Aug 08, 2020 12:00 pm

Re: Transcoding from Windows to VR headset in Stereo

The Roku profiles don't touch normal DTS because the players are capable of bitstreaming it to an AVR. Sounds like you need all DTS transcoded to Dolby Digital. Yes, it is possible to transcode all audio to stereo. Audio transcoding doesn't require much from the CPU, so you don't see huge CPU utilization for just audio.
complete guide to avail Sri Lanka visa for Australian citizen is an easy process if followed as mentioned step wise on visa application website.
<<

atc98092

User avatar

DLNA master

Posts: 4021

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Sat Aug 08, 2020 7:12 pm

Re: Transcoding from Windows to VR headset in Stereo

Ava111- wrote:The Roku profiles don't touch normal DTS because the players are capable of bitstreaming it to an AVR. Sounds like you need all DTS transcoded to Dolby Digital. Yes, it is possible to transcode all audio to stereo. Audio transcoding doesn't require much from the CPU, so you don't see huge CPU utilization for just audio.


The Roku TV profiles do transcode DTS to DD, as most TVs aren't connected to an AVR so I included DTS in them. You are correct that I purposely did not transcode DTS on with the Player profiles, as there are more that use an AVR in that situation.

There are indications that Roku is adding support for Dolby TrueHD, and if I can ever get confirmation on that I'll probably add separate profiles for AVR use and just plugging them into a TV.
Dan

Samsung NU7100 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 8 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

SusanWolford

Serviio newbie

Posts: 2

Joined: Fri Mar 13, 2020 10:23 am

Post Thu Sep 10, 2020 3:04 pm

Re: Transcoding from Windows to VR headset in Stereo

I think Oculus app will help you there:
To turn audio mirroring on:

Open the Oculus app on your PC Computer.
Select Devices in the left menu and click Rift S and Touch.
Use the toggles to select if you want to: Hear VR audio from Computer: Your computer's speakers will play the same things you hear from your VR headset.

Return to Transcoding

Who is online

Users browsing this forum: No registered users and 5 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.