WIP tutorial for getting the AMVApp working with WINE on OSX

For discussion on Mac software and video editing on Mac computers.
Locked
User avatar
LantisEscudo
Joined: Thu Mar 08, 2001 5:21 pm
Location: Eastern Massachusetts
Contact:
Org Profile

WIP tutorial for getting the AMVApp working with WINE on OSX

Post by LantisEscudo » Fri Apr 29, 2011 8:40 pm

This is a work in progress, so anyone that has recommendations/corrections is welcome to post them.

Prerequisites:
An Intel-based system running OS X 10.4+ (10.5 or 10.6 strongly recommended)
An administrator account on that system (if you're the only account on it, you're the admin)
Apple's Xcode Developer Tools (requires free registration with the Apple Developers' Center) 3 or higher
MacPorts installed
Perian installed
The AMVApp unzipped in a folder called AMVApp31 in your Downloads folder
* If you're familiar with command-line applications and file/folder structure, you can unzip it somewhere else and modify the command lines here, otherwise, stick to the paths I'm using here

Extra prerequisite for 10.4 users:
X11 must be installed (it comes on your system install disk)

Step 1: Install WINE
* Start Terminal.app (Applications -> Utilities -> Terminal or Terminal.app)

* Enter the following line and press Enter. You will be prompted for your password; as you enter it, nothing will show up (not even *'s), but it will take it as soon as you hit Enter; it's a security feature. You will also be asked if you want to install other packages (which are required for WINE to run). Just hit Enter to accept the default value of Yes.

Code: Select all

sudo port install wine
* Wait until you see the prompt ending in $ again. It'll be a while, since there's a lot to build and install behind the scenes.

Step 2: Install AMVApp Components

* Only some of the AMVApp components work under WINE. Notably, AvsPmod and ZarxGUI do not (both rely on libraries that are not fully implemented in WINE yet; soon, hopefully). So we'll only be installing the parts that do work.

* Enter the following series of lines, pressing enter after each one. Each will start the standard Windows installer for that component. Accept all the default settings, and enter the next line after the installer closes.

Code: Select all

wine ~/Downloads/AMVApp31/Avisynth_258.exe
wine ~/Downloads/AMVApp31/AVSPluginPack.exe
wine ~/Downloads/AMVApp31/DGMPGDec158.exe 
wine ~/Downloads/AMVApp31/VirtualDub_1910.exe
wine ~/Downloads/AMVApp31/HuffyuvSetup.exe
* This installs AviSynth, the AVS Plugin Pack, the HuffYUV codec, DGMPEGDec, and VirtualDub. You can also add the XviD codec and LAME ACM codec if you want, but they're not really needed.

Step 3: Creating Startable .apps to run DGIndex and VirtualDub

* Start the Applescript Editor (Applications -> Utilities -> Applescript Editor.app for 10.6, Applications -> AppleScript -> Script Editor.app for 10.4 and 10.5). Paste the following block of code in the editing window, then save it in a convenient place for you (like your Documents or Applications folder). Make sure in the save box, you select "Application" as the file type. This will create a .app file that when you double-click it, will start DGIndex (it can take a few seconds to show up after you start it, be patient).

Code: Select all

on run
        --edit this to be the correct location and file to run (typically only edit after the "drive_c")
        set toRun to "$WINEPREFIX/drive_c/Program Files/DGMPGDec/DGIndex.exe"
        --edit winePrefix if you are not using the default prefix
        set winePrefix to "$HOME/.wine"
        --edit wineLocation if your wine install is not the default location
        set wineLocation to "/opt/local/bin"
        --edit dyldFallbackLibraryPath if your using X11.app that is not the default Apple one
        set dyldFallbackLibraryPath to "/usr/X11/lib"
        -------------------------------------------------------
        --DO NOT EDIT ANYTHING BELOW THIS LINE
        -------------------------------------------------------
        set toRunPath to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; echo \"${TEMPVAR%/*}\""
        set toRunFile to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; TEMPVAR2=\"" & toRunPath & "\"; echo \"${TEMPVAR#$TEMPVAR2/}\""
        do shell script "PATH=\"" & wineLocation & ":$PATH\";
export WINEPREFIX=\"" & winePrefix & "\";
export DYLD_FALLBACK_LIBRARY_PATH=\"" & dyldFallbackLibraryPath & "\";
cd \"" & toRunPath & "\";
wine \"" & toRunFile & "\" > /dev/null 2>&1 &"
end run
* Now do the same thing with this block of code, which will start VirtualDub:

Code: Select all

on run
        --edit this to be the correct location and file to run (typically only edit after the "drive_c")
        set toRun to "$WINEPREFIX/drive_c/Program Files/VirtualDub/VirtualDub.exe"
        --edit winePrefix if you are not using the default prefix
        set winePrefix to "$HOME/.wine"
        --edit wineLocation if your wine install is not the default location
        set wineLocation to "/opt/local/bin"
        --edit dyldFallbackLibraryPath if your using X11.app that is not the default Apple one
        set dyldFallbackLibraryPath to "/usr/X11/lib"
        -------------------------------------------------------
        --DO NOT EDIT ANYTHING BELOW THIS LINE
        -------------------------------------------------------
        set toRunPath to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; echo \"${TEMPVAR%/*}\""
        set toRunFile to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; TEMPVAR2=\"" & toRunPath & "\"; echo \"${TEMPVAR#$TEMPVAR2/}\""
        do shell script "PATH=\"" & wineLocation & ":$PATH\";
export WINEPREFIX=\"" & winePrefix & "\";
export DYLD_FALLBACK_LIBRARY_PATH=\"" & dyldFallbackLibraryPath & "\";
cd \"" & toRunPath & "\";
wine \"" & toRunFile & "\" > /dev/null 2>&1 &"
end run
Step 4: Work with it
* You now can take decrypted VOBs (I haven't tested DVD rippers on my Mac yet; I've been testing with things I decrypted on Windows) and load them into DGIndex, and save the .d2v and .avs files wherever you like.

* The .avs can be edited in any text editor you like (including TextEdit) to include whatever filters you have installed, and the resulting .avs can be opened in VirtualDub to create either Uncompressed or HuffYUV-encoded AVI files that you can use in FCE, FCP, and Premiere Pro on Mac. Check out the Read <a href=http://www.a-m-v.org/guides/avtech31/>ErMaC & AbsoluteDestiny's Friendly AMV Guides</a> for more details.

Future Work: Export/Final Encodes
* Right now, since the ZarxGUI doesn't work under WINE, there's not a quick one-stop-shop encoder that I'm aware of for distribution encodes (which is partially why this is a WIP tutorial, not a full one). Any suggestions for my testing would be welcome.

User avatar
advent87
Joined: Thu Mar 12, 2009 12:10 pm
Status: Inspired
Location: USA
Org Profile

Re: WIP tutorial for getting the AMVApp working with WINE on

Post by advent87 » Fri Apr 29, 2011 9:35 pm

Try MPEG StreamClip. I have used it for most of my final encoding for videos in the past and it works well for me. And I believe you can run it separate from WINE as a part of OSX. Worth giving a look at in my opinion

User avatar
Monitor Zombie
Joined: Sun May 01, 2005 9:39 pm
Status: Meh.
Location: Boston-ish
Org Profile

Re: WIP tutorial for getting the AMVApp working with WINE on

Post by Monitor Zombie » Sun May 01, 2011 3:57 pm

I use MPeg Streamclip as well...
Image

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: WIP tutorial for getting the AMVApp working with WINE on

Post by Qyot27 » Tue May 03, 2011 7:46 pm

The Xcode suite is also on the install discs, so it's not necessarily required to have an ADC account.
LantisEscudo wrote:Future Work: Export/Final Encodes
* Right now, since the ZarxGUI doesn't work under WINE, there's not a quick one-stop-shop encoder that I'm aware of for distribution encodes (which is partially why this is a WIP tutorial, not a full one). Any suggestions for my testing would be welcome.
Depends on how far one is willing to go. x264 can be a 'quick one-stop-shop encoder' if it uses the L-SMASH branch (which includes support from the x264-audio branch), so if one constructs a usable command-line, then there you go; Zarx264GUI does supply an L-SMASH-using build of x264, and - for those with access to it on Windows - can give you the command line it's using for a particular configuration of settings. So just a little copy-and-paste and using the x264.exe that it came with (remembering to first copy x264.exe to .wine/drive_c/Windows or use Wine's version of Regedit to add the directory containing x264 to Wine's PATH).

In my experience (from tests done about 2½ years ago), x264 actually works better under Wine than it does on a native Windows setup, so this is sort of a non-issue. Alternately, one could use a build of ffmpeg that's been compiled with libx264 support.


The more intensive way is to compile ffmpeg, ffms2, and x264 as native OSX applications, forgoing the use of Wine entirely. The existing guide is most of the way there, since Xcode and MacPorts are already installed. Just a few more dependencies from MacPorts and some simple build steps, and voila. Heck, it could be condensed into a bash script and automated with a single file - although the user would still need to use the Terminal to do any encoding, and be a bit more intuitive if something in the build script/process breaks. This step is more necessary for Mac users (and Linux users*) because these tools often don't have people building it frequently like on Windows, making it relevant to know how to do it yourself.

*namely because it's largely assumed that Linux users typically already know how to do this, and therefore frequent updates are left to the individual most times; Mac users, not so much. The good thing is that the similarity between OSX and Linux, owing to both being Unix-like systems, means that the compiling instructions are more or less identical (as they would also be on Windows if using Cygwin or MSys).

If I remember correctly, the extra stuff needed from MacPorts are as follows: yasm, subversion, git-core, automake, autoconf, libtool, pkg-config, zlib, and bzip2 (zlib and bzip2 would be the packages providing the headers and libs necessary for static compiling, if they're separate from the main package). I'm not sure if the autotools and pkg-config come standard with Xcode, though.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

User avatar
Kanti13
Joined: Sat May 31, 2008 12:52 am
Location: コンピューター のほえに
Contact:
Org Profile

Re: WIP tutorial for getting the AMVApp working with WINE on

Post by Kanti13 » Fri Sep 23, 2011 10:58 pm

Qyot27 wrote:for those with access to it on Windows - can give you the command line it's using for a particular configuration of settings.
Using a .wav file for the audio and an .avs for the video
Default Settings recommended in the guide.

Image

Command Line:

Code: Select all

BePipe.exe --script "WAVSource(^C:\YourFilePath\YourAudio.wav^).Normalize()" | neroAacEnc.exe -q 0.4 -ignorelength -if - -of "C:\YourFilePath\YourFile-temp.m4a"
x264.exe --crf 20 --preset veryslow --tune animation --fps 30000/1001 --audiofile "C:\YourFilePath\YourFile.m4a" --acodec copy --output "C:\YourFilePath\YourFile.mp4" "C:\YourFilePath\YourFile.avs"

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: WIP tutorial for getting the AMVApp working with WINE on

Post by Qyot27 » Sat Sep 24, 2011 1:26 am

A) You either need to install Wine via the MacPorts method or
B) Compile FFmpeg, FFMS2, and x264 yourself using Apple's Xcode suite (available through the App Store) and some other tools grabbed from MacPorts.

