Jump to content

Roku Detect Uncompliant Videos


Nologic

Recommended Posts

Nologic

Why:

mediacowboy needed something to help find videos that wouldn't play directly on the Roku, but ended up required transcoding to do so.

 

Notes:

This only detects at present very basic reasons a file might fail.

Container not mkv, mp4, mov, m4v, m3u8, ts

Video Codec not H.264

Audio Codec not AC3 or Stero AAC

 

Requirements:

AutoIt

FFMpeg

 

Instructions:

Install AutoIt and set it to execute scripts when double clicked.

 

Create a folder somewhere...lets call it "Roku Detect uncompliant Videos" just to be unimaginative.

 

Now inside "Roku Detect Uncompliant Videos" create a sub folder called "Bin".

 

Now extract the contents of FFMpeg's "Bin" folder into your new "Bin" sub folder.

 

Now going back into "Roku Detect Uncompliant Videos" folder Right Click on it's background and select "New\AutoIt v3 Script" from the context menu, and Rename it "Roku Detect Uncompliant Videos.au3"

 

Now Right Click "Roku Detect Uncompliant Videos.au3" & select "Edit Script" from the context menu.

 

Now paste the following code into:

#Include <Array.au3>
#Include <File.au3>
#Include <String.au3>

Dim $aKnown[7] = [6 , '.mkv' , '.mp4' , '.mov' , '.m4v' , '.m3u8' , '.ts']
Dim $aUnknown[1] = [0]
Dim $sErrorLog

; Select Video Folder
While 1
	$sFolder = FileSelectFolder( 'Select Video Folder.' , '' , 6 )
	If @Error = 1 AND $sFolder = '' Then
		MsgBox( 4096 , 'Exit:' , 'Ending Application' )
		Exit
	ElseIf $sFolder = '' Then
		MsgBox( 4096 , 'Error:' , 'Unable To Open Folder.' )
	ElseIf NOT FileExists ( $sFolder ) Then
		MsgBox( 4096 , 'Error:' , 'Invalid Folder.' )
	Else
		If StringRight( $sFolder , 1 ) <> '\' Then $sFolder &= '\'
		$aAllFiles = _FileListToArrayRec( $sFolder , '*.*|*.bif;*.db;*.jpg;*.nfo;*.png;*.tbn;*.xml;*.srt;*.sub;*.ssa;*.mp3' , 1 , 1 , 0 , 2 )
		If NOT IsArray( $aAllFiles ) Then
			MsgBox( 4096 , 'Error:' , 'No Videos Found.' )
		Else
			_ArraySort( $aAllFiles , 0 , 1 )
			ExitLoop
		EndIf
	EndIf
WEnd

