If, like me, you’ve spent a bit of time being annoyed that the ps4 doesn’t play all the file formats that you would like, there is now an easy way of making it all work as you would like.
These instructions are for Linux.
The PS4 will play quite happily with an mp4 stream. It doesn’t like receiving much of anything else. This means that your best way of dealing with files is simply to transcode them, on the fly, to mp4. This is relatively easy with ffmpeg.
MediaTomb predominantly works off the file extension to work out the mime-type. From this extension, you can set the mime-type to display properly (in our case, video/mp4), and then use that to work out how the file should be transcoded. This is a very simple setup, and mostly relies on ffmpeg’s ability to sort out any problems without too much assistance.
1. Install mediatomb, and set it up so that it’s working.
Next, we need some new lines in the global config.xml. That can be found in /etc/mediatomb/config.xml
First in the main section, add these lines:
‹extension-mimetype ignore-unknown="yes"› ‹map from="avi" to="video/mp4"/› ‹map from="divx" to="video/x-divx" /›
Being careful not to remove the ones already there.
‹mimetype-profile-mappings› ‹transcode mimetype="video/mpeg" using="mpeg2mpeg"/› ‹transcode mimetype="video/mp4" using="divx2mpeg" /›
These direct the server to transcode files so that they will work on the ps4, and handily, on pretty much any other device as well. You will need a recent version of ffmpeg installed for this to work.
Here’s the transcode section:
‹profile name="mpeg2mpeg" enabled="yes" type="external"› ‹mimetype›video/mpeg‹/mimetype› ‹accept-url›yes‹/accept-url› ‹first-resource›yes‹/first-resource› ‹accept-ogg-theora›yes‹/accept-ogg-theora› ‹agent command="ffmpeg" arguments="-i %in -acodec copy -vcodec copy -vbsf h264_mp4toannexb -f mpegts -y %out" /› ‹buffer size="14400000" chunk-size="512000" fill-size="120000"/› ‹/profile› ‹profile name="divx2mpeg" enabled="yes" type="external"› ‹mimetype›video/mpeg‹/mimetype› ‹accept-url›yes‹/accept-url› ‹first-resource›yes‹/first-resource› ‹accept-ogg-theora›yes‹/accept-ogg-theora› ‹agent command="ffmpeg" arguments="-i %in -qscale 0 -f mpegts -y %out" /› ‹buffer size="14400000" chunk-size="512000" fill-size="120000"/› ‹/profile›
That covers most of the files that I’ve got lying around. I hope that it will help someone out there who’s been struggling with this like I have.
If you find, like I did, that mediatomb just randomly crashes when searching for files, remember to turn on the “ignore-unknown=yes” switch. You will then need to manually add all file-types you want it to search for, but it won’t crash when it comes across an errant thumbs.db created by windblows in your samba share.
I hope that helps someone out.
NOTE : check the ‹ brakets, as for some reason this wordpress version doesn’t show them properly