To work around this issue my job now calls a bash script that runs the HandBrakeCLI command which creates the .mkv file. Then the bash script calls transcode_stub.py which updates the mythconverg database and removes the original .mpg file.