Feel foolish. Checked with mediainfo and there was a problem with the audio file. Finished the processing and got a complete file.
Can now run the files through filebot, then here to organize my library for the best direct play with Plex.
Appreciate your patience with this noob trying to learn on the fly, and your assistance with all the questions.
@buckeyesfan said:
Does the birate affect playback if direct playing through plex, or does it not matter because of the direct play?
Depends on your settings. If the bitrate is above your max upload bandwidth, or above the clientâs demanded bitrate limit. For example if your client asks for 4Mbps and your file is 8Mbps, it will transcode. Same if a remote client tries to play a high bitrate file, even if they request original, if might get transcoded if your max upload bandwidth setting on the server is set to a lower number.
Also, for a long time Chromecast was artificially limited to 12Mbps by Plex, but I think this has been removed now.
So if my limited Spectrum upload is 6Mbps, the number of friends who want to watch through plex is still limited by my speed via the contents bitrate even though it is direct play?
Run them through filebot to rename then through the scripts. If you pull SRT subtitles or other things out of the file it will use the base file name, so might as well get the name right first.
@buckeyesfan said:
So if my limited Spectrum upload is 6Mbps, the number of friends who want to watch through plex is still limited by my speed via the contents bitrate even though it is direct play?
Itâs not so much the number of people as much as the bitrate itself. If you have a 8Mbps file and your upload speed is 6Mbps, your friends wonât be able to direct play through the web because you canât send it fast enoughâŠ
@buckeyesfan said:
So if my limited Spectrum upload is 6Mbps, the number of friends who want to watch through plex is still limited by my speed via the contents bitrate even though it is direct play?
I just got off the phone about 2 hours ago helping a Plex Admin using Sprectrum with a 9Mbps upload and no matter what we did we could not get even low bitrate rate files to stream remotely without buffering with 1.5.2 server version. He was on a Mac mini so I couldnât help him roll back to 1.3.4 to test a theory of mine.
Generally speaking if you donât have about 20Mbps upload then using Plex remotely isnât going to give you a great experience. Any usage in the house or Internet slowdown or latency are going to kill you. Plus you will probably be tied to having to transcode most videos to avoid buffering.
With only 20Mbps upload I wouldnât share my server but would âholdâ that bandwidth for myself in case I had to stream remotely.
You mileage may vary but thatâs what Iâve found.
The scripts AS IS doesnât have the ability to do what you want ask that isnât a goal. The idea is to ALWAYS keep the best tracks for audiophiles but to also create the AAC track for those devices that would require it or OTHERWISE have to transcode. AAC is the âfallbackâ but not the main audio most of us will use.
I wonât make a change to only keep this because it goes against the principle of the solution. HOWEVER with that said you could setup and run ffmpeg with the âcopyâ options for video and just audio track 1 (ALWAYS the AAC) as a secondary process that gets run after this script gets done with it.
iâd recommend you sit on this and think about it long and hard before removing your atmos, dts, dolby, etc audio tracks because I can almost surely guarantee that someday youâll kick yourself in the but and want them.
@buckeyesfan said:
Everything is going very well. But if I only want AAC audio, what can I edit to remove secondary audio?
Why would you that? Someday youâll have a 5.1 system, or youâll share your files with someone who does, and then will miss them⊠it takes such little space compared to the video, just keep them.
I keep a backup of all my files on a separate hard drive, and after making them plex perfect, put them on the drive for my server. This would simply save drive space since they canât be played through plex with my limited bandwith.
I agree that it may be wanted in the future, thatâs why both files. Will Plex only use the audio track that doesnât need transcoding if both are available?
These scripts will create an AAC stereo audio track and mark it default which should play on all devices. The additional tracks if still there will be available for playback for those that can use them.
The amount of space the additional tracks use is trivial.
If you have such limited upload bandwidth that an additional audio track matters then you might want to take a different approach altogether and learn to process all your files similar to YIFI encoding (google it). Otherwise encode everything to MP4 using h.265/HEVC and MAKE SURE every device that touches your Plex server is fully h.265 compatible. HEVC can create smaller files (lower bitrate) with the same quality as h.264 but it comes at a BIG cost in that itâs much harder to process on the client side. It basically takes hardware decoding or serious CPU use to decode. Of course this would mean you really canât share your server with anyone unless they also had the proper hardware to use as well.
Upload speed is around 6 Mbps consistently, but have had 3 streaming at the same time without problems. Just trying to figure out the best scenario, have two kids away at school and a sister in law serving overseas who canât really get American TV regularly.
Any suggestions are taken graciously, and appreciate your hard work with these programs
OK well Iâve give you something to work with that will help you achieve what you want to do without me changing the scripts. Letâs say you just processed âMiddle Man (2016).mp4â through my scripts and you now have the video, AAC plus 2 additional audio tracks and want to end up with only the video and the 1st audio track which will be AAC. You could use the following ffmpeg command.
ffmpeg -i âMiddle Man (2016).mp4â -map 0:0 -map 0:1 -c copy -movflags faststart âMiddle Man (2016)b.mp4â
You could for example make that âC:\convert\done\Middle Man (2016).mp4â for the input and something similar on the output file name. In the above example I just added âbâ to the file name. I just wanted to show you what the map parameters would need to look like and to make sure you include the faststart options to keep the file optimized.
Depending on if your ffmpeg is located in your path you might need to do something like c:\convert\ffmpeg
You of course could turn that into a batch file in a loop with parameters for the file names. So this way you run the programs through my scripts and save them. Then run them through a batch file with the command similar to above to create the stripped down versions you use for Plex. This will add time to your processing but should give you the best of both worlds! If you need help with a batch file to process all files in the directory let me know.
Hope that helps.
Carlo
PS I just tested that on my version of middle man which had the AAC track as well as a 6 channel AC3 audio track the file size dropped from 3,988,706 to 3,692,711 so it saved 305,995 bytes.
Just dipping my toes into python and batch files. Self taught, and somewhat computer literate, just enough to be dangerous, lol.
Any help you would be able to provide would be great. Iâm sure you can write circles around me as I actually learn these by dissecting batch files I find to learn how they operate. If there are any books, etc on these you could recommend that would also be appreciated.
Thanks,
Rick
PS Kinda freaked me out mentioning âMiddle Man (2016).mp4â as I just got that today after my last comment
@cayars, thank you so much for your work on this. It has really kept me from pulling the rest of my hair on with the TrueHD audio transcoding issues in 1.5.1 - 1.5.3 versions of Plex. So much so that iâm now considering running this on my entire library because direct play is so much cooler than transcoding (everyone I know has a roku or appletv4). Not to mention what youâve done with subtitles! Totally changed my world. Many thanks.
@buckeyesfan try the attached powershell script.
Run this instead of the run.bat and let me know what you think.
There are a few variables at the top you will need to modify:
$mediaPath = âc:\convert\processâ
$mediaDone = âc:\convert\doneâ
$mediaDone2 = âc:\convert\done2â
$fileTypes = â*.mp4â
$pythonExe = âc:\python3\pythonâ
$convertDir = âC:\convertâ
mediaPath is where the untouched files are that you would normally process
mediaDone is where the python scripts will deposit the finished files with MULTIPLE audio tracks
mediaDone2 is where you will end up with a process version of the above with only the AAC audio track.
Thereâs some extra logic in the file just to help you get started and have a base to build on. I only spent about a half hour on it then ran 10 files or so through it so it may have some problems but it should be easy to follow the code and fix to your liking.
You will need to put this in the convert directory, open a powershell window with ADMINISTRATOR access.
Change to the convert directory such as cd \convert
then type âŠ\process.ps1 to run it.
It calls the python scrips in manual mode so it processes one file at a time. Python wasnât cooroperative and you donât get to see it processing the files as usual. Itâs in a hidden window. But if you check the mediaDone folder you will see the file growing. Once that process is done it runs ffmpeg to build the 2nd file with only the one audio track and this you see.
If I get time I might play with it some more but this should get you moving and into production quickly.
Carlo
PS youâll have to rename the file and get rid of the .txt at the end of the file name.
Looks like the log variable at the top isnât set for your system correct. Thatâs one of the variables you might need to change.
But for now just to get this working I think I removed all logging from it to streamline and get it working. We can go back to the first version later. Try this one and let me know what you get.
ran another file through, and end result in âdoneâ folder was audio with only AAC codec and the file started with MPEG audio. The audio is very quiet, even when turned up all the way in VLC