r3dux.org

A number-pimping side project from the valleys in *NEW* upside-down flavour.
  • rss
  • Home
  • About
  • Email

How To: Convert .WBFS Image Files to .ISO Images

r3dux | April 17, 2010

Update: You can convert compressed ISO images (.ciso files) using this method, too…

If you need to translate a Wii DVD image from the newer .WBFS format (which has lovely sparce-file support) to an old-school .ISO image, well you can jolly well do so with Wii Backup Manager! Now, WBM is a really useful program so congrats to the author (xzxero) – but it uses non-standard GUI elements in that it uses what looks like the category list as a second main-menu, and this makes it a little non-intuitive to use. But in fairness to the author, the download page has a tutorial (which I didn’t find until after completing this post!). Still, it’s easy enough once you’ve figured that out. The entire conversion process goes like this:

1.) Grab yourself a copy of Wii Backup Manager. Version v0.3.5 beta 1 is the most recent version available at the time of writing, and although it’s Win32 only, it works fine in VirtualBox…

2.) Extract and launch it

Wii Backup Manager

3.) From the Files tab, click on what looks like the Add category title, select Files and go pick a .WBFS image from the navigation dialogue box

Wii Backup Manager - Add Files

4.) Still in the Files tab, tick the checkbox to the left of your .wbfs image, and then click on what looks like the Transfer category title and select ISO..

Wii Backup Manager - Transfer Files

5.) Pick where you want the converted .ISO file to be created and click the [OK] button

Wii Backup Manager - Place ISO

That’s it – job done! Transfer your ISO to your WBFS formatted USB drive and launch it as you normally would via USBLoaderGX or whatever your poison is… :)

Comments
4 Comments »
Categories
Gaming, How-To
Tags
Conversion, Convert, Image, ISO, WBFS, Wii

Comments rss Comments rss
Trackback Trackback

How To: Transcode AVI Videos to Video DVDs in Linux

r3dux | February 22, 2010

It’s easy enough to rip DVDs to .AVIs or .MKVs – you can just use nice, GUI-enabled tools like HandBrake. But what about when you want to transfer an AVI back to DVD format so it can be played on a standalone DVD player? Well, the Shetboy sent me his command-line technique a while back (which we can automate to some extent) – and I’ve got to say it works flawlessly.

1.) Get the Right Tools for the Job

If you’ve ever had a look at a video DVD on your PC, you’ll notice is has a bunch of .VOB files broken up into roughly 1GB sections which contain the pieces of your movie (if it’s a DVD of TV episodes you’re more likely to have a greater number of VOBs split up into one per episode on the disc). To deal with all the transcoding we’re going to do, we need the right tools. Some of these you’re likely to already have, others maybe not.

Package pre-requisites for transcoding:
mencoder, mplayer, libxvidcore, libxvidcore4, xvid4conf, xvidtune, ffmpeg, libavcodec0d, libmpeg*, w32codecs, transcode, mjpegtools, dvdauthor

You can install them all via the following command (where any you already have will just be skipped):

sudo apt-get install mencoder mplayer libxvidcore libxvidcore4 xvid4conf xvidtune ffmpeg libavcodec0d  w32codecs transcode mjpegtools dvdauthor libmpeg*

2.) Find Out Your .AVI’s Crop Area

To do a nice transcode, best results are gained by not transcoding any black bars in the avi. This step also helps in getting a perfect re-size every time without messing up the aspect ratio.

To do this run:

mplayer -vf cropdetect <file.avi>

An mplayer window will open and the avi will play. Press the right arrow about 10 times and leave it running for a few seconds. The reason for this is that different resolutions can sometimes be used for the intro to TV shows, or company logos and things, and we want the main feature being played. After it has been showing the body of the show for a few seconds kill the mplayer window.

Output from the above command will be shown in your console window, and should look something like this:


mplayer -vf cropdetect Star.Wars.The.Clone.Wars.S01E01.HDTV.XviD-0TV.avi
MPlayer 2:0.99+1.0pre8-0ubuntu8.3 (C) 2000-2006 MPlayer Team

