Inhaltsverzeichnis

Multimedia Tools

Infos about howto play, edit and stream audio and video

Internet Radio

Play internet radio streams on the command line

Use soma or mplayer

Record internet radio streams to a file

Just use curl. The resulting file is playable with common players like mplayer, xine or vlc

Audo and video editing tools

ffmpeg

Install

To install on Slack, download from slackbuilds and build it as root using su -, not only su. Otherwise the build will fail because it can't find texi2html.

Recommended optional packages for ffmpeg:

ffmpeg
  libass
  faac
    libmp4v2
  lame
  x264
  [x265]

Command to build the package with the optional packages enabled:

ASS=yes FAAC=yes LAME=yes X264=yes ./ffmpeg.SlackBuild

FIXME FAAC seems not necessary any morge as of ffmpeg-3.2.4. Instead try FDK_AAC

Note: To install ffmpeg on a headless server (without X) it may be necessary to install additional stock packages first and to disable some features which are enabled by default (tested):

slackpkg install libXi libXtst
CACA=no OPENGL=no X11GRAB=no ASS=yes FAAC=yes LAME=yes X264=yes ./ffmpeg.SlackBuild

Docs

  1. man ffmpeg

Note that these official docs do not contain hints about DVD ripping.

mencoder

Overview

  1. mencoder uses ffmpeg
  2. ffmpeg provides and uses libavcodec
  3. ffmpeg seems to come from mplayer. The ffmpeg slack package points to http://ffmpeg.mplayerhq.hu
  4. libavcodec does not contain x264, it is a standalone lib
  5. mencoder (as well as handbrake) recommends to use x264 as video encoder
  6. mencoder (as well as ffmpeg) probably need to be recompiled after x264 is installed. mencoder -ovc help should list x264 after recompile
  7. mencoder provides extensive doc about howto rip a DVD. Nothing similar found for ffmpeg yet.
  8. A search for ffmpeg vs mencoder on the web shows that most people recommend mencoder, because it can do more

Install

Onboard of Slack. FIXME Probably needs to be recompiled in order to support x264

Docs

  1. man menconder

Audo and video editing by task

Get info about a media file

ffprobe

Extract a section from an audio/video file

This cuts out 61 seconds of all.mp3, starting at 41 min 8 sec from the beginning and writes the section to the file part.mp3. Note that no mp3 encoder is necessary and there is no quality loss.

ffmpeg -ss 41:08 -i all.mp3 -codec copy -t 61 part.mp3 

If you want to extract from the start just omit -ss If you want to extract until the end just omit -t :?:

Concat multiple files

# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
ffmpeg -f concat -i mylist.txt -c copy output

From https://trac.ffmpeg.org/wiki/Concatenate for format of mylist.txt

Encode to x264

Test shows that both commands results in 2 files with the same size and bitrate:1)

ffmpeg -i IN.VOB out.mkv
ffmpeg -i IN.VOB -c:v libx264 -preset medium -crf 23 -c:a libvorbis out.mkv
  1. 2-pass encoding (-pass 1/2) needs a certain bitrate option (-b:v) as well and seems to be useful only if you want an exact output file size.
  2. Constant Rate Factor (CRF) encoding seems not te be inferior compared to 2-pass
  3. crf 28 still seems to provide acceptable quality
  4. A slower preset seems to provide smaller file size with same quality at the cost of a higher encoding time.
  5. -preset slow helps about 5-10% compared to the medium preset

Source: http://trac.ffmpeg.org/wiki/Encode/H.264

Rule of thumb to save space: Make a test encoding with default values (crf=23) and than increase the crf value until quality becomes inacceptable.

Useful opts:

-tune animation - good for cartoons
-an disable audio
-vn disable video

Stream selection

Example: Select all video stream and 2nd audio stream of first (and normally only) input file:

ffmpeg  -i input.vob -map 0:v -map 0:a:1 output.mkv

Manual DVD ripping

Copy raw Media to Disk

Find the right track by reading DVD content using lsdvd2). mencoder dvd:// -v -o - may be helpfull as well

Extract track n with

mplayer dvd://n -dumpstream -dumpfile title_n.vob [-chapter m-m]

If reading and/or extaction does not work (check for completeness, passages with garbage!) then try the following method:

Copy raw Media to Disk Alternative

Mount the DVD and check all VOB-files with mplayer (or ffplay). Copy those you need to disk

Some VOBs have garbage at the beginning, delete it using extracting the valid section with ffmpeg (see above)

Some VOBs have garbage at the end. To cut this off, note the start offset seconds with ffprobe, eg: start: 4356.264000 Then note the desired end position with mplayer via on screen display or CLI output, eg 4528
Subtraction of end from start gives the duration in seconds. Feed this to ffmpeg:

ffmpeg -i VTS_01_4.org.VOB -codec copy -t 171.736 VTS_01_4.VOB

Create a voblist text file for concatenation. See above

Encode

ffmpeg -i input.vob output.mkv

See above for more options

Todo

  1. Chapter markers
  2. subtitles
  3. multiple audio tracks
  4. Test ffmpeg -aspect

DVD ripping with HandBrake

Install

The easiest way by far to get copies of your DVD movies is command line app HandBrake.

The Ubuntu CLI binary (Precise) works on Slack (14.0). Just download the deb package, unpack it with ar -x, untar all appearing archives and move HandBrakeCLI to /usr/local/bin.

As of Slack 14.1 the Ubuntu version handbrake - 0.10.2ppa1~vivid1 needs libass, lame and x264 from www.slackbuilds.org. And the Symlink libx264.so.142 → libx264.so.146 in /usr/lib(64).

Alternatively, as of Slack 13.0 Handbrake is available at www.slackbuilds.org. But it has many more dependencies.

It has almost no dependencies3), everything is build in. Both a binary version for Linux and the source code is available.

  1. Install libdvdcss4)
  2. Download the binary and copy it to /usr/local/bin.

Note: As of version 0.9.4 no generic tarball is available any more. But is possible to compile the HandbrakeCLI source (tested on Slack 13.0). Note that in order to compile Handbrake you need yasm which is available on www.slackbuilds.org. Note also that the build process aborts with an error, but the CLI interface works. — 2009-12-30

Note: The current binary version (0.9.3) is marked as Ubuntu Package. But it is still simply a tarball which works on Slack (tested on 13.0) — 2009-10-14

A possible alternative HandBrake is Thoggen, but it has loads of dependencies and is by far more complicated to install.

Usage

Get Info about DVD:

HandBrakeCLI -i /dev/dvd -t 0 2>err.txt

and look for the longest title.

Rip Example:

HandBrakeCLI -i /dev/dvd -o movie.mp4 --preset=Normal --loose-anamorphic -L [-a 1[,2]] [-A Deutsch[,English]] [-s 1] [-c 3]

Possibly helpful scripts for:

are here

CLIGuide, Intro on Linux.com, Intro on Linux-User (german)

1)
Bitrate can be checked with ffprobe
2)
available on slackbuilds