Skip to content

Commit 71cb892

Browse files
committed
More media
1 parent 1950b90 commit 71cb892

20 files changed

+722
-292
lines changed

README.md

+17-5
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,23 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
198198
1. [Dictionary](dictionary.md): dictionary formats
199199
1. [Game](game.md): games, emulation
200200
1. [Image](image.md)
201-
1. [GIMP](gimp.md)
202-
1. [NetPBM](netpbm/)
203-
1. [gnuplot](gnuplot/)
204-
1. [ImageMagick](imagemagick.md)
205-
1. [Video](video.md): videos, films, subtitles
201+
1. [Formats](image-formats.md)
202+
1. [NetPBM](netpbm/)
203+
1. [GIMP](gimp.md)
204+
1. [ImageMagick](imagemagick.md)
205+
1. [gnuplot](gnuplot/)
206+
1. [Video](video.md)
207+
1. [Video codecs](video-codecs.md)
208+
1. [Video containers](video-containers.md)
209+
1. Utilities
210+
1. [ffmpeg](ffmpeg.md)
211+
1. [ffserver.conf](ffserver.conf)
212+
1. Ripping
213+
1. [HandBrake](handbrake.md)
214+
1. Trivia
215+
1. [MPEG LA](mpeg-la.md)
216+
1. [Camera](camera.md)
217+
1. [Video4Linux](video4linux.md)
206218
1. File sharing
207219
1. [Dropbox](dropbox.md)
208220
1. [Nicotine](nicotine.md)

audio/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Audio
22

3+
1. [Codecs](codecs.md)
4+
35
## Directories
46

57
On most systems, sound will be kept under:

audio/codecs.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Codecs
2+
3+
## AAC
4+
5+
<https://en.wikipedia.org/wiki/Advanced_Audio_Coding>
6+
7+
Free to distribute, but not develop with.
8+
9+
## Vorbis
10+
11+
<https://en.wikipedia.org/wiki/Vorbis>
12+
13+
## Speex
14+
15+
<https://en.wikipedia.org/wiki/Speex>
16+
17+
Vorbis predecessor.
18+
19+
## MP3
20+
21+
<https://en.wikipedia.org/wiki/MP3>
22+
23+
MPEG-1 or MPEG-2 Audio Layer III.
24+
25+
## MP2
26+
27+
<https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II>
28+
29+
More popular than MP3 for broadcasting. TODO why?
30+
31+
MPEG-1 Audio Layer II or MPEG-2 Audio Layer II.
32+
33+
Synthetic generation of pure tone + to PCM FFmpeg C API decode example: <https://github.com/FFmpeg/FFmpeg/blob/1ec7a703806049265991723a8826bd61555edef4/doc/examples/decoding_encoding.c>
34+
35+
## Raw formats
36+
37+
### PCM
38+
39+
<https://en.wikipedia.org/wiki/Pulse-code_modulation>
40+
41+
Decoded from MP2: <https://github.com/FFmpeg/FFmpeg/blob/1ec7a703806049265991723a8826bd61555edef4/doc/examples/decoding_encoding.c>

autotools/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
# Autotools
22

3+
1. [Hello world](hello-world/)
4+
35
GNU's build system.
46

57
CMake is likely more portable. But if you ever touch a GNU project, better learn this.
68

79
KDE is a notable project that dumped it for CMake in KDE 4: <https://lwn.net/Articles/188693/>
10+
11+
## Build object files to custom directory
12+
13+
<http://stackoverflow.com/questions/1015700/autotools-library-and-object-file-output-control>
14+
15+
`cd` into the desired directory, and `../configure` from there.
16+
17+
## Compilation flags
18+
19+
Pass an extra one at `make` time:
20+
21+
- <http://stackoverflow.com/questions/7543978/how-to-pass-g3-flag-to-gcc-via-make-command-line>
22+
- <http://stackoverflow.com/questions/3602927/add-compiler-option-without-editing-makefile>
23+
- <http://stackoverflow.com/questions/1250608/passing-a-gcc-flag-through-makefile>

book/README.md

+3-72
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Book
22

3+
1. [PDF](pdf.md)
4+
1. [pdftk](pdftk.md)
5+
36
A book format is in general a format that can represent multiple images, text and multiple pages such as PDF, DJVU or PS.
47

58
Pure image or text formats such as JPEG or TeX are not covered here.
@@ -119,78 +122,6 @@ Out to stdout:
119122

