r3dux.org

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

You Suck at Photoshop: Paths and Masks

r3dux | March 6, 2010
YouTube Preview Image

Lol – Stupid strapped on all the way…

Comments
No Comments »
Categories
How-To, Humour
Tags
Masks, Paths, Photoshop, Shame
Comments rss Comments rss
Trackback Trackback

ActionScript 3.0: An Introduction to ActionScript 3.0 in Flash CS4 – Week 2

r3dux | March 1, 2010

Before we can start working on games and all the fun stuff, it’s imperative that we’ve got solid fundamentals. Here in Week 2 of CUFDIG302A – Author Interactive Sequences we’re looking at conditional branching (i.e. if/and/or/not statements), flow control (i.e loops) and generating random numbers.

If you’ve not gone through the Week 1 slides, and you’re new to coding, then take a step back to and take it order – it’ll really help. Otherwise enjoy the notes!

ActionScript 3.0 Slides Week 2 - CUFDIG302A

The download link to the slides along with some legal gubbins regarding their use is after the jump, so if you fancy learning ActionScript – you’ll find the knowledge to start from near to absolute basics right here, and pretty soon we’ll be onto Symbols, Classes, Events, Object Orientation, Interaction, Sound, Collision Detection and all that other good stuff. We’ll even make a couple of flash games – which should be quite fun :)

Read the rest of this entry »

Comments
No Comments »
Categories
Coding, How-To
Tags
ActionScript, Branching, CS4, CUFDIG302A, Flash, Loops, Slides
Comments rss Comments rss
Trackback Trackback

Adobe Flash CS4 & Drawing Tools Primer

r3dux | February 26, 2010

As I’m teaching the programming section of Certificate III in Media, CUFDIG302A – Author Interactive Sequences, I’m going to post up my slides as I go along so anyone who wants them can learn ActionScript 3.0 – but as well as just the coding side of things, it’s useful to get an overview of what Flash is, what it isn’t, and what a couple of the most commonly used tools do. So here’s a Flash CS4 & Drawing primer…

Flash CS4 & Drawing Tools Primer

There’s a download link to the slides along with some legal gubbins regarding their use after the jump, so if you’re new to Flash and want a quick introduction, you’ll find the knowledge to start from absolute basics, learn the difference between raster and vector artwork, working with layers and drawing and grouping objects right here. This is just a quick primer, and is meant to tie in with the ActionScript slide series, where pretty soon we’ll be drawing things and then instantiating and manipulating them through our ActionScript code.

Read the rest of this entry »

Comments
No Comments »
Categories
How-To
Tags
Adobe, CS4, CUFDIG302A, Flash, Primer, Slides
Comments rss Comments rss
Trackback Trackback

How To: Use Selections to Combine Two Images in Photoshop CS4

r3dux | February 24, 2010

One of the classes I’m teaching this year is (PDF link) CUFMEM07A – Apply Principles of Visual Design, and although a lot of it isn’t going to be of much use to people who don’t dig on design principles and elements, some well-explained Photoshop articles mightn’t hurt anyone who stumbles across the site, so I’ll make with the posting…

In this exercise, we’re starting from the beginning and creating selections from one image to combine with another, and we look at some feathering of selections to get rid of hard edges between contrasting visual elements. What you end up creating is shown below:

Combining Two Images in Photoshop CS4

Very simple, very quick – useful if your Photoshop skills are a bit rusty, or if you’re just starting out.

You can find the document (in MS Word 2K3 format, so viewable in Open Office and MS Office 2K3 & 2K7) which steps through the process, with lovely, lovely screengrabs and the like here.


If you don’t have a copy of Photoshop CS4, you can get a free 30 day trial from the Adobe website, or, you can do the same things in a free open-source program called the GIMP (GNU Image Manipulation Program). The GIMP can do most of the same things Photoshop can do, but the user interface is rather different, to get around this, there are versions of the GIMP which have been modified so that their user interface more closely matches that of Photoshop, and these are GIMPhoto and GIMPShop.

Comments
No Comments »
Categories
How-To, Imagery
Tags
Adobe, CS4, CUFMEM07A, Photoshop, Selection
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: No. Specify the maximum data rate for our video. Note the colon.
vbitrate=4900: No. The average bitrate for our variable bitrate for the video. Note the colon.
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 harddp video filter is used to keep the audio and video in sync when changing frame rates. Note the comas!
-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
4 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

« Previous Entries

Translate

Categories

Archives

  • 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

August 2009
M T W T F S S
« Jul   Sep »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Tags

360 ActionScript ActionScript 3.0 Adobe Ballarat Bash Compiz CompizFusion controller Correct Technique CS4 CUFDIG302A Effect Fail Flash Gaming Hack How-To install Jaunty Josh Joplin Group Linkage Linux Little Big Planet Mirrors Edge Motion mount Music NAS Particle Photoshop Problem r3dux.org Remix Slides Softmod Sound Speakers 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

“Obstacles cannot crush me. Every obstacle yields to stern resolve. He who is fixed to a star does not change his mind.”

 - Leonardo da Vinci

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