— A whole bunch of other stuff we don’t care about here —

Opening video filter: [cropdetect]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg’s libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
alsa-init: using device default
alsa: 48000 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little Endian
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback…
VDec: vo config request – 624 x 352 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.77:1 – prescaling to correct movie aspect.
VO: [xv] 624×352 => 624×352 Planar YV12
[CROP] Crop area: X: 623..0 Y: 351..0 (-vf crop=-608:-336:618:346).
[CROP] Crop area: X: 623..0 Y: 351..0 (-vf crop=-608:-336:618:346). *** This is the crop-area of the pre-show company logos etc. – don’t use it! ***
[CROP] Crop area: X: 623..0 Y: 351..0 (-vf crop=-608:-336:618:346).
…
[CROP] Crop area: X: 0..623 Y: 0..351 (-vf crop=624:352:0:0).7 0
[CROP] Crop area: X: 0..623 Y: 0..351 (-vf crop=624:352:0:0).7 0
[CROP] Crop area: X: 0..623 Y: 0..351 (-vf crop=624:352:0:0).7 0 *** This is the crop-area of the main presentation which we’re going to use! ***
[CROP] Crop area: X: 0..623 Y: 0..351 (-vf crop=624:352:0:0).7 0
[CROP] Crop area: X: 0..623 Y: 0..351 (-vf crop=624:352:0:0).7 0
…


The last bunch of lines showing the crop area for the main presentation are what’s important here. We’ll use this info shortly.

3.) Transcode the Video File

We’ll be doing the transcoding using mencoder, which takes an un-holy number of parameters to do a great job.

An example of a command in the proper format is …

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -srate 48000 -ofps 25 \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:keyint=15:vrc_maxrate=9800:vbitrate=4900:aspect=16/9:acodec=ac3:abitrate=192 \
-af lavcresample=48000 \
-vf crop=624:352:0:0,scale=720:576,expand=720:576,harddup \
-o ~/transcoded/ep01.mpg \ 
Star.Wars.The.Clone.Wars.S01E01.HDTV.XviD-0TV.avi

To figure out what’s going on so you can tweak the numbers appropriately, I’ve separated out the switches into a table to best explain how it works:

Unholy Amount of Command Line Switches and Parameters Needed To Transcode .AVIs to DVDs
Switch Should I Tweak It? Explanation
mencoder Haha, No. Fire up mencoder to do our bidding
-oac lavc No. Output audio using libavcodec’s audio codecs
-ovc lavc No. Output video using libavcodec’s video codecs
-of mpeg No. Output our file in MPEG format – expect large file sizes!
-mpegopts No. Tell mencoder that from now on all switches are to control the MPEG output
format=dvd:tsaf No. Create our output with timestamps on every frame to keep everything in sync.
Note that we don’t put a dash before this option because it’s the first option after specifying -mpegopts
-srate 48000 No. Output our MPEG audio at 48Khz so it’s as high quality as we can make it
-ofps 25 Up to you. Output our MPEG video at 25fps for a PAL DVD. Change this to 23.97fps for a NTSC DVD.
-lavcopts No. Start our section where we specify libavcodec’s options
vcodec=mpeg2video No. Specify we want to create MPEG2 video. Note the lack of a prefix dash and the colon on the end to specify all further options will be specifying the details of our MPEG2 video output
vrc_buf_size=1835: No. Specify our buffer size. Note the colon at the end which is necessary to combine multiple parameters to our -lavcopts switch.
keyint=15: No. Specify our keyframe interval as 15 i.e. One frame in every 15 will be a keyframe which is encoded at high quality. Note the colon.
vrc_maxrate=9800: Yes. Specify the maximum data rate for our video. Note the colon.

It’s best to use a bitrate calculator to get this value as outlined in the row below on vbitrate…

vbitrate=4900: Yes The average bitrate for our variable bitrate for the video. Note the colon.

If you’re planning to burn the video you’re transcoding to a DVD (i.e. a standard, single-layer DVD5) then it’s worthwhile using a bitrate calculator to get the best number to plug in here. The bitrate calculator will just ask you for the length of the video, the audio bitrate (as specified below), and it’ll give you values to plug in for the average and maximum (see above) video bit-rates.