120123
ps2pdf a.ps -
121124

122-
### pdftk
123-
124-
PDF Tool Kit
125-
126-
Large feature set on dealing with PDFs page wise.
127-
128-
Rather non standard command line interface (nothing to do with common POSIX or GNU conventions).
129-
130-
Merge two or more PDFs into a new document:
131-
132-
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
133-
134-
or using handles:
135-
136-
pdftk A=1.pdf B=2.pdf cat A B output 12.pdf
137-
138-
or using wildcards:
139-
140-
pdftk *.pdf cat output combined.pdf
141-
142-
Slice PDF: get pages 1 to 7 only:
143-
144-
pdftk A="$f.pdf" cat A1-7 output "$f.pdf"
145-
146-
Select pages from multiple PDFs into a new document:
147-
148-
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf
149-
150-
Split pdf into single pages
151-
152-
pdftk mydoc.pdf burst
153-
154-
Get pdf metadata like number of pages:
155-
156-
pdftk mydoc.pdf dump_data | less
157-
158-
Rotate the first page of a PDF to 90 degrees clockwise:
159-
160-
pdftk in.pdf cat 1E 2-end output out.pdf
161-
162-
Rotate an entire PDF document’s pages to 180 degrees:
163-
164-
pdftk in.pdf cat 1-endS output out.pdf
165-
166-
Encrypt a PDF using 128-bit strength (the default) and withhold all permissions (the default):
167-
168-
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass
169-
170-
Same as Above, Except a Password is Required to Open the PDF:
171-
172-
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz
173-
174-
Same as Above, Except Printing is Allowed (after the PDF is Open):
175-
176-
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz allow printing
177-
178-
Decrypt a PDF:
179-
180-
pdftk secured.pdf input_pw foopass output unsecured.pdf
181-
182-
Join Two Files, One of Which is Encrypted (the Output is Not Encrypted):
183-
184-
pdftk A=secured.pdf mydoc.pdf input_pw A=foopass cat output combined.pdf
185-
186-
Uncompress PDF Page Streams for Editing the PDF Code in a Text Editor:
187-
188-
pdftk mydoc.pdf output mydoc.clear.pdf uncompress
189-
190-
Repair a PDF’s Corrupted XREF Table and Stream Lengths (If Possible):
191-
192-
pdftk broken.pdf output fixed.pdf
193-
194125
### pdfjam
195126

196127
Package that includes several PDF utils.

book/pdftdk.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# pdftk
2+
3+
PDF Tool Kit
4+
5+
Large feature set on dealing with PDFs page wise.
6+
7+
Rather non standard command line interface (nothing to do with common POSIX or GNU conventions).
8+
9+
Merge two or more PDFs into a new document:
10+
11+
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
12+
13+
or using handles:
14+
15+
pdftk A=1.pdf B=2.pdf cat A B output 12.pdf
16+
17+
or using wildcards:
18+
19+
pdftk *.pdf cat output combined.pdf
20+
21+
Slice PDF: get pages 1 to 7 only:
22+
23+
pdftk A="$f.pdf" cat A1-7 output "$f.pdf"
24+
25+
Select pages from multiple PDFs into a new document:
26+
27+
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf
28+
29+
Split pdf into single pages
30+
31+
pdftk mydoc.pdf burst
32+
33+
Get pdf metadata like number of pages:
34+
35+
pdftk mydoc.pdf dump_data | less
36+
37+
Rotate the first page of a PDF to 90 degrees clockwise:
38+
39+
pdftk in.pdf cat 1E 2-end output out.pdf
40+
41+
Rotate an entire PDF document’s pages to 180 degrees:
42+
43+
pdftk in.pdf cat 1-endS output out.pdf
44+
45+
Encrypt a PDF using 128-bit strength (the default) and withhold all permissions (the default):
46+
47+
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass
48+
49+
Same as Above, Except a Password is Required to Open the PDF:
50+
51+
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz
52+
53+
Same as Above, Except Printing is Allowed (after the PDF is Open):
54+
55+
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz allow printing
56+
57+
Decrypt a PDF:
58+
59+
pdftk secured.pdf input_pw foopass output unsecured.pdf
60+
61+
Join Two Files, One of Which is Encrypted (the Output is Not Encrypted):
62+
63+
pdftk A=secured.pdf mydoc.pdf input_pw A=foopass cat output combined.pdf
64+
65+
Uncompress PDF Page Streams for Editing the PDF Code in a Text Editor:
66+
67+
pdftk mydoc.pdf output mydoc.clear.pdf uncompress
68+
69+
Repair a PDF’s Corrupted XREF Table and Stream Lengths (If Possible):
70+
71+
pdftk broken.pdf output fixed.pdf
72+

