In the past I used the Rokoding site for Handbrake settings for all my encodings for DVDs and Blu-Ray content. As I start introducing 4K content to my library I’ll be using Handbrake for a lot of my encodes. The information on the rokoder site is almost a year out of date so I thought I’d check with you wonderfully smart people and see what advice you could give.
I’ve been checking the Handbrake forums and gathering some info there, but if any of you would like to post your favorite settings for both 1080p and 4K content (a setting that works great for both would be nice) I would appreciate it! I looked around and the information really varies, where I thought it might be a little more consistent.
I stream content remotely between home and another residence where I stay during the week and also have multiple TVs using Roku 4’s in my home that have access.
The house is hard wired gigabit switched to every room. I only have 300 mbps upload speed for the time being. (There are plans for faster than 1 GB upload early 2019 in my area) To give you an idea of my network strengths and weaknesses.
I’m not sure if I can actually even stream 4k remotely (haven’t tried it yet).
The server isn’t that high end, it has a Intel Core i7-4790K (quad core 4.0 ghz) and 32 GB of RAM. It has a GTX 750 video card in it, but I have a pair of GTX 960’s (4 gb RAM each) that I can SLI that I thought about throwing in the system if hardware-accelerated streaming would benefit from it. I just enabled that the other day and have been too busy to try any tests to see if I notice any change.
Anyway… that’s what I’m working with as far as network and server hardware. What settings would you recommend for local streaming? Remote streaming? I’m looking for as high quality as I can push without stuttering, buffering, kicking out of the stream with probably no more than 2 people watching at any given time.
Current version of handbrake is 1.1.2 - the settings for handbrake that I’ve been using are for .9.9.5530 so I haven’t upgraded in a while.
Thanks for any suggestions you can give. I’ll continue to search and if I find anything interesting any anyone would like the info I can post here later.
I’m pretty new into the 4k universe. I’ve been experimenting around with the stock Handbrake Roku 4k settings, with fairly decent results.
Without knowing a whole lot about maximizing settings for 4k, I do know that encoding anything to Direct Play will help if you have an underpowered system. A Direct Play scenario is one of the least processor intensive things you can do in the Plex world.
The stock Handbrake settings for the Roku do direct play on a Roku Ultra (and an Xbox One X, btw) but I suspect due to the surprisingly small file size that I can do better.
I normally use this and works for most all devices, even ROKU. Keeps the format from the orginal, so if it was 720p, your end file will be 720p as well. Likewise with a 1080p, you get the same result. Your welcome.
Found this today, while tweaking on encoding for HandBrakeCLI. This command compare to the one I posted a few weeks ago, will basically trim down the file size by half a “Universal” preset. And now that I force the sound into the MP4, there is better direct playback with less of a demand on your stream. It’s lovely !!!
This will take the same amount of time to compress as before, big your picture quality is so much better. Also, just bought a 4K TV myself, since they are on sale for the super bowl. Can’t wait !!!
@RazorBlades, I am trying to do a post processing command line like you are showing.
Can you explain the input/ouput file? I understand that %1 can be used for the input file because Plex passes the file name/location parameter. But what do I do about the output file? Can I simply put %1.mp4 (assuming that’s the ouptu format?) Will Plex then be good enough to take that file and move it to the right directory?
I just want Plex to convert files after they are recorded and put them in the right directories under the right names just as if this script wasn’t being run.
Below is part of my script on how to have it goes through your directory and coverts the recorded " *.ts " files to " *.mp4 " format. I have a backup directory, I use, so that if something happens during conversion, I have a backup copy of the original. Then I can just copy the file back and re-run the script.
#!/bin/sh
###############################################################################
#
# Script to recursively search a directory and batch convert all files of a given
# file type into another file type via HandBrake conversion.
#
# To run in your environment set the variables:
# hbcli - Path to your HandBrakeCLI
#
# source_dir - Starting directory for recursive search
#
# input_file_type - Input file type to search for
#
# output_file_type - Output file type to convert into
#######################################################
# Variables for directory where recorded TS files are to convert to MP4
#######################################################
source_dir="/media/plex/2TB-DRIVE/PLEX-MEDIA/TVSHOWS/SpinCity/"
input_file_type="ts"
output_file_type="mp4"
###########################################
# Convert from one file to another
convert() {
# Where backup copy is kept
echo "# Copying file" "$1" "to directory /media/plex/2TB-DRIVE/PLEX-MEDIA/_Backup-videos/tvshows/ #" >> /var/log/syslog
# Copy file to backup area
echo "" | cp -p "$1" /media/plex/2TB-DRIVE/PLEX-MEDIA/_Backup-videos/tvshows/;
# Convert TS file to MP4, first pass will fill in input and output file names
# Then proceed until all TS files in this directory and subdir are completed before moving on
echo "" | HandBrakeCLI -i "$1" -o "$2" --preset "Very Fast 1080p30" --optimize --two-pass --turbo --aencoder av_aac --mixdown 5point1 --adither auto --auto-anamorphic;
# Replace TS file with mp4 and remove TS file in it's place
echo "" | rm "$1";
}
# Find the files and pipe the results into the read command. The read command properly handles spaces in directories and files names.
find $source_dir -name *.$input_file_type | while read in_file
do
echo "Processing…" >> /var/log/syslog
echo ">Input "$in_file >> /var/log/syslog
# Replace the file type
out_file=$(echo $in_file|sed "s/\(.*\.\)$input_file_type/\1$output_file_type/g")
echo ">Output "$out_file >> /var/log/syslog
# Convert the file
convert "$in_file" "$out_file"
if [ $? != 0 ]
then
echo "$in_file had problems" >> handbrake-errors.log
fi
echo ">Finished "$out_file "\n\n" >> /var/log/syslog
done
you can repeat this over and over for the different dirs you have. Making sure you change the " source_dir " to the directory you want to convert next.
This script works alone from the postscript command you can try after a recording. I had trouble trying to implement it as a post. What I normally do is add it to the “crontab” for after the time of the recording, and allow 15 minutes, so PLEX can finish processing the file, even is it’s removing commercials for you. 15 minutes is the magic number or time frame. I make a script for types of shows. Like for example, I have a script for NEWS, TVSHOWS, MOVIES. That way I can run them independently from one another.
Razor, I appreciate the detailed script, but was hoping for the one command and done automatically result. Since this needs to be done on a per directory basis, that’s more than I really was optimally hoping for. I suppose a nice feature to add into Plex is Convert all recordings to mp4 at “x” encoding level before writing to the final directory.
The reason why I have it do on only certain directories is, if you are recording in others, this will grab it and start working with the file as it’s being recorded. Done this a few times by mistake while the file is being generated in the " .grab " directory. Funny thing is, it can process as the file gets larger. And when it’s done, move the “MP4” file an not worry about the “TS” file I deleted in the process. Sometimes it works on the fly like that, and other times, the encoding has issues where I have to re-do it.
No problem in sharing. I also built a clean up script that deletes my backup files after a week to keep the system running tip-top. And gives me time, if a recording failed during conversion, I have time to re-run it. Especially for the movies I’m recording OTA and some of the old time shows. I always use the RAW TS format. That way when I stream down the file size for web streaming the picture and sound quality stays in tack.
ant then the worryes with windows and notepad++ (bin/sh^M : bad interpreter)
Just run sed -i ‘s/\r//’ filename over it
And I still have Problems When I have a folder with spaces, it sees it as diffrent folders
root@MACBOOKPRO:/media/tmb/PLEX/Media/Privat/Staying up late 2018 11 03/Season 01# sudo ./handbrake.sh
find: ‘/media/tmb/PLEX/Media/Privat/Staying’: No such file or directory
find: ‘up’: No such file or directory
find: ‘late’: No such file or directory
find: ‘2018’: No such file or directory
find: ‘11’: No such file or directory
find: ‘03/Season’: No such file or directory
find: ‘01’: No such file or directory
Here ends my google jurnely because I dont know where I could find a fix for that.
Maybe an Idea how to fix that?
Found this today, while tweaking on encoding for HandBrakeCLI. This command compare to the one I posted a few weeks ago, will basically trim down the file size by half a “Universal” preset. And now that I force the sound into the MP4, there is better direct playback with less of a demand on your stream. It’s lovely !!!
This will take the same amount of time to compress as before, big your picture quality is so much better. Also, just bought a 4K TV myself, since they are on sale for the super bowl. Can’t wait !!!
New line produces English (AAC 5.1) sound track @ 1080p for higher resolution 720p recordings at Width 1280 x Height 720. And for 1080p recordings at Width 1920 x Height 1078 .