Handbrake bug - Old MP4 videos with MP3 audio

If you convert your movies with HandBrake and use the MP3 audio format, you may not be able to play the videos in Kodi from version 16 onwards. There is a fix in fmpeg, but this requires the handBrake version number for activation <= 0.10.2

The fix does not work if the encoder tag is as follows:

[breichert@zenwalk ~]$ exiftool videoname.mp4 | grep Encoder
Encoder                         : HandBrake rev5474 2014070999

Script file

You can use the programs exiftool and MP4Box to adjust the encoder tag:

#!/bin/bash
echo "How much files:"
find . -name '*.mp4' -type f | wc -l

echo "Read files:"
find . -type f \( -name "*.mp4" \) -print0 | while read -r -d '' file; do
	VERSION="0.9.4"
	ENCODER=$(exiftool "$file" | grep Encoder) #MP4Box "$file" -info 2>&1 | grep "Encoder Software"
	if [[ $ENCODER == *"HandBrake rev"* ]]
	then
		echo "$file" "->" $ENCODER
		read num1_rev num2_date <<<${ENCODER//[^0-9]/ } NUMBER

		#Handbrake Rev:
		if [ "$num1_rev" -eq "7288" ]
		    then VERSION="0.10.2"
		  elif [ "$num1_rev" -eq "6980" ]
		    then VERSION="0.10.1"
		  elif [ "$num1_rev" -eq "6536" ]
		    then VERSION="0.10.0"
		  elif [ "$num1_rev" -eq "5474" ]
		    then VERSION="0.9.9"
		  elif [ "$num1_rev" -eq "3736" ]
		    then VERSION="0.9.5"
		  elif [ "$num1_rev" -eq "2965" ]
		    then VERSION="0.9.4"
		  else VERSION="0.9.4"
		fi

		ENCODER_TOOL="HandBrake $VERSION rev$num1_rev $num2_date"
		echo "->" $ENCODER_TOOL

		MP4Box -itags tool="$ENCODER_TOOL" "$file"
	fi
done

The Encoder tag looks now as follows:

[breichert@zenwalk ~]$ exiftool videoname.mp4 | grep Encoder
Encoder                         : HandBrake 0.9.9 rev5474 2014070999

And all the old movies are running again.

Comments:

Allowed HTML-Tags: <strong>, <a href="">, <em>
Info: Comment will be shown shortly after processing.