A is just going to use the Windows versions of these programs and may be more complicated in terms of making sure everything is kosher. Namely because ffdshow-tryouts is a terror to try and configure under Wine. Or at least it was, last time I had to do it. You could feasibly skip ffdshow entirely but you'd lose out on using AviSynth. If all you want to do is take your final output and encode it, though, you can grab one of JEEB's builds (which, if I'm not mistaken, are the ones Zarx264gui also uses) and go right ahead. As long as you use HuffYUV or FFV1 as your output format, x264's internal FFMS2 or LAVF decoders will handle it. Ostensibly you could also use ProRes, but its decoder was just committed within the last 48 hours and I don't know how complete/stable it is.

B is a native Mac solution, and entirely self-contained (like the x264 builds for Windows I just linked to), but requires you to become familiar with the Terminal in a way that may be more complicated than the Terminal usage that A needs. Unless of course you can find current OSX builds done by somebody else. Then this method gets infinitely easier.

Whether A or B is used, the actual usage of x264 is the same, and needs very little adapting. The biggest difference is that A can use AviSynth directly (and needs to have 'wine' at the beginning of the command), B can't - although it is possible to have AviSynth set up in Wine, like method A would allow, and then use avs2yuv to pipe the data out of Wine and give it to a native OSX build of x264, which method B would enable you to use.





As fate would have it, the only Mac I have access to that's suitable for testing any advice I might give about this is busted, so while I can give the instructions and troubleshoot I can't directly test it on my own time.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

Locked

Return to “Mac Software”