I cant play xvid avi with hardware transcoding on, any idea how to fix that?

Server Version#: 1.19.2.2737
Player Version#: Web with chrome

I moved my plex server to a NUC, a J5005.
I had to delete the iHD_drv_video.so from my plex folder so it use the system one, without that hw transcoding was not working, but now it works fine most of the time.

But some of my media are in SD xvid avi. I dont want to reencode them (i have a lot of them, mostly stuff i cant find in HD and i dont want to reencode them and loose quality).

When i try to play them with the hw transcode box checked on my option, it just fail. (and it works fine with HW transcoding OFF)

Someone have an idea how to fix that ?
I read they are simmilars report of the issue, so i guess it will take a while to be fix by devs (a list of file extentions to exclude from hw transcoding would be nice in the options -or better, an option where we can list files with wildcard on witch ignore transcoding-)

Any idea how to make a quick and dirty fix meanwhile ?

lib wrapper or modification of the plex binaries are out of my league, but maybe someone did try ?

Or maybe i cant works something like a script that detect an avi file is acceded and loggin to plex, uncheck the box (plugin ?) for 10 sec so if i relaunch it it will work right away ?

Edit : After some test, it seems to happen only to few avi files. Not all of them.

XviD support is dying. Plex pulls from FFMPEG upstream.

You’ll need to reencode or replace them with H.264.
XviD is H.263 which has been deprecated long ago and is now obsolete.

It’s not deliberately being broken but, as it fails, it won’t be fixed either.

that is just wrong on so many levels :frowning:

there are still many years, if not a decade worth of content in folks storage, that worked one day, and the next won’t.

surely the last good working decoder can be kept as a static alternate path for legacy content, even if it isn’t hw supported.

1 Like

It’s taken me 10 years to rid my world of that AVI crap…
time well spent…

Anyone still downloading it - is insane.

There is ton of contents where the xvid is the only format availiable. I dont see the point to transcode and degrade even more the quality.

2 Likes

Unfortunately, that’s not the point.

ā€œEverythingā€ can’t be supported ā€œForeverā€.

Applying an albeit absurd analogy; should there still be support for video tape?
I’m not trying to insult but am trying to say ā€œlet it die, it’s timeā€.

XviD was all about having small files when people had very limited internet capabilities and storage; where anything was better than nothing. We’ve moved well past that now.

1 Like

Not to mention when I go ā€˜shopping’ and look at the shelves - if it’s food or toilet paper I’m after I get depressed, but when I shop for media there’s always a 264/265/xvid sitting on the shelf side by side and I say - who actually wants that?

If, when downloaded I could turn them into TP - there’s a good use for them.

If those Xvid are indeed in an avi container (and avi is only a container after all) then change that container to .mkv
As XvidDivX files tend to be small then expect it to take between 5 and 10 seconds per file in MKV Toolnix. https://www.bunkus.org/blog/
There’s no quality loss at all.

it’s not AVI (container) that is the problem, its XVID (codec), that is.

1 Like

Yeah i get that. What I was meaning was that despite other comments, avoiding files because they are AVI isn’t always an option. I have at least 2000 (very old) documentary episodes or documovies all originally in an AVI container. Be they DivX or XviD.
Not a single one is still exists as AVI. Not a single one to date had an issue with playback.
Just offering an option for the OP to try.

I have a proposal.

How about I write a shell script.

  1. The shell script will require only two things: mediainfo and ffmpeg.
  2. Given the top of a directory tree to scan
  3. and given the top most directory of where to put the output
  4. Batch convert all the AVI files it finds and puts them in MKV containers as well as converting them to viable H.264 encoding.
  5. Preserves the directory tree under the top most directory
  6. A small bitrate bump would be added to compensate for any encoding loss.

As example:

  1. batch_convert /home/tv /home/new-mkv
  2. would result in:
    a. /home/tv/Kyle XY/Season 01/Kyle XY.S01E02.Sleepless in Seattle.avi
    b. /home/new-mkv/Kyle XY/Season 01/Kyle XY.S01E02.Sleepless in Seattle.mkv

This would facilitate swapping out, en-mass, the old with the new if the entire tree were AVI files.

1 Like

thats very generous Chuck!

if you could also include option for x265 encoding, because sooner or later ffmpeg/plex will deprecate 264 :slight_smile:

Do you want me to vacuum the interior, do the windows, and wax it too ?

:rofl:

J/K

Of course. I’ll make the options editable.

2 Likes

No but you could throw in an option for mp4 to mkv lol.
Just kidding… My avi’s are done and I only have a few mp4’s. :smiley:

When you see the script, it will be trivial to modify it to process MP4 files.

I’m at this point right now. Been on it for about 30 minutes.

## Begin here