aspect=16/9: Up to you. The aspect ratio of our output video. Options are 16/9 for widescreen and 4/3 for old-school anamorphic. Note the colon.
acodec=ac3: No. Set the audio codec to use to AC3 (also known as Dolby Digital). Note the colon.
abitrate=192 No. Set our auto bitrate to 192 kbit/sec. Note – No colon this time as we’re at the end of our -lavcopts section! Finally!
-af lavcresample=48000 No. Resample our audio to 48Khz for maximum quality
-vf crop=624:352:0:0, Yes! Set our crop ratio to be what we retrieved from our mplayer -vf cropdetect command [eg. 624:352:0:0]. Note the comma.
scale=720:576, Yes! Set our scaling: x-scale (horizontal) is set to 720 pixels, and the y-scale (vertical is set to 576 pixels. 720×576 is the resolution of a PAL DVD, pick.

This is the important part: We set the x-scale to be the full width of our screen, and then we use the following formula to generate what our y-scale should be: yscale = (y-resolution * aspect ratio * y-crop-area) / x-crop-area [So for this example it's (576 * (16/9) * 352) / 624 = 578 ==> If more than 576, set it to 576! Or if it's more than 480 set it to 480 for a NTSC DVD]. Note the comma!

expand=720:576,harddup Up to you. Set our video expansion to be the resolution we finally want to use: For PAL it’s 720:576, for NTSC you’ll want to use 720:480. This might be the same as the scale details above, but they don’t have to be. The harddup video filter is used to keep the audio and video in sync when changing frame rates. Note the comma between the expanded resolution and calling the harddup filter!
-frames 7500 Use only to test. OPTIONAL: Only encode first 5 minutes to test. 7500 = 60 seconds per minute * 5 minutes * 25 frames per second.
-o <output-MPEG-filename.mpg> Yes. Your MPEG output path and filename, in this example I’m using: ~/transcoded/ep01.mpg
<input-file-name> Yes. The avi we’re using for input, in this example I’m using: ./Star.Wars.The.Clone.Wars.S01E01.HDTV.XviD-0TV.avi

So, even though it looks like a bit of a nightmare, you only need to change a few things in the entire command:

1.) Choose your output fps by setting -ofps 25 for PAL or -ofps 23.95 for NTSC.
2.) Set whether we want to output in widescreen 16/9 or old-school 4/3 by setting -aspect=16/9 or -aspect=4/3
3.) Feed in the result of running our mplayer cropdetect so we end up with something like -vf crop 624:352:0:0,
4.) Feed in the result of running our scale calculation so we end up with something like scale=720:576,
5.) Give it an input source AVI and an output file to dump the transcoded MPEG to
6.) Optionally, only transcode a couple of minutes to make sure it’s all running alright. Once you’re happy with the transcode take out the -frames line and it’ll transcode the whole video file for you.

If you really want to dig into the switches more, you could always take a look at this page which shows how to use mencoder in significantly more detail.

4.) Generate the DVD

Now we’ve done the hard part and we’ve got a big ‘ol .mpg file of our avi, it’s time to generate the DVD structure. If you’re putting multiple mpegs to a DVD, keep the file limit to about 4.2GB otherwise it won’t fit on a single-sided DVD5. If you’ve got a DVD9 writer you might be alright up to about 8GB, but I don’t have one so I haven’t tested this.

Word of Warning: When you’re generating large MPEG files for DVDs do NOT work on a FAT32 file system – FAT32 has a 4GB file limit, and if you end up with a 4GB+ file, things are going to fail.

You need to run two commands to generate a DVD:

dvdauthor -t -o newfolder file1.mpg [file2.mpg] [file3.mpg] ...
dvdauthor -o newfolder -T

The first command instructs dvdauthor to make a title out of each file (think chapter so we can skip through them easily), and can take a while to run. The second command generates our table of contents and completes near instantly. Read more via the mighty man dvdauthor if you’re that way inclined…

So, an example of the command usage, assuming I’d created the dvdprep folder in my home folder, might be:

