[Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
sparky
Posts: 4
Joined: Wed Oct 26, 2016 8:34 am

[Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by sparky »

Anything with DTS (and probably many other formats) won't transcode properly (content will not play), either with FFmpeg or MEncoder. I also have VLC installed, but it doesn't show up in the list of transcoding engines in the #TRANSCODE# folder - anyone have an idea why? The silver lining is that I was able to get tsMuxeR to work properly by installing all of its 32-bit dependencies and it _seems_ to be working pretty decently for some of my files as long as I directly choose it from the #TRANSCODE# folder.

I didn't exactly do the UI command (since this is headless, though I probably could've set up X11 forwarding) to automatically grab the log etc, but I've attached a zip with the TRACE logs demonstrating what's going on with both FFmpeg and MEncoder as well as my UMS.conf.

Let me know if y'all need anything else and thank you very much for the help!

Edit: For a bit more information, when I try to play the content on PS4, the PS4 considers it for a while (displays a loading animation) before it gives up and says "Content cannot be played.". I have not modified my Sony-Playstation4.conf renderer settings at all from the default since I figured they should be sensible. The PS4 cannot play DTS audio, which is why it is trying to transcode. It looks like the default transcode setting for the PS4 is MPEGTS-H264-AC3.

If it matters, the version of mplayer I have installed is 1.2.1-1ubuntu1 amd64, which is the latest version that is in the package repositories for Ubuntu 16.04.

Digging into the trace logs myself, I see the following line during startup which makes it seem as though at least some portion of the system seems to understand that VLC is around.

Code: Select all

INFO  2016-10-25 01:01:53.409 [main] Registering transcoding engine: VLC
I have added the full trace log to the zip (ums-all.log) in addition to the fragments from before. For this test session, I cleared the log, started up UMS, then tried to stream the content via the #TRANSCODE# folder first with FFmpeg (line ~9338 or ~9661, depending on how you look at it), then with MEncoder (line ~9773/~10134), and finally with tsMuxeR (line ~10983) just to show that it works. For giggles I've also included the Sony-Playstation4.conf even though I haven't changed it.
Attachments
ums-logs.zip
(154.96 KiB) Downloaded 513 times
Last edited by sparky on Thu Oct 27, 2016 8:19 am, edited 3 times in total.
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: [Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by Nadahar »

What does it mean that it won't transcode properly? Are there audio artifacts, sync issues, no audio or won't it play at all? Does the PS4 support DTS, and if not - what is it supposed to be transcoded into? Playstation4.conf should be included if at all modified. Also, the full logs are needed, not just some snippets. A lot of relevant information is given earlier in the log and during startup.

I have never used VLC for transcoding so I know virtually nothing about that, but a full trace log might reveal something about this as well.
sparky
Posts: 4
Joined: Wed Oct 26, 2016 8:34 am

Re: [Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by sparky »

Thanks for the feedback! I've modified the original post so that you or anyone else can find all the information required in one place.
sparky wrote: Edit: For a bit more information, when I try to play the content on PS4, the PS4 considers it for a while (displays a loading animation) before it gives up and says "Content cannot be played.". I have not modified my Sony-Playstation4.conf renderer settings at all from the default since I figured they should be sensible. The PS4 cannot play DTS audio, which is why it is trying to transcode. It looks like the default transcode setting for the PS4 is MPEGTS-H264-AC3.

If it matters, the version of mplayer I have installed is 1.2.1-1ubuntu1 amd64, which is the latest version that is in the package repositories for Ubuntu 16.04.

Digging into the trace logs myself, I see the following line during startup which makes it seem as though at least some portion of the system seems to understand that VLC is around.

Code: Select all

INFO  2016-10-25 01:01:53.409 [main] Registering transcoding engine: VLC
I have added the full trace log to the zip (ums-all.log) in addition to the fragments from before. For this test session, I cleared the log, started up UMS, then tried to stream the content via the #TRANSCODE# folder first with FFmpeg (line ~9338 or ~9661, depending on how you look at it), then with MEncoder (line ~9773/~10134), and finally with tsMuxeR (line ~10983) just to show that it works. For giggles I've also included the Sony-Playstation4.conf even though I haven't changed it.
sparky
Posts: 4
Joined: Wed Oct 26, 2016 8:34 am

Re: [Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by sparky »

Any ideas?
Nadahar
Posts: 1990
Joined: Tue Jun 09, 2015 5:57 pm

Re: [Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by Nadahar »

Transcoding issues really isn't my strongest point. FFmpeg seems to start to the transcoding, but shortly thereafter we get:
DEBUG 2016-10-25 23:45:11.382 [New I/O worker #2] Connection error: java.io.IOException: Broken pipe
I don't know why this happens, in fact I don't know anything about pipes under Linux except that "mkfifo" is the command responsible for creating the pipe.

MEncoder seems to have an additional problem, it keeps complaining
DEBUG 2016-10-25 23:45:41.873 [mencoder-17-2] [libx264 @ 0x7f0dc2458560]AVFrame.width or height is not set
DEBUG 2016-10-25 23:45:42.005 [mencoder-17-2] [libx264 @ 0x7f0dc2458560]AVFrame.format is not set
I don't know if that is significant, ultimately mencoder crashes with the same problem as FFmpeg:
DEBUG 2016-10-25 23:45:42.122 [New I/O worker #5] Connection error: java.io.IOException: Broken pipe
I don't know if there's a problem with the pipe process itself or if that is a consequence of the transcoding going wrong. Could there be permission issues with the piping? You could try to run UMS with root permissions to see if that makes any difference.

To get an indication if the problem is with the pipe or with the transcoding itself, you could try to run:

Code: Select all

/home/ums/ums-6.5.1/linux/ffmpeg64 -y -loglevel info -i /home/sb/3tb/Movies/Sausage.Party.2016.1080p.BluRay.DTS.x264-HDMaNiAcS.mkv -bufsize 31250k -maxrate 31250k -crf 19 -ab 640k -ar 48000 -c:a ac3 -c:v libx264 -tune zerolatency -preset ultrafast -level 31 -pix_fmt yuv420p -f mpegts <outputfile>
and

Code: Select all

mencoder -ss 0 /home/sb/3tb/Movies/Sausage.Party.2016.1080p.BluRay.DTS.x264-HDMaNiAcS.mkv -msglevel statusline=2 -oac lavc -of lavf -lavfopts format=mpegts -mpegopts format=mpeg2:muxrate=500000:vbuf_size=1194:abuf_size=64 -ovc lavc -channels 6 -lavdopts debug=0:threads=4 -lavcopts autoaspect=1:vcodec=libx264:acodec=ac3:abitrate=640:threads=4:o=preset=superfast,crf=19,g=250,i_qfactor=0.71,qcomp=0.6,level=3.1,weightp=0,8x8dct=0,aq-strength=0,me_range=16:vrc_maxrate=31250:vrc_buf_size=31250 -nosub -noautosub -ofps 24000/1001 -vf expand=-0:-2,softskip -lavdopts fast -mc 0 -noskip -af lavcresample=48000 -srate 48000 -o <outputfile>
where <outputfile> is the path to the output file. It should probably have a .ts extension for easier playback (VLC can play .ts among others). If these files turn out to be playable, the pipe is probably the problem and vice versa.

Ideally, someone with more knowledge of transcoding issues should reply to this, but it seems there aren't a lof of eager participants.
atamariya
Posts: 146
Joined: Sun Aug 11, 2013 1:15 am

Re: [Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by atamariya »

When a video is transmitted with "video/mpeg" mime type, the renderer makes a follow up request for EOF meta packet where MPEG file info. is stored. This request terminates the original transcoding process causing the playback to fail. I'm surprised more people haven't reported this yet.

Subjunk is working on this. You can follow the progress here.
sparky
Posts: 4
Joined: Wed Oct 26, 2016 8:34 am

Re: [Headless Ubuntu 16.04] Trouble transcoding audio (for PS4)

Post by sparky »

atamariya wrote:When a video is transmitted with "video/mpeg" mime type, the renderer makes a follow up request for EOF meta packet where MPEG file info. is stored. This request terminates the original transcoding process causing the playback to fail. I'm surprised more people haven't reported this yet.

Subjunk is working on this. You can follow the progress here.
Thanks!
Post Reply