Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
becki:linux:multimedia [2015-12-16 09:15] becki |
becki:linux:multimedia [2018-09-15 08:03] (aktuell) becki [Encode to x264] |
||
---|---|---|---|
Zeile 3: | Zeile 3: | ||
Infos about howto play, edit and stream audio and video | Infos about howto play, edit and stream audio and video | ||
- | ===== Play internet radio streams on the command line == | + | ===== Internet Radio == |
+ | ==== Play internet radio streams on the command line == | ||
- | Use ''soma'' | + | Use ''soma'' or ''mplayer'' |
- | ===== Record internet radio streams to a file == | + | ==== Record internet radio streams to a file == |
Just use ''curl''. The resulting file is playable with common players like mplayer, xine or vlc | Just use ''curl''. The resulting file is playable with common players like mplayer, xine or vlc | ||
- | ===== Audo and video editing with ffmpeg == | + | ===== Audo and video editing tools == |
- | ==== Install on Slack == | + | ==== ffmpeg == |
+ | === Install == | ||
- | Download from slackbuilds and build it as root using ''su -'', not only ''su''. Otherwise the build will fail because it can't find ''texi2html''. | + | 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: | Recommended optional packages for ffmpeg: | ||
- | |||
<code> | <code> | ||
ffmpeg | ffmpeg | ||
Zeile 25: | Zeile 26: | ||
lame | lame | ||
x264 | x264 | ||
- | x265 | + | [x265] |
</code> | </code> | ||
- | ==== Extract a section == | + | 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 == | ||
+ | |||
+ | - man ffmpeg | ||
+ | - https://ffmpeg.org/documentation.html | ||
+ | - https://ffmpeg.org/ffmpeg-all.html | ||
+ | - http://trac.ffmpeg.org/wiki | ||
+ | - https://www.ostechnix.com/20-ffmpeg-commands-beginners/ | ||
+ | |||
+ | Note that these official docs do not contain hints about DVD ripping. | ||
+ | |||
+ | ==== mencoder == | ||
+ | === Overview == | ||
+ | |||
+ | - mencoder uses ffmpeg | ||
+ | - ffmpeg provides and uses libavcodec | ||
+ | - ffmpeg seems to come from mplayer. The ffmpeg slack package points to http://ffmpeg.mplayerhq.hu | ||
+ | - libavcodec does not contain x264, it is a standalone lib | ||
+ | - mencoder (as well as handbrake) [[http://www.mplayerhq.hu/DOCS/HTML/en/MPlayer.html#menc-feat-dvd-mpeg4-codec|recommends]] to use x264 as video encoder | ||
+ | - mencoder (as well as ffmpeg) probably need to be recompiled after x264 is installed. ''mencoder -ovc help'' should list x264 after recompile | ||
+ | - mencoder provides [[http://www.mplayerhq.hu/DOCS/HTML/en/MPlayer.html#menc-feat-dvd-mpeg4|extensive doc]] about howto rip a DVD. Nothing similar found for ffmpeg yet. | ||
+ | - 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 == | ||
+ | |||
+ | - man menconder | ||
+ | - http://www.mplayerhq.hu/DOCS/HTML/en/MPlayer.html | ||
+ | - https://wiki.ubuntuusers.de/MEncoder | ||
+ | - Interesting (German) link: https://wiki.ubuntuusers.de/DVDs_manuell_rippen | ||
+ | - DVD auslesen: http://www.wiki.csoft.at/index.php/MEncoder_Scripts#DVD_auslesen | ||
+ | |||
+ | ===== 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. | 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 | ffmpeg -ss 41:08 -i all.mp3 -codec copy -t 61 part.mp3 | ||
- | | + | |
- | This technique works for video as well. | + | 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 == | ==== Concat multiple files == | ||
Zeile 49: | Zeile 101: | ||
From https://trac.ffmpeg.org/wiki/Concatenate for format of ''mylist.txt'' | 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:((Bitrate can be checked with ''ffprobe'')) | ||
+ | ffmpeg -i IN.VOB out.mkv | ||
+ | ffmpeg -i IN.VOB -c:v libx264 -preset medium -crf 23 -c:a libvorbis out.mkv | ||
+ | |||
+ | - 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. | ||
+ | - Constant Rate Factor (CRF) encoding seems not te be inferior compared to 2-pass | ||
+ | - crf 28 still seems to provide acceptable quality | ||
+ | - A slower preset seems to provide smaller file size with same quality at the cost of a higher encoding time. | ||
+ | - ''-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: | ||
+ | <code> | ||
+ | -tune animation - good for cartoons | ||
+ | -an disable audio | ||
+ | -vn disable video | ||
+ | </code> | ||
+ | |||
+ | ==== 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 == | ===== Manual DVD ripping == | ||
+ | ==== Copy raw Media to Disk == | ||
+ | |||
+ | Find the right track by reading DVD content using ''lsdvd''((available on slackbuilds)). ''%%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 | Mount the DVD and check all VOB-files with mplayer (or ffplay). Copy those you need to disk | ||
Zeile 62: | Zeile 151: | ||
Create a voblist text file for concatenation. See above | Create a voblist text file for concatenation. See above | ||
- | Encode | + | ==== Encode == |
- | ffmpeg -f concat -i voblist.txt -c:v libx264 -c:a vorbis output.mkv | + | |
- | FIXME use ''-map'' to select audio and video tracks | + | ffmpeg -i input.vob output.mkv |
- | ===== DVD ripping with mencoder == | + | See above for more options |
- | FIXME outdated. See Manual DVD ripping instead | + | ==== Todo == |
- | ==== Overview == | + | - Chapter markers |
- | + | - subtitles | |
- | - mencoder uses ffmpeg | + | - multiple audio tracks |
- | - ffmpeg provides and uses libavcodec | + | - Test ffmpeg -aspect |
- | - ffmpeg seems to come from mplayer. The ffmpeg slack package points to http://ffmpeg.mplayerhq.hu | + | |
- | - libavcodec does not contain x264, it is a standalone lib | + | |
- | - mencoder (as well as handbrake) [[http://www.mplayerhq.hu/DOCS/HTML/en/MPlayer.html#menc-feat-dvd-mpeg4-codec|recommends]] to use x264 as video encoder | + | |
- | - mencoder (as well as ffmpeg) probably need to be recompiled after x264 is installed. ''mencoder -ovc help'' should list x264 after recompile | + | |
- | - mencoder provides [[http://www.mplayerhq.hu/DOCS/HTML/en/MPlayer.html#menc-feat-dvd-mpeg4|extensive doc]] about howto rip a DVD. Nothing similar found for ffmpeg yet. | + | |
- | - A search for ''ffmpeg vs mencoder'' on the web shows that most people recommend mencoder, because it can do more | + | |
- | + | ||
- | ==== Unsorted Links == | + | |
- | + | ||
- | - https://wiki.ubuntuusers.de/MEncoder | + | |
- | - Interesting (German) link: https://wiki.ubuntuusers.de/DVDs_manuell_rippen | + | |
- | - DVD auslesen: http://www.wiki.csoft.at/index.php/MEncoder_Scripts#DVD_auslesen | + | |
===== DVD ripping with HandBrake == | ===== DVD ripping with HandBrake == |