dvdauthor -o ~/dvdprep/starwars1 ~/transcoded/ep01.mpg ~/transcoded/ep02.mpg ~/transcoded/ep03.mpg ~/transcoded/ep04.mpg
dvdauthor -o ~/dvdprep/starwars1 -T

Important: In the above example ~/dvdprep MUST exist but the directory starwars1 MUST NOT!

With this done, the start of each new file can be jumped to within the DVD by hitting chapter next or previous on your DVD software or player. Before burning to disc you should check that it works ok by checking with a video player like VLC and select ‘Play DVD from Directory’ or similar.

5.) Burn the DVD!

That’s it! We’re done! Burn the DVD directory (i.e. the contents of ~/dvdprop/starwars1 now containing the AUDIO_TS and VIDEO_TS folders in his example) using Brasero, K3b or your burning software o’ choice. Whatever you use, make sure you burn the disc as a New Video DVD though!!

Happy transcoding!


An extra-special shout-out to the Shetboy for sending me this how-to ages back – apols. for not getting around to posting it sooner! I just knew it’d be a bugger to nail perfectly (i.e. unholy table of doom!) so I was kind putting it off =P

Comments
3 Comments »
Categories
How-To, Linux
Tags
AVI, Convert, DVD, dvdauthor, mencoder, That's a lot of switches..., Transcode, Video

Comments rss Comments rss
Trackback Trackback

How To: Convert a Directory of MP3s to WAVs in Linux

r3dux | November 10, 2009

I went to burn a couple of audio CDs for the boy today, and bod-frickn-dammit if Brasero / GnomeBaker and K3B didn’t all threw their hands in the air in dismay that I might actually have the nerve to want to convert mp3s to CD-audio on the fly. Very poor.

So, as wav files come in less flavours than mp3s and tend to work first time, I knocked up a quick script to convert a directory of mp3s to .wav files using mpg123, it even handles spaces correctly after I’d given it a stern talking to… Anyways:

#/bin/bash
gotmpg123=$(which mpg123)
 
# If there's no copy of mpg123 we're not going to be doing any converting. Abort!
if [ "$gotmpg123" = "" ]; then
    echo "No copy of mpg123 found on system! Try running: sudo apt-get install mpg123"
    exit 0
fi
 
# Otherwise, if we're all set, make a directory to dump our wav files into
mkdir WAV
 
# For each file in the current directory that ends with .mp3, convert it to .wav and place in our new WAV folder
for file in ./*.mp3
do
  mpg123 -w ./WAV/"${file}".wav "$file"
done

To use the script:
- Copy and paste the above code into a new text file called mp32wav or something
- Make it executable with chmod +x mp32wav, then
- Copy it to /usr/bin for easy access with sudo cp mp32wav /usr/bin/

With that all done you can just go into a folder of mp3s in the terminal and fire it off. It’ll create a folder called WAV inside whatever directory you’re in and stick the converted wav files there with the original filename but with .wav tacked on the end.

Cheers!

Comments
1 Comment »
Categories
How-To, Linux, Music
Tags
Bash, Convert, Linux, mp3, mp32wav, mpg123, script, wav

Comments rss Comments rss
Trackback Trackback

Translate

Categories

Archives

  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009

Post Calendar

July 2010
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728293031  

Tags

10.04 360 ActionScript ActionScript 3.0 Adobe Ballarat Bash Compiz Controller CS4 CUFDIG302A Effect Film Fire Flash Gaming Hack How-To install Jaunty Josh Joplin Group Linkage Linux Little Big Planet Motion mount Music NAS Particle photography Photoshop Problem PS3 r3dux.org Retro Slides Softmod Sound Systems Ubuntu Video VirtualBox Wii Windows XBox

Linkage

  • 9GAG
  • A Day in the Life of Jim
  • Truxnor.net

Gamercard

Prepare for Awesome

Misc.

Creative Commons License

stopsoftwarepatents.eu petition banner

“They that would give up essential liberties to obtain a little temporary safety deserves neither liberty nor safety.”

 - Benjamin Franklin

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox