User:Tene/Tools

MuseWiki, wiki for the band Muse
Jump to navigation Jump to search

Foreword

We're all noobs at one point in our lives.

Kidding aside, looking particularly in the Muselive "Share Your Stuff" section, there are a lot of misconceptions, misunderstandings and indeed un-understandings when it comes to digital media. This guide aims to, in time, solve these issues. It's not an advanced guide, it's aimed at beginners.

Any suggestions would be very much appreciated.

Essential concepts

Stream

This is the data itself, be it video or audio.

Format/container

The format/container is the box which contains streams. Typical containers include avi, asf, mkv, ogg and mpg. Some audio streams don't use containers, such as raw AC3 or raw AAC. This isn't the norm, however.

Codec

This stands for encode/decode. It is the method in which the streams are stored. Typical codecs include Xvid/DivX for video, and MPEG-II layer III (mp3) and AAC (m4a).

The best video codec out at the moment is x264. Use it plentifully.

Lossless/lossy

This relates to the codec, and is the way in which the codecs work. A lossless codec (FLAC for example) doesn't omit any information when encoding. Lossy formats (such as mp3) throw out some information in order to achieve lower file sizes.

Transcoding/transmuxing

Transcoding is changing the codec. Transmuxing is changing the container.

Unless the source is lossless, transcoding is a no-no. Simply put, it's evil - don't do it. Also, if you're the author of a recording, make sure you keep a lossless copy.

Transmuxing is sometimes advantageous. For example, flv (the Flash video container) is not widely supported. It is also inferior to mkv. Thus, it is advantageous to transmux the streams from within the flv container to mkv. Other containers are generally a no-no for YouTube videos due to their lack of support for vbr video.

Ripping/(extracting|demuxing)

Remember those drug eduction classes? "All medicines are drugs but not all drugs are medicines", well "All extracting is ripping but not all ripping is extracting"

Extracting always refers to demuxing. It's essentially remuxing but with only one stream. For example, if some video/audio files contain some audio you want seperated from the video, then demuxing is for you. See below for details on using FFMPEG for this purpose.

Strictly speaking extracting refers to extracting raw streams, but this terminology is a bit more liberal than that.

Essential software

mp3packer

This serves two purposes. One is to repack mp3 files in a way that is less space-wasteful, with no loss of quality whatsoever. The second is if you have a portable device that can't read vbr files - in which case this'll repack mp3 files so that they're cbr.

Put this in your C:\WINDOWS\system32 folder, and open up the command line, go to the working folder (where the file you want to repack is) with

cd C:\.....\working_folder

and type:

mp3packer -t -s -z file.mp3

It's as simple as that.

ffmpeg/libavcodec

FFMPEG is the God of all transcoding/transmuxing software. ffmpeg.exe belongs in the same folder as mp3packer. The basic usage is as follows:

ffmpeg -i input_file.ext -acodec [audio codec options] -vcodec [video codec options] output_file.ext

For encoding then,

ffmpeg -i input_file.vob -acodec copy -vcodec x264 output_file.ext

And for transmuxing

ffmpeg -i input_file.ext -acodec copy -vcodec copy output_file.ext

And finally for extracting just the audio (very, very handy):

ffmpeg -i input_file.ext -acodec copy -vn output_file.ext

For example, getting this can be used for extracting ac3 from vob (DVD) files, or mp3 from avi files. More in depth details can be found at the ffmpeg website.

7-zip

Simply put, the best archiver out there. Great for extracting, great for packing. For large videos, it's usually a toss up between 7z and bz2. For mp3 files, there's zip. But for even greater zip compression (hard core recording spreaders look no further ...) see below.

KZIP

The best zip compressor there is. It's another command line utility so it belongs in system32 for ease' sake. Basic usage is:

kzip -bxxx archive.zip

The working folder needs to be empty apart from what you're compressing. The default value for -bxxx is 256, you can experiment with different multiples of 32 (128, 160, 192 ...) or just base 2 values, for slightly better results in some cases.

FLAC

The official encoder, that is. Before you upload FLAC files, please run

flac --best file.(flac|wav)

on them. All relatively modern (as in, latter half of the 1990s and newer) can play flac files encoded at the highest compression level. Using this setting, be it on new encodings, re-encodings from previous flac versions or flac compression settings, saves on both disc space and bandwidth. Please do so!

Actually, the best setting to use is:

flac -V -l 32 -b 4096 -m -p -e -r 6 --lax *

Which takes an insanely long time. --best is good enough, unless ye be insane.

Video

From MPEG2

Okay, okay, this assumes you're using a recent version of libx264 and ffmpeg. If not, look up the equivalent switches and syntax using Google. This is for when you want those who care not so much for quality to be able to download video using less bandwidth.

Basically, CRF 25 or CRF 30 is sufficient. The former is more or less perfect. Although you will be able to identify the transcode from the original using a blind test, it will with no comparison look very good. The latter will have more imperfections, most noticeable during low motion scenes when a part of the picture will suddenly move from one position to the other, with the appearance of flickering. Typically, 25 will cut the size in half and 30 into a third.

Anyway, here's the settings I use, the computer is subjected to quite an intense workload, but for single songs of 3-10 minutes, it doesn't take too long (note, for long videos [read: films] this is impractical).

ffmpeg -i IN.mpg/vob -acodec copy -vcodec libx264 -flags +loop -cmp +chroma -partitions all -flags2 dct8x8+wpred+bpyramid+mixed_refs -me_method full -subq 9 -trellis 2 -refs 12 -bf 16 -directpred 3 -b_strategy 2 -bidir_refine 1 -coder ac -me_range 64 -g 250 -keyint_min 25 -sc_threshold 40 -deblockalpha 0 -deblockbeta 0 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -crf 30 -cropbottom 72 -croptop 72 -cropleft 0 -cropright 0 -threads 6 OUT.mkv

Threads should be 1.5n, where n is the number of processors or cores you have. So, for a single processor system two, for a dual processor system three, for a quad 6 and for a - heavens - octa, 12. With six threads, DVD resolution video encodes at six frames per second, which seems to scale almost linearly downwards. Note that b-frame values above 4 or 6 are usually useless, apparently, but since the encoder doesn't use what it doesn't need, specifying 16 should be without harm. As usual, audio should be copied and not transcoded.

You can also use a two-pass vbr process which targets a specific bit-rate rather than constant quality. Two-pass seems to result in better quality (although certain digital video forum members dispute that), but the quality tends to fluctuate from relatively horrendous to excellent. Of course, the whole ~2× processor time doesn't give it much appeal either. ;)

Choice of effective containers for x264 includes Matroska (MKV), MP4, MOV and ASF. I suggest MKV.

I really wish you didn'ts

  • Transcoding between lossy formats.
    With it, you're eroding the history of Muse, or watering it down. Please don't.
  • Only sharing a lossy copy
    • Same principle as above
    • The future holds many more efficient lossy formats. Wouldn't it be a shame to restrict the history of Muse to an archaic, unsupported and forgotten lossy format?
    • Sub woofers. You don't want to take all that inaudible but great for subwoofers information out, do you?
    • You can't hear about 19kHz. I probably couldn't either, maybe 5 years from now. I could hear ~21kHz at 11 years old. Does that make me any less of a priority?

Also...

To people who transcode 64kbps Cook interviews into much larger mp3: don't do it. Waste of bandwidth, inferior quality, bigger filesize. Gods kill kittens for every byte wasted.