if [ "$1" = "--pass2" ]; then

  # Perform recursive work and disposition
  # (--pass2  DestDir PathToConvert )
  OutputFile="$(echo $3 | sed -e 's/.avi$/.mkv/' | sed -e 's/.AVI$/.mkv/')"

  # Make certain destination directory path exists before proceeding
  DestDir="$2/$(dirname "$3")"

  # Make it
  [ ! -d "$DestDir" ] && mkdir -p "$DestDir"

  # Catch errors and exit
  if [ $? -ne 0 ]; then
    echo "ERROR:  Unable to create directory \"$DestDir\".  Processing aborted."
    exit 2
  fi

  # Get bitrate of source file
  Bitrate="$(mediainfo "$3" | grep 'Overall bit rate' | awk -F: '{print $2}' | tr -d ' ' | sed -e 's;kb/s;;' | tail -1)"

  # Bump bitrate per percentage
  NewBitrate=$(( $((Bitrate * $BumpMultiple)) / 100))

  ffmpeg -i "$3" -c:v $VideoCodec -b:v ${NewBitrate}k -c:a copy "$OutputFile"

FFMPEG not yet tested (of course) but the preliminary steps look good so far. Bitrate math is solid

Is bitrate really comparable between xvid and 264?

MPEG3 -> H.264 There will be something. That’s what the fudge factor math is for now. I’m already accounting for the 10% change with H.264. I will need some testing and it can still be tweaked as needed.

this isn’t going to be a ā€˜one size fits all’ script out of the box.

My goal is to write the framework to do batch processing of a directory tree based on a particular extension.

1 Like

Well rencoding avi file could be a solution for some people, but i dont intend to waste space to store degraded quality video file of content that are already not really good.

The solution i’m looking for that i think could realistically be done is renaming the Plex Transcoder program and insert a program that just foward the command line, removing the hw encoding parameters (like -hwaccel:0 vaapi ) according to a set of rules.

I’ve worked with @TeknoJunky,

Here’s a script which will help out those who want to perform the replacement.

It’s written to be very extensible.
Beware: The script is recursive. Modify with care

All script options are in the file itself.

What it currently supports is:

  1. Optional ā€œRecycleBinā€ directory to hold the original (upon successful conversion)

  2. Optional source file deletion if not using a Recycle Bin (upon successful conversion)

  3. Choice of CRF and Nominal Bitrate encoding modes:

  4. Nominal bitrate encoding uses the file’s actual bitrate as the basis

  5. Nominal bitrate encoding allows a percentage compensation to elevate above the bit rate existing in the file.

  6. Ability to add informational [ your conversion info here ] info to the converted file’s name. The bitrate information is available as well as the codec along with other variables for you to use if so desired.

  7. Only the top-level destination directory must exist when starting. The script will create only those subdirectories needed. Those subdirectories will mirror your exact structure.

Testing showed a 10% elevation resulted in no visible loss of quality converting 1035 Kb/s xvid AVI -> H.264 MKV . (That’s some low quality stuff to begin with)

Usage Syntax is simple

/path/to/convert-avi.sh  <Source Path>  <Destination Path>

This type scenario works very well

  1. Edit the script to enable the Recycle Bin and specify a path (e.g /nas/recycle/tv)
  2. Run the script.
cd /nas/tv
convert-avi.sh  /nas/tv  /nas/new-tv

The above searches for all avi and AVI files under /nas/tv and outputs to /nas/new-tv/... mirrored structure here... /filename [ your options if desired ].mkv

Here’s a small sample of what it looks like.

[chuck@lizum ~/kyle.536]$ ./convert-avi  *03 ./output
Season 03/Kyle XY.S03E01.It Happened One Night.avi
Converting: Season 03/Kyle XY.S03E01.It Happened One Night.avi
frame= 1331 fps=331 q=17.0 size=    7739kB time=00:00:55.84 bitrate=1135.2kbits/s speed=13.9x    
[chuck@lizum ~/kyle.537]$ frame= 1412 fps=314 q=-1.0 Lsize=    8964kB time=00:00:59.20 bitrate=1240.2kbits/s speed=13.2x    

[chuck@lizum ~/kyle.537]$ ls -laR output/
output/:
total 0
drwxr-sr-x 3 chuck chuck  23 May  1 21:00 ./
drwsr-sr-x 7 chuck chuck 180 May  1 20:59 ../
drwxr-sr-x 2 chuck chuck  75 May  1 21:00 Season 03/

output/Season 03:
total 8964
drwxr-sr-x 2 chuck chuck      75 May  1 21:00 ./
drwxr-sr-x 3 chuck chuck      23 May  1 21:00 ../
-rw-r--r-- 1 chuck chuck 9178982 May  1 21:00 Kyle XY.S03E01.It Happened One Night [h264 bitrate += 10].mkv
[chuck@lizum ~/kyle.538]$

Again, you can customize this to your heart’s desire. My goal was to create the framework.

convert-avi.tar.gz (2.1 KB)

2 Likes