For $ii = 1 To $aAllFiles[0]
	_Macros( $aAllFiles[$ii] )
	$iFind1 = _ArraySearch( $aKnown , $sFileExt , 1 )
	If @Error Then
		$sErrorLog &= 'Unknown File Type:' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF
		$iFind2 = _ArraySearch( $aUnknown , $sFileExt , 1 )
		If @Error Then
			_ArrayAdd( $aUnknown , $sFileExt )
			$aUnknown[0] += 1
		EndIf
	Else
		; Build Array of Streams
		$sRandomString = _RandomString()
		RunWait( @ComSpec & ' /c ffprobe -show_streams "' & $aAllFiles[$ii] & '">"' & @TempDir & '\' & $sRandomString & '.txt"' , @ScriptDir & '\BIN\' , @SW_HIDE )
		$aAllStreams = _StringBetween( FileRead( @TempDir & '\' & $sRandomString & '.txt' ) , '[STREAM]' , '[/STREAM]' )
		FileDelete( @TempDir & '\' & $sRandomString & '.txt' )

		; Find Video Streams
		$aFindVideoStreams = _ArrayFindAll( $aAllStreams , 'codec_type=video' , 0 , 0 , 0 , 1 )
		If $aFindVideoStreams <> -1 Then
			; Process Video Streams
			For $aa = 0 To UBound( $aFindVideoStreams ) - 1
				$sSVideoCodec = _RegExString( $aAllStreams[$aFindVideoStreams[$aa]] , '(?s)(?i)(?:.+?codec_name=(\S+))?' )
				If $sSVideoCodec <> 'h264' And $sSVideoCodec <> 'mpeg4' Then
					$sErrorLog &= 'Unsupported Video Codec: (' & $sSVideoCodec & ')' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF
					ContinueLoop 2
				EndIf
			Next
		Else
			$sErrorLog &= 'Missing Video Stream:' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF
			ContinueLoop
		EndIf

		; Find Audio Streams
		$aFindAudioStreams = _ArrayFindAll( $aAllStreams , 'codec_type=audio' , 0 , 0 , 0 , 1 )
		If $aFindAudioStreams <> -1 Then
			; Process Audio Streams
			For $aa = 0 To UBound( $aFindAudioStreams ) - 1
				$sSAudioCodec    = _RegExString( $aAllStreams[$aFindAudioStreams[$aa]] , '(?s)(?i)(?:.+?codec_name=(\S+))?' )
				$iSAudioChannels = _RegExString( $aAllStreams[$aFindAudioStreams[$aa]] , '(?s)(?i)(?:.+?channels=(\S+))?'   )
				If $sSAudioCodec <> 'AAC' And $sSAudioCodec <> 'AC3' Then
					$sErrorLog &= 'Unsupported Audio Codec: (' & $sSAudioCodec & ')' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF
					ContinueLoop 2
				EndIf
				If $sSAudioCodec = 'AAC' And $iSAudioChannels > 2 Then
					$sErrorLog &= 'To Many Audio Channels: (' & $iSAudioChannels & ')' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF
					ContinueLoop 2
				EndIf
			Next
		Else
			$sErrorLog &= 'Missing Audio Stream:' & @CRLF & $aAllFiles[$ii] & @CRLF & @CRLF
			ContinueLoop
		EndIf
	EndIf
Next

; Create Error Log
If StringLen( $sErrorLog ) > 1 Then
	If NOT FileExists( @ScriptDir & '\Error Logs\' ) Then DirCreate( @ScriptDir & '\Error Logs\' )
	$sErrorLogFile = @ScriptDir & '\Error Logs\[' & @YEAR & '-' & @MON & '-' & @MDAY & '] ' & @HOUR & '-' & @MIN & '-' & @SEC & '.txt'
	FileWrite( $sErrorLogFile , $sErrorLog )
	ShellExecute( $sErrorLogFile )
EndIf

; Create Unknown File Extensions Text
If $aUnknown[0] > 0 Then
	$sUknownExtensions = @ScriptDir & '\UnKnown.txt'
	If FileExists( $sUknownExtensions ) Then
		Dim $aPriorUnknown
		_FileReadToArray( $sUknownExtensions , $aPriorUnknown )
		For $ii = 1 To $aPriorUnknown[0]
			$iFind2 = _ArraySearch( $aUnknown , $aPriorUnknown[$ii] , 1 )
			If @Error Then
				_ArrayAdd( $aUnknown , $aPriorUnknown[$ii] )
				$aUnknown[0] += 1
			EndIf
		Next
		FileDelete( $sUknownExtensions )
	EndIf
	_FileWriteFromArray( $sUknownExtensions , $aUnknown , 1 )
	ShellExecute( $sUknownExtensions )
EndIf

MsgBox( 0 , 'Finished' , 'Batch Operation Complete' )



Func _Macros( $sFile )
	Global $sFileDir    = StringLeft     ( $sFile     , StringInStr( $sFile     , '\' , 0 , -1 ) )
	Global $sFileExt    = StringTrimLeft ( $sFile     , StringInStr( $sFile     , '.' , 0 , -1 ) - 1 )
	Global $sFileName   = StringTrimLeft ( $sFile     , StringInStr( $sFile     , '\' , 0 , -1 ) )
	Global $sShortName  = StringLeft     ( $sFileName , StringInStr( $sFileName , '.' , 0 , -1 ) - 1 )
	Global $sParent     = StringLeft     ( $sFileDir  , StringInStr( $sFileDir  , '\' , 0 , -2 ) )
	Global $sFolderName = StringTrimRight( StringTrimLeft( $sFileDir , StringInStr( $sFileDir , '\' , 0 , -2 ) ) , 1 )
EndFunc

Func _RandomString()
	$sString = ''
	Dim $aSpace[3]
	For $i = 1 To 15
		$aSpace[0] = Chr( Random( 65 ,  90 , 1 )) ; A-Z
		$aSpace[1] = Chr( Random( 97 , 122 , 1 )) ; a-z
		$aSpace[2] = Chr( Random( 48 ,  57 , 1 )) ; 0-9
		$sString &= $aSpace[Random( 0 , 2 , 1 )]
	Next
	Return $sString
EndFunc

Func _RegExString( $sString , $sRegEx )
	Local $sValue = _ArrayToString( StringRegExp( $sString , $sRegEx , 1 ))
	If StringIsFloat( $sValue ) = 1 OR StringIsInt( $sValue ) = 1 Then
		Return Number( $sValue )
	Else
		If $sValue = 'N/A' OR $sValue = 'N' OR $sValue = 'A' Then
			Return ''
		Else
			Return $sValue
		EndIf
	EndIf
EndFunc

Now save the script & execute it by double clicking it and then select the folder holding your videos that you wish to process.

 

Now go do something else, this will take a while...maybe a great while depending on the number of videos you have.

 

The script will notify you when it's done...and if you're curious as to if it's still running there should be a icon in your system tray that looks like a blue "A". Past that you can start your Task Manager and you should more than likely see FFMpeg running in the background.

 

Result:

This should possibly produce one or more text files.

 

The primary one will be what is produced in the "Error Logs" folder, this will list what files failed and why...but keep in mind these only list the first reason why it failed, not all possible reasons it may have failed. A number of these may not even be video files at all...but a format that should have been excluded from the search.

 

Which brings me to the next file "UnKnown.txt" this file will be updated with one instance per unknown file extension, possibly every time you run the script and it finds something new.

 

Now ideally I have all or at least most common non video extensions excluded from the search...this is everything on the right side of the pipe "|" symbol on line 21 at present.

 

You may wish to add new extensions to be excluded from future searches...thus speeding the script along...but please consider sharing your additional excludes here in this thread, to help others out as well.

 

What Next:

You may wish to use one of my app's, called VideoGain (free) to process the failed video files. It's main purpose is to batch adjust audio volume, so that all the videos have more or less the same gain...so you don't have to monkey around with your volume all the time.

 

Originally it only processed folders full of videos...not individual, but since I was already making some corrections to it already...I set it up to do single files as well.

 

Here is where we get hackish. :)

 

Download VideoGain & extract it somewhere...ideally in a folder called VideoGain so it's easier to find later on. Now Start it by double clicking on it's exe...then close the app...it will now have produced a new INI file...and we are going to edit it's contents with whatever your favorite text editor happens to be (Notepad, Notepad++, UltraEdit,..).

 

In the VideoGain.ini all the way at the bottom...you should see an entry called "[Folders]".

 

Now below that we'll be adding entries of our own...basically copy and paste from your Error Logs...into this file...but before each path put "Folder_#=" replacing the # with a number value...please keep each value different, and each entry on a new line.

 

I'll likely write a simple script to help in this matter tomorrow.

 

Anyways once all the edits are made...save the file, and restart VideoGain.

 

You should now see all the files you want to process listed on the "Folders" tab.

 

Now check "Direct Replace" and uncheck "Recurse Folders" (not needed).

 

Now click on the "Settings" tab.

 

If you had any videos that failed because they were not H264 then set the Encoder to "Conditional" which basically means if VideoGain doesn't detect the video stream to be H264..to then encode..but only then. Make further adjustments as you like to the H264 settings and Video settings.

 

Now if you had Audio errors, you have a few picks...you can go with AAC or AC3...encoders...with the covet that AAC is limited to stereo. Right now if you select AC3...all videos will have the audio track re-encoded, bar non...I don't have an early out for that right now as I just added AC3 support...however if you select AAC and a number of your tracks are already AAC...and those tracks are Stereo...then you can select "ReplayGain (Tags)" this will do a non damaging adjustment to the AAC tracks...however all non AAC tracks will be encoded to AAC.

 

Select "Stereo DownMix" if you plan to use AAC.

 

All resulting files will ether be Mp4 or Mkv depending on what you selected for a container, from the drop down at the bottom of the application.

 

Press "Start" and away you go.

 

I would personally suggest doing at little processing as you need to. Each time something gets encoded...it gets more damaged.

Edited by Nologic
  • Like 2
Link to comment
Share on other sites

mediacowboy

Testing this out now. Thank you so much.

 

Add ";*.srt;*.sub;*.ssa;*.mp3".

srt, sub, and ssa is for the subtiutles if you downloaded them.

MP3 is for the theme music if you download that.

Edited by mediacowboy
Link to comment
Share on other sites

mediacowboy

Okay it just finished running and I don't think something is right. What I mean is it ran and it is reporting movies that already have .bif files and that direct play. I am re running it to see what is going on.

 

Attached is the latest log file. From what I can tell It shouldn't be seeing everything it is because mpeg4 is a supported video codec for the roku and .mov files are supported.

2015-03-07 12-00-17.txt

Edited by mediacowboy
Link to comment
Share on other sites

Nologic

Okay cheese script time.

 

This is used to take an error log, and convert it's info into fake INI entries for use with VideoGain.

 

Create a new AutoIt script call it "Fake INI's.au3"

 

Add the following code to it.

#Include <Array.au3>
#Include <File.au3>
#Include <FileConstants.au3>
#Include <String.au3>

Dim $aLog
Dim $aFile[1]     = [0]
Dim $aVideo[1]    = [0]
Dim $aAudio[1]    = [0]
Dim $aChannels[1] = [0]
Dim $aBroken[1]   = [0]


$sFileOpenDialog = FileOpenDialog( 'Select Error Log' , @ScriptDir & '\' , 'Text (*.txt)' , $FD_FILEMUSTEXIST )

_FileReadToArray( $sFileOpenDialog , $aLog )

For $ii = 1 To $aLog[0] Step 3
	_CheckAddToArray( $aFile  ,    $aLog[$ii] , $aLog[$ii + 1] , 'Unknown File Type:' )
	_CheckAddToArray( $aVideo ,    $aLog[$ii] , $aLog[$ii + 1] , 'Unsupported Video Codec: (' )
	_CheckAddToArray( $aAudio ,    $aLog[$ii] , $aLog[$ii + 1] , 'Unsupported Audio Codec: (' )
	_CheckAddToArray( $aChannels , $aLog[$ii] , $aLog[$ii + 1] , 'To Many Audio Channels: (' )
	
	_CheckAddToArray( $aBroken , $aLog[$ii] , $aLog[$ii + 1] , 'Missing Video Stream:' )
	_CheckAddToArray( $aBroken , $aLog[$ii] , $aLog[$ii + 1] , 'Missing Audio Stream:' )
Next

_StringToFile( _MyArrayToString( $aFile )     , @ScriptDir & '\File.txt' )
_StringToFile( _MyArrayToString( $aVideo )    , @ScriptDir & '\Video.txt' )
_StringToFile( _MyArrayToString( $aAudio )    , @ScriptDir & '\Audio.txt' )
_StringToFile( _MyArrayToString( $aChannels ) , @ScriptDir & '\Channels.txt' )
_StringToFile( _MyArrayToString( $aBroken )   , @ScriptDir & '\Broken.txt' )

MsgBox ( 0 , 'Finished' , 'Batch Operation Complete' )



Func _CheckAddToArray( ByRef $aArray , $sString1 , $sString2 , $sStringCheck )
	If StringInStr( $sString1 , $sStringCheck ) <> 0 Then
		_ArrayAdd( $aArray , $sString2 )
		$aArray[0] += 1 
	EndIf
EndFunc

Func _MyArrayToString( ByRef $aArray )
	$sString = ''
	If $aArray[0] > 0 Then
		$sString &= '[Folders]' & @CRLF
		For $ii = 1 To $aArray[0]
			$sString &= 'Folder_' & _StringRepeat( '0' , 3 - StringLen( $ii )) & $ii & '=' & $aArray[$ii] & @CRLF
		Next
	EndIf
	Return $sString
EndFunc

Func _StringToFile( $sString , $sFile )
	If StringLen( $sString ) > 0 Then
		If FileExists( $sFile ) Then FileDelete( $sFile )
		FileWrite( $sFile , $sString )
	EndIf
EndFunc

Then execute it and select your error log...it'll produce a few different text files, based on the current set of errors used in the main script at the head of this thread.

Link to comment
Share on other sites

Nologic

Okay new helper script...this will read the error log and move files into new sub folders for further processing. Ideally to make things easier for folks not using something like VideoGain....which in it's self has limited use.

 

By default this will move files into sub folders, located in the same folder as the script...this can of course be edited...lines 32 through 36.

 

Please keep in mind you'll need space for all the files being moved.

 

Now there is a var on line 7...which is currently set to 1...this means it'll grab the parent folder name, that the file is in.

 

Example:

 

D:\Movies\21 Jump Street (2012)\21 Jump Street (2012).mp4

 

Turns into

 

F:\MyScripts\Roku Detect Uncompliant Videos\_Unsupported Video Codec\21 Jump Street (2012)\21 Jump Street (2012).mp4

 

This of course can be changed to say a value of 2 for TV shows.

Example:

 

W:\TV Shows\Vikings (2013)\Season 03\03X01 - Mercenary.mp4

 

Turns into

 

F:\MyScripts\Roku Detect Uncompliant Videos\_Unsupported Video Codec\Vikings (2013)\Season 03\03X01 - Mercenary.mp4

 

Anyway here is the code...have fun.

#Include <Array.au3>
#Include <File.au3>
#Include <FileConstants.au3>
#Include <String.au3>


$iFolderDepth = 1


Dim $aLog
Dim $aFile[1]     = [0]
Dim $aVideo[1]    = [0]
Dim $aAudio[1]    = [0]
Dim $aChannels[1] = [0]
Dim $aBroken[1]   = [0]


$sFileOpenDialog = FileOpenDialog( 'Select Error Log' , @ScriptDir & '\' , 'Text (*.txt)' , $FD_FILEMUSTEXIST )

_FileReadToArray( $sFileOpenDialog , $aLog )

For $ii = 1 To $aLog[0] Step 3
   _CheckAddToArray( $aFile  ,    $aLog[$ii] , $aLog[$ii + 1] , 'Unknown File Type:' )
   _CheckAddToArray( $aVideo ,    $aLog[$ii] , $aLog[$ii + 1] , 'Unsupported Video Codec: (' )
   _CheckAddToArray( $aAudio ,    $aLog[$ii] , $aLog[$ii + 1] , 'Unsupported Audio Codec: (' )
   _CheckAddToArray( $aChannels , $aLog[$ii] , $aLog[$ii + 1] , 'To Many Audio Channels: (' )
   
   _CheckAddToArray( $aBroken , $aLog[$ii] , $aLog[$ii + 1] , 'Missing Video Stream:' )
   _CheckAddToArray( $aBroken , $aLog[$ii] , $aLog[$ii + 1] , 'Missing Audio Stream:' )
Next

_MyArrayMove( $aFile     , $iFolderDepth , @ScriptDir & '\_Unknown File\' )
_MyArrayMove( $aVideo    , $iFolderDepth , @ScriptDir & '\_Unsupported Video Codec\' )
_MyArrayMove( $aAudio    , $iFolderDepth , @ScriptDir & '\_Unsupported Audio Codec\' )
_MyArrayMove( $aChannels , $iFolderDepth , @ScriptDir & '\_To Many Channels\' )
_MyArrayMove( $aBroken   , $iFolderDepth , @ScriptDir & '\_File Broken\' )

MsgBox ( 0 , 'Finished' , 'Batch Operation Complete' )



Func _CheckAddToArray( ByRef $aArray , $sString1 , $sString2 , $sStringCheck )
   If StringInStr( $sString1 , $sStringCheck ) <> 0 Then
      _ArrayAdd( $aArray , $sString2 )
      $aArray[0] += 1 
   EndIf
EndFunc

Func _MyArrayMove( ByRef $aArray , $iFolderDepth , $sFolderPath )
   If StringRight( $sFolderPath , 1 ) = '\' Then $sFolderPath = StringTrimRight( $sFolderPath , 1 )
   If $aArray[0] > 0 Then
      For $ii = 1 To $aArray[0]
         If FileExists( $aArray[$ii] ) Then
            _Macros( $aArray[$ii] , $iFolderDepth )
            FileMove( $aArray[$ii] , $sFolderPath & $sFileBase & $sFileName , 9 )
         EndIf
      Next
   EndIf
EndFunc

Func _Macros( $sFile , $iDepth = 0 )
   Global $sFileDir    = StringLeft     ( $sFile     , StringInStr( $sFile     , '\' , 0 , -1 ) )
   Global $sFileExt    = StringTrimLeft ( $sFile     , StringInStr( $sFile     , '.' , 0 , -1 ) - 1 )
   Global $sFileName   = StringTrimLeft ( $sFile     , StringInStr( $sFile     , '\' , 0 , -1 ) )
   Global $sShortName  = StringLeft     ( $sFileName , StringInStr( $sFileName , '.' , 0 , -1 ) - 1 )
   Global $sParent     = StringLeft     ( $sFileDir  , StringInStr( $sFileDir  , '\' , 0 , -2 ) )
   Global $sFileBase   = StringTrimLeft ( $sFileDir  , StringInStr( $sFileDir  , '\' , 0 , Number( '-' & $iDepth ) + -1 ) - 1 )
   Global $sFolderName = StringTrimRight( StringTrimLeft( $sFileDir , StringInStr( $sFileDir , '\' , 0 , -2 ) ) , 1 )
EndFunc

Link to comment
Share on other sites

  • 1 year later...
mediacowboy

@@Nologic,

 

On line 55 if I change to FileMove to FileCopy will that break or the script or do what I want it to do which is copy the file and not move it?

            FileMove( $aArray[$ii] , $sFolderPath & $sFileBase & $sFileName , 9 )

P.S. Sorry for bring up a old thread but I noticed recently more stuff was transcoding.

Edited by mediacowboy
Link to comment
Share on other sites

mediacowboy

I answered my own question from the previous post.

 

Now I have another. How can I make this check the frame rate? Roku doesn't like anything over 30 and I believe I have some shows with a frame rate of 60.

Link to comment
Share on other sites

 Roku doesn't like anything over 30 and I believe I have some shows with a frame rate of 60.

 

Which roku? Any modern roku, roku3 (roku2 2016) or greater can do 60fps fine. It is when the content is 1080p60 the roku3 chipset and all devices below it have problems. You should be able to direct play 60fps and get BIF for it too. If it isn't generating BIF for things using 60fps the roku bif generator needs updating to allow it.

Link to comment
Share on other sites

  • 9 months later...
Waldonnis

I glanced over the script and it probably should be updated to reflect some of the codecs that Roku added support for (FLAC, notably, and HEVC for the 4k models).  If I get some time this weekend, I'll take a better look at it and try to refactor the script so it can be more easily customised for the environment and handle differences between the models.  For example, if all of your Rokus are connected to AVRs, then DTS 5.1 audio should be fine, but wouldn't be if one Roku isn't AVR connected.  Also, as speechles pointed out, some framerate/resolution combos wouldn't work on some models but will on others, so I'll see if I can come up with a way to account for that.

 

I have some ideas on how to accomplish all of that, and it may even make it useful for non-Roku devices as well.  Basically, creating a "device profile" for each model, then provide configuration vars to allow users to pick the models they use via boolean vars or some other method.  The media info could be tested against each of those and report which files will direct play on each (or all) models.  This would let each model's quirks to be considered and make it easier to extend for new models in the future.  The concept could be expanded to include other devices/browsers, but that's a bit more work.  Not sure how long it'll take me to do any of this...time is a bit tight lately.

 

Thumbs up to Nologic on the AutoIt script, though.  It's nicely done.  :)  I always forget about AutoIt when scripting stuff on Windows...I should use it more.

  • Like 1
Link to comment
Share on other sites

I just tried this - looks promising - pointed it to my movies folder, and I have shedloads of 'Unknown File Type:'  seems to be on all the .avi files.

Link to comment
Share on other sites

  • 3 weeks later...
Nologic

@ Waldonnis -

 

First off thanks...as for AutoIt...well only if you know it...and don't know how to use better langs (C, C++, C#, VB.Net, ...)...don't get me wrong...it's good for what it is (mainly manipulation of GUI's)...past that it's at least better than Batch scripts...but not as good as Powershell.

 

As for refactoring the script...I'd suggest a simple GUI with a drop down menu box, that the end user can select their model...and a checkbox for if it's connected to a AVR.

 

I'd suggest the drop menu reads from an INI file...something that looks roughly like this:
 


[Ultra (4660)]
Container=MKV, MP4, MOV, M4V, M3U8, TS
Audio=AAC|7.1, AC3|7.1, FLAC|7.1, MP3|2.0
Video=H264|2160p|60, HEVC|{1080p|60 / 2160p|30}, MPEG4|2160p|60

So the section head is the name of the model...and the key's below describe what is allowed.

 

In the suggested format it's a simple comma separated sets, that are then defined again by pipe symbols...but in the case of multiple options for a set...things are then encased in braces and separated by forward slashes.

 

So "Container" is rather straight forward with the different containers not really having anything else to note.

 

However "Audio" lists a codec & the number of channels supported by that codec for that model...my values are fake...so give no heed to them.

 

Now "Video" things get more complex...in example 1 it lists H264 being supported up to 4k at 60fps...but in example 2 it lists HEVC supporting both 1080p @ 60fps & 4k @ 30fps ...again values are fake. :)

 

I'm not sure if subtitles should be added or not...given I no longer have a Roku to toy with.

 

Anyways I did a template of an INI based off the values listed on this page.

[Roku DVP (N1000)]
Container=
Audio=
Video=

[Roku SD (N1050)]
Container=
Audio=
Video=

[Roku HD (N1100)]
Container=
Audio=
Video=

[Roku HD-XR (N1101)]
Container=
Audio=
Video=

[Roku HD (2000)]
Container=
Audio=
Video=

[Roku XD (2050)]
Container=
Audio=
Video=

[Roku XDS (2100)]
Container=
Audio=
Video=

[Roku LT (2400)]
Container=
Audio=
Video=

[Roku LT (2450)]
Container=
Audio=
Video=

[Roku HD (2500)]
Container=
Audio=
Video=

[Roku 2 HD (3000)]
Container=
Audio=
Video=

[Roku 2 XD (3050)]
Container=
Audio=
Video=

[Roku 2 XS (3100)]
Container=
Audio=
Video=

[Roku Streaming Stick, MHL (3400, 3420)]
Container=
Audio=
Video=

[Roku Streaming Stick, HDMI (3500)]
Container=
Audio=
Video=

[Roku LT (2700)]
Container=
Audio=
Video=

[Roku 1, SE (2710)]
Container=
Audio=
Video=

[Roku 2 (2720)]
Container=
Audio=
Video=

[Roku 3 (4200)]
Container=
Audio=
Video=

[Roku 2 (4210)]
Container=
Audio=
Video=

[Roku 3 (4230)]
Container=
Audio=
Video=

[Roku Streaming Stick (3600)]
Container=
Audio=
Video=

[Roku 4 (4400)]
Container=
Audio=
Video=

[Roku Express (3700)]
Container=
Audio=
Video=

[Roku Express+ (3710)]
Container=
Audio=
Video=

[Roku Premiere (4620)]
Container=
Audio=
Video=

[Roku Premiere+ (4630)]
Container=
Audio=
Video=

[Roku Ultra (4640)]
Container=
Audio=
Video=

[Express (3900)]
Container=
Audio=
Video=

[Express+ (3910)]
Container=
Audio=
Video=

[Streaming Stick (3800)]
Container=
Audio=
Video=

[Streaming Stick+ (3810)]
Container=
Audio=
Video=

[Ultra (4660)]
Container=MKV, MP4, MOV, M4V, M3U8, TS
Audio=AAC|7.1, AC3|7.1, FLAC|7.1, MP3|2.0
Video=H264|2160p|60, HEVC|{1080p|60 / 2160p|30}, MPEG4|2160p|60


I was going to bang out an example script for you to take and run with...but it's turning out that I don't have the time today that I was hoping for in which to do it. :(

 

@ vaise -

 

That is because as the script is now, it doesn't list AVI as an acceptable container...if your Roku will in fact play AVI containers than the script should be edited.

 

Change the following line.

Dim $aKnown[7] = [6 , '.mkv' , '.mp4' , '.mov' , '.m4v' , '.m3u8' , '.ts']

To

Dim $aKnown[8] = [7 , '.avi' , '.mkv' , '.mp4' , '.mov' , '.m4v' , '.m3u8' , '.ts']

Best of luck.

Link to comment
Share on other sites

Thanks @@Nologic for that mod to the script.  I am running it now.  I never knew the avi file type was not supported on the roku's - many thousands of files I have in AVI format.....  I guess I can convert them but that would take weeks - plus be a pain for emby as it will think there is a new media file - and throw off all the watch lists etc for all the users I would think. The rest seem to be Unsupported Audio Codec: (mp3) which is also a daunting number of files.........

 

Seems like way too much work.

 

I assume if I used an android TV box and the emby android app, that would play avi's and the mp3 audio codec ?   gotta weigh up a mass re-encode/conversion vs replacing a load of roku's......

 

V.

Link to comment
Share on other sites

mediacowboy

One way of avoiding the watch issue would be syncing to trakt.tv. I believe though that it isn't the file itself that gets marked but the entity in the database. I don't recall when I did all my bulk converting for Roku's what it did.to prevent this from happening again I have a couple different tricks depending on where it is coming from.

Link to comment
Share on other sites

Thanks @@mediacowboy, when I for example get a better quality file, and replace the existing file in the emby library, that file then appears in the latest media as it is new.  Hence if I was to mass convert all the incorrect formats, I assume the same would happen.  Not ideal but would fix itself over time.  I think the task is just too great for me however - one day, NAS machines will be faster and cheaper, then I can move to one that can handle multiple transcoding and operates as fast as my current PC based system (with the NAS just providing the media).  I suspect I will take the lazy option and wait for NAS hardware to catch up with my requirements - while I test an android TV box I have lying around to see what it does on the back end with each of these files that appear in the error logs for format issues.

Link to comment
Share on other sites

Nologic

@ Vaise -

 

You could use the other scripts further down the thread to pull out the buggy vid's, and then batch process them with VideoGain...it can just swap containers for you...(AVI to MP4 or AVI to MKV)....however the AVI's likely also have MP3 for audio...so should probably just setup VideoGain to re-encode the audio stream. Converting the audio streams doesn't take long...if you have a few thousand files...probably take three days maybe.

 

Not sure what to do about the Emby new item issue...just have to grin and bare it.

 

That said I have a few silly issues that I have to take care of with VideoGain...which ideally I'll have solved this weekend.

Link to comment
Share on other sites

Waldonnis

@ Waldonnis -

 

First off thanks...as for AutoIt...well only if you know it...and don't know how to use better langs (C, C++, C#, VB.Net, ...)...don't get me wrong...it's good for what it is (mainly manipulation of GUI's)...past that it's at least better than Batch scripts...but not as good as Powershell.

 

As for refactoring the script...I'd suggest a simple GUI with a drop down menu box, that the end user can select their model...and a checkbox for if it's connected to a AVR.

 

I'd suggest the drop menu reads from an INI file...something that looks roughly like this:

So the section head is the name of the model...and the key's below describe what is allowed.

 

In the suggested format it's a simple comma separated sets, that are then defined again by pipe symbols...but in the case of multiple options for a set...things are then encased in braces and separated by forward slashes.

 

So "Container" is rather straight forward with the different containers not really having anything else to note.

 

However "Audio" lists a codec & the number of channels supported by that codec for that model...my values are fake...so give no heed to them.

 

Now "Video" things get more complex...in example 1 it lists H264 being supported up to 4k at 60fps...but in example 2 it lists HEVC supporting both 1080p @ 60fps & 4k @ 30fps ...again values are fake. :)

 

I'm not sure if subtitles should be added or not...given I no longer have a Roku to toy with.

 

Anyways I did a template of an INI based off the values listed on this page.

 

I'm not sure it needs to be that complicated.  Most models support the same containers and codecs, with only the 4k models really differing - and even those are mostly the same.  There are some subtle differences with things like reference frame count and other such things that some SoCs can tolerate, but I doubt most of that would too useful in the grand scheme.

 

I agree that AutoIt sucks for this, since it lacks a lot of language features that would make this significantly easier (there are workarounds, but some are a real pain).  I haven't had too much time to look at it lately and not sure if I really have the energy to move the whole idea to another language, but I'll see what shakes out when I get some time.  My main focus would be making it a bit more generic so that it could be easily extended to include browsers or other devices as well.  I have some other ideas, but haven't put much thought into how to implement them so far or how feasible (or useful) they would be.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...