camera.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Camera
2+
3+
Take picture from terminal: <http://askubuntu.com/questions/106770/take-a-picture-from-terminal>
4+
5+
Make video from terminal: <http://askubuntu.com/questions/487496/terminal-command-to-record-video>
6+
7+
Make video: <http://askubuntu.com/questions/186003/anything-better-than-cheese-for-video-capture>

ffmpeg.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# ffmpeg
2+
3+
CLI front-end for the FFmpeg library. Can do tons of conversions and streaming.
4+
5+
Tested on Ubuntu 15.10.
6+
7+
List codecs: <http://stackoverflow.com/questions/3377300/what-are-all-codecs-supported-by-ffmpeg>
8+
9+
ffmpeg -codecs
10+
11+
## Extract raw streams
12+
13+
### H264
14+
15+
- <http://stackoverflow.com/questions/10380045/is-there-any-easy-way-to-extract-h-264-raw-stream-in-annexb-format>
16+
- <http://stackoverflow.com/questions/19300350/extracting-h264-raw-video-stream-from-mp4-or-flv-with-ffmpeg-generate-an-invalid>
17+
18+
Works:
19+
20+
ffmpeg -i in.mp4 -vcodec copy -bsf h264_mp4toannexb -an -f h264 out.h264
21+
22+
VLC cannot open that output file, but `ffplay` can. TODO: is the `-bsf` really needed?
23+
24+
ffmpeg -i in.mts -vcodec copy -an -f h264 out.h264
25+
26+
### AAC
27+
28+
<http://superuser.com/questions/186465/extract-audio-aac-from-mp4>
29+
30+
ffmpeg -i in.mp4 -c copy -map 0:a:0 out.aac
31+
32+
## Webcam
33+
34+
<https://trac.ffmpeg.org/wiki/Capture/Webcam>
35+
36+
First install `v4l2`, then:
37+
38+
ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 -f v8 output.mkv
39+
40+
## ffplay
41+
42+
Minimalistic video preview tool.
43+
44+
ffplay video.mp4
45+
46+
No controls, no nothing, just a window with the video.
47+
48+
Loop infinitely:
49+
50+
ffplay -loop -1 video.mp4
51+
52+
## Stream
53+
54+
<https://trac.ffmpeg.org/wiki/StreamingGuide>
55+
56+
## ffserver
57+
58+
<https://trac.ffmpeg.org/wiki/ffserver>
59+
60+
TODO: what is the IO format: RTMP of HTTP? How is video sent over HTTP?
61+
62+
Note: this project seems very unmaintained, and there are better ones out there.
63+
64+
Server configuration file:
65+
66+
/etc/ffserver.conf
67+
68+
Use a custom one and show server debug:
69+
70+
ffserver -d -f ~/ffserver.conf
71+
72+
Start server:
73+
74+
ffserver
75+
76+
Send video to it. Must edit the `VideoFrameRate` to something larger than 3... <https://lists.ffmpeg.org/pipermail/ffmpeg-user/2016-January/030111.html>:
77+
78+
ffmpeg -f v4l2 -s 320x240 -r 25 -i /dev/video0 -f alsa -ac 2 -i hw:1 http://localhost:8090/feed1.ffm
79+
80+
Watch it. Must edit ACL inside `feed` <http://stackoverflow.com/a/13977181/895245> or else access denied:
81+
82+
ffplay http://localhost:8090/test1.mpg
83+
84+
TODO: video has a huge delay from starting up to playing, see: <https://trac.ffmpeg.org/wiki/StreamingGuide#Latency>
85+
86+
A few URLs that can be accessed from the browser:
87+
88+
- <http://localhost:8090/stat.html>: show server status
89+
- <http://localhost:8090/>: redirect to what is fixed at `<Redirect index.html>` of the config file
90+
- <http://localhost:8090/test1.mpg>: TODO what happens? Firefox sees a video file type, and redirects to a video app, then when I kill the server the video player plays all that has happened as if from a file.
91+
92+
## udp protocol
93+
94+
An FFmpeg invention it seems: <http://stackoverflow.com/questions/27930879/what-is-ffmpegs-udp-protocol>

0 commit comments

Comments
 (0)