4

I have installed DivX Player (version 6.6) using Wine in my ubuntu 11.10. Is there any way to make it a default player to play certain video formats ?

Thanks in advance.

2
  • Do you mean you want the DivX player to play a file based on its extension, eg. .avi .divx .mkv etc, or do you mean based on the actual encoded video format.. ie by the FOURCC code
    – Peter.O
    Oct 12, 2011 at 18:15
  • I want the DivX player to play a file based on its extension, eg. .avi .divx .mkv etc
    – Vivek
    Oct 12, 2011 at 20:00

2 Answers 2

0

A long post, but the first and last bits, may be enough for you.

You can put a launching command into a script (eg divx-player) and assign that script to launch a particular type via Nautilus - Properties - Open with...

But what is the command? The following explanation is long, but the idea is very simple, once you've "got" it ..(it took me quite a while to "get" it :)

Because you can have multiple wine environments installed (eg, to suit specific settings for a particular program), the system must be told which wine you want to run.. For this, wine relies on an environment variable named $WINEPREFIX.

If you are using wine from its default location, $WINEPREFIX will have a value of $HOME/.wine... Let's assume that your DivX player is installed to this WINEPREFIX (to this environment)...

To be robust, your wine command should explicitly specify the WINEPREFIX, so wine knows which wine environment to run in.

If you don't explicitly specify the WINEPREFIX, wine will use the default value you specified when you installed wine.

Here is the command to specify the WINEPREFIX you want to use.

env WINEPREFIX="$HOME/.wine"  wine    

To cleanly launch an app via a Windows command-line, it is a good idea to use the Windows start.exe command, so the command nees to include this (note the use of thw Windows C:\style\path-name here)..

 env WINEPREFIX="$HOME/.wine"  wine  'C:\windows\command\start.exe'    

Files that reside within the $WINEPREFIX/dosdevices/c:/ directory can be addressed in this Windows style, but files elsewhere on your sysem, need a different approach.
Windows C:\ is mapped to the unix directory `$WINEPREFIX/dosdevices/c:/, and likewise other files on your system can be accessed from within wine via another virtual Windows disk-drive Z:\... but wine provides a simpler method to access your data files (eg, a movie, somewhere/anywhere on your file-system).

These files are, of course, known in the Unix/Linux world by their Unix-style path-names. wine facilitates the translation from unix-style path-names to windows-style path-names via a wine-specific command-line option /Unix

Your DivX player command now needs to be followed by the /path/to/the/DivX-player -options /path/to/the/movie. But because the DivX player is a Windows app, it expects all paths to be in Windows format (ie: C:\Program Files\etc\etc).

As the DivX player.exe is within the WINEPREFX environment you can launch it either via its C:\Windows\path or via /Unix /Unix/path. Using the /Unix option is typically easier and less error-prone, because you don't have to manually flip all the slashes to back-slashes. All four of the following command will run the player, but the first one (/Unix /unix-path/player.exe) is typically the best choice.

# Using Unix-style: Run the .exe directly
/Unix "$WINEPREFIX/dosdevices/c:/Program Files/DivX/DivX.exe"

# Using Unix-style: Run the .exe via its Windows menu shortcut.lnk
/Unix "$WINEPREFIX/dosdevices/c:/users/Public/Start Menu/Programs/DivX/DivX.lnk"

# Using Windows-style: Run the .exe directly
'C:\Program Files\DivX\DivX.exe'

# Using Windows-style: Run the .exe via its Windows menu shortcut.lnk
'C:\users\Public\Start Menu\Programs\DivX\DivX.lnk'

Then you can just tack on the final arg, the movie-path, (in unix-style)... so the full command becomes...

env WINEPREFIX="$HOME/.wine" \
    wine 'C:\windows\command\start.exe' \
    /Unix "$WINEPREFIX/dosdevices/c:/Program Files/DivX/DivX.exe" \
    /Unix "/media/dat_ext4/video/Galaxy Quest.avi"

Nautilus will automatically provide the movie path, so your command for your divx-player bash script needs to cater of an argument, as follows

#!/bin/bash
env WINEPREFIX="$HOME/.wine" \
    wine 'C:\windows\command\start.exe' \
    /Unix "$WINEPREFIX/dosdevices/c:/Program Files/DivX/DivX.exe" \
    /Unix "$1"
0

It is possible, though it is potentially a bit more complicated.

If DivX shows up as an option in the "Open With" list for your files, then you can easily set it as default.

Example properties window

If it does not, then I would suggest not bothering to go through the trouble.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .