author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 24 Aug 2016 10:56:33 +0300 | |
changeset 2020 | 065c06927ba9 |
parent 2019 | 48ef940fd6b9 |
child 2228 | 837f1337c59b |
permissions | -rw-r--r-- |
1308 | 1 |
.. -*- coding: utf-8; -*- |
2 |
||
3 |
======== |
|
4 |
Video. |
|
5 |
======== |
|
1346
a2fbf50a43f4
Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
6 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1772
diff
changeset
|
7 |
:local: |
1308 | 8 |
|
9 |
Players for linux? |
|
10 |
================== |
|
11 |
:: |
|
12 |
||
13 |
$ sudo apt-get install vlc |
|
14 |
$ sudo apt-get install mplayer |
|
15 |
||
2013
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
16 |
Determine video format |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
17 |
====================== |
1355
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
18 |
:: |
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
19 |
|
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
20 |
$ file $VIDEO |
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
21 |
$ mplayer -frames 0 -vo null -ao null -identify $VIDEO |
2017
6ffd71b07385
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2015
diff
changeset
|
22 |
$ ffprobe $VIDEO |
1355
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
23 |
$ mediainfo $VIDEO |
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
24 |
|
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
25 |
See: |
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
26 |
|
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
27 |
http://en.gentoo-wiki.com/wiki/Show_Video_Codecs |
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
28 |
Show Video Codecs |
22bbad2a94db
Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
29 |
|
2013
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
30 |
Make screenshot from video |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
31 |
========================== |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
32 |
|
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
33 |
Seek to desired position with ``-ss`` option:: |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
34 |
|
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
35 |
$ ffmpeg -ss 600 -i $IN.avi -vframes 1 $OUT.png |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
36 |
|
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
37 |
You can apply filters, like resize:: |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
38 |
|
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
39 |
$ ffmpeg -ss 600 -i $IN.avi -vframes 1 -s 320x240 $OUT.png |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
40 |
|
2015
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
41 |
Extract frames from video |
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
42 |
========================= |
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
43 |
|
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
44 |
Extract one frame per second:: |
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
45 |
|
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
46 |
$ ffmpeg -i $IN.avi -vf fps=1 image-%03d.png |
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
47 |
|
2018
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
48 |
Extract subtitles from video |
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
49 |
============================ |
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
50 |
|
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
51 |
Find stream id with ``ffprobe $VIDEO`` and pass to:: |
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
52 |
|
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
53 |
$ ffmpeg -y -i in.mkv -map 0:$ID -f webvtt out.vtt |
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
54 |
|
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
55 |
List of supported by ``ffmpeg`` subtitle formats:: |
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
56 |
|
813aa342d9ce
Extract subtitles from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2017
diff
changeset
|
57 |
$ ffmpeg -formats | grep subt |
2015
bd2e3f9ac037
Extract frames from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2013
diff
changeset
|
58 |
|
2019
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
59 |
Integrating subtitles into video |
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
60 |
================================ |
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
61 |
:: |
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
62 |
|
2020 | 63 |
$ ffmpeg -i in.avi -vf subtitles=subtitle.srt out.avi |
2019
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
64 |
|
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
65 |
https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo |
48ef940fd6b9
Integrating subtitles into video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2018
diff
changeset
|
66 |
|
2013
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
67 |
Playing 3d film |
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
68 |
=============== |
1309 | 69 |
:: |
70 |
||
71 |
$ mplayer -vf stereo3d=side_by_side_left_first:anaglyph_red_cyan_color -vo gl $VIDEO |
|
72 |
$ mplayer -vf stereo3d=above_below_left_first:anaglyph_red_cyan_color -vo gl $VIDEO |
|
73 |
||
74 |
See ``man 1 mplayer``. |
|
75 |
||
1308 | 76 |
Web camera. |
77 |
=========== |
|
78 |
||
1499
b19fe371e90e
Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
79 |
View picture from web camera on display screen:: |
1308 | 80 |
|
81 |
$ mplayer tv:// |
|
82 |
$ mplayer tv:// -tv driver=v4l2:width=640:height=480:fps=15:device=/dev/video0 |
|
1772 | 83 |
$ guvcview |
1308 | 84 |
$ cheese |
85 |
$ camorama |
|
86 |
||
2013
0feb538ef035
Make screenshot from video.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
87 |
Make screenshot from web camera:: |
1499
b19fe371e90e
Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
88 |
|
b19fe371e90e
Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
89 |
$ ffmpeg -f video4linux2 -i /dev/v4l/by-id/CAMERA -vframes 1 test.jpeg |
b19fe371e90e
Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
90 |
$ ffmpeg -f video4linux2 -i /dev/v4l/by-id/CAMERA -vframes 4 test%3d.jpeg |
b19fe371e90e
Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
91 |
|
b19fe371e90e
Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
92 |
Record web camera to a file:: |
1498
094d7e74252a
Recording web camera to file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1361
diff
changeset
|
93 |
|
094d7e74252a
Recording web camera to file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1361
diff
changeset
|
94 |
$ mencoder -fps 15 tv:// -ovc lavc -o my.avi |
1772 | 95 |
$ guvcview |
1498
094d7e74252a
Recording web camera to file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1361
diff
changeset
|
96 |
|
1308 | 97 |
See: |
98 |
||
99 |
http://wiki.debian.org/Webcam |
|
100 |
Debian wiki. |
|
101 |
||
1359
9ea67efc1fac
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1358
diff
changeset
|
102 |
Extract audio from video file. |
9ea67efc1fac
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1358
diff
changeset
|
103 |
============================== |
1532
53d1eee0ee05
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1518
diff
changeset
|
104 |
|
53d1eee0ee05
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1518
diff
changeset
|
105 |
``$NO`` - autio strean number:: |
53d1eee0ee05
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1518
diff
changeset
|
106 |
|
1545 | 107 |
$ ffmpeg -i $IN -c:a:$NO $OUT.mp3 |
1359
9ea67efc1fac
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1358
diff
changeset
|
108 |
|
9ea67efc1fac
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1358
diff
changeset
|
109 |
$ mplayer -ao pcm:fast:file=audio.wav -vc null -vo null input.avi |
9ea67efc1fac
Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1358
diff
changeset
|
110 |
|
1360
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
111 |
Integrate audio to video file. |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
112 |
============================== |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
113 |
:: |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
114 |
|
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
115 |
$ mencoder \ |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
116 |
-ffourcc divx \ |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
117 |
-ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=400 \ |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
118 |
-audiofile audio.wav \ |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
119 |
-oac mp3lame -lameopts vbr=3 \ |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
120 |
-o output.avi input.mkv |
380c5205ef4e
Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1359
diff
changeset
|
121 |
|
1358
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
122 |
Synchronise video and audio streams. |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
123 |
==================================== |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
124 |
:: |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
125 |
|
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
126 |
$ mencoder -delay 0.7 -oac copy -ovc copy in.avi -o out.avi |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
127 |
$ mencoder -mc 0 -of lavf -lavfopts format=mp4 -oac lavc -ovc lavc \ |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
128 |
-lavcopts aglobal=1:vglobal=1:acodec=libmp3lame:abitrate=128:vcodec=mpeg4:vbitrate=500:keyint=200 |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
129 |
-vf scale=-3:240,crop=320:240,harddup -af lavcresample=44100 -o out.mp4 in.mp4 |
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
130 |
|
1361
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
131 |
Convert video for Nokia 5320. |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
132 |
============================= |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
133 |
:: |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
134 |
|
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
135 |
$ mencoder -mc 0 -of lavf -lavfopts format=mp4 \ |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
136 |
-oac lavc -ovc lavc \ |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
137 |
-lavcopts aglobal=1:vglobal=1:acodec=libmp3lame:abitrate=96:vcodec=mpeg4:vbitrate=400:keyint=100 \ |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
138 |
-vf scale=-3:240,crop=320:240,harddup -af lavcresample=44100 -ofps 15 \ |
f62fc97ba770
Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1360
diff
changeset
|
139 |
-o out.mp4 in.avi |
1358
7a93143dbf53
Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1355
diff
changeset
|
140 |
|
1308 | 141 |
How convert .3gp to .avi(mpeg)? |
142 |
=============================== |
|
143 |
:: |
|
144 |
||
145 |
$ sudo apt-get install ffmpeg |
|
146 |
$ ffmpeg -i test.3gp -f mpegvideo -ar 44100 -ac 1 -acodec mp3 test.mpg |
|
147 |
$ for i in `ls -1 *.3gp | cut -d. -f1`; do ffmpeg -y -i $i.3gp -sameq -f mpegvideo -s cif -r 25 -ar 32000 -ac 1 mpegs/$i.mpg; done |
|
148 |
$ ffmpeg -i video-in.3gp -b 250 -s 160×120 -r 15 -f avi -an video-out.avi |
|
149 |
$ mencoder -oac mp3lame -ovc lavc -o video-out.avi -vf pp,2xsai,scale video-in.3gp |
|
150 |
$ mencoder -o video-in.avi -vf pp,2xsai,scale -ovc lavc video-out.3gp |
|
151 |
$ mencoder -o video-in.avi -vf rotate=2 -oac pcm -ovc divx4 video-out.3gp |
|
152 |
||
153 |
You need to compile FFmpeg with AMR support (--enable-amr_nb --enable-amr_wb). |
|
154 |
||
155 |
AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204 |
|
156 |
V5.1.0 from |
|
157 |
http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip |
|
158 |
and extracted the source to libavcodec/amrwb_float |
|
159 |
||
160 |
||
161 |
AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104 |
|
162 |
REL-5 V5.1.0 from |
|
163 |
http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip |
|
164 |
and extracted the source to libavcodec/amr_float |
|
165 |
and if u try this on an alpha, u may need to change Word32 to int in |
|
166 |
amr/typedef.h |
|
167 |
||
1518 | 168 |
Video editors. |
169 |
============== |
|
170 |
:: |
|
1308 | 171 |
|
1518 | 172 |
$ sudo apt-get install pitivi kino |
1308 | 173 |
|
1518 | 174 |
See: |
1308 | 175 |
|
1518 | 176 |
http://www.pitivi.org/ |
177 |
pitivi home page. |
|
178 |
http://www.kinodv.org/ |
|
179 |
Kino home page. |
|
1308 | 180 |