video.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 05 Aug 2015 23:55:34 +0300
changeset 1729 22ffd80639c0
parent 1545 bce7c524f517
child 1772 f2e72be1412b
permissions -rw-r--r--
Make centered content design with adoption for mobile devices. Highlight TOC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1309
diff changeset
     2
.. include:: HEADER.rst
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
========
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Video.
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
========
1346
a2fbf50a43f4 Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
     7
.. contents::
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Players for linux?
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==================
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
::
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  $ sudo apt-get install vlc
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ sudo apt-get install mplayer
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
1355
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    16
Determine video format.
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    17
=======================
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
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    22
  $ mediainfo $VIDEO
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    23
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    24
See:
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    25
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    26
  http://en.gentoo-wiki.com/wiki/Show_Video_Codecs
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    27
                Show Video Codecs
22bbad2a94db Determine video format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
    28
1309
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    29
3d film.
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    30
========
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    31
::
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    32
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    33
  $ mplayer -vf stereo3d=side_by_side_left_first:anaglyph_red_cyan_color -vo gl $VIDEO
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    34
  $ mplayer -vf stereo3d=above_below_left_first:anaglyph_red_cyan_color -vo gl $VIDEO
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    35
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    36
See ``man 1 mplayer``.
0ea0a71c226d 3d film.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
    37
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
Web camera.
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
===========
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
1499
b19fe371e90e Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1498
diff changeset
    41
View picture from web camera on display screen::
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
  $ mplayer tv://
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  $ mplayer tv:// -tv driver=v4l2:width=640:height=480:fps=15:device=/dev/video0
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
  $ cheese
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
  $ camorama
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
1499
b19fe371e90e Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1498
diff changeset
    48
Make screenshort from web camera::
b19fe371e90e Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1498
diff changeset
    49
b19fe371e90e Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1498
diff changeset
    50
  $ 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
    51
  $ 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
    52
b19fe371e90e Make screenshort from web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1498
diff changeset
    53
Record web camera to a file::
1498
094d7e74252a Recording web camera to file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1361
diff changeset
    54
094d7e74252a Recording web camera to file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1361
diff changeset
    55
  $ mencoder -fps 15 tv:// -ovc lavc -o my.avi
094d7e74252a Recording web camera to file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1361
diff changeset
    56
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
See:
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  http://wiki.debian.org/Webcam
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
                Debian wiki.
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
1359
9ea67efc1fac Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1358
diff changeset
    62
Extract audio from video file.
9ea67efc1fac Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1358
diff changeset
    63
==============================
1532
53d1eee0ee05 Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1518
diff changeset
    64
53d1eee0ee05 Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1518
diff changeset
    65
``$NO`` - autio strean number::
53d1eee0ee05 Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1518
diff changeset
    66
1545
bce7c524f517 Fix typo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1532
diff changeset
    67
  $ ffmpeg -i $IN -c:a:$NO $OUT.mp3
1359
9ea67efc1fac Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1358
diff changeset
    68
9ea67efc1fac Extract audio from video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1358
diff changeset
    69
  $ 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
    70
1360
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    71
Integrate audio to video file.
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    72
==============================
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    73
::
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    74
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    75
  $ mencoder \
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    76
    -ffourcc divx \
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    77
    -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=400 \
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    78
    -audiofile audio.wav \
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    79
    -oac mp3lame -lameopts vbr=3 \
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    80
    -o output.avi input.mkv
380c5205ef4e Integrate audio to video file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1359
diff changeset
    81
1358
7a93143dbf53 Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
    82
Synchronise video and audio streams.
7a93143dbf53 Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
    83
====================================
7a93143dbf53 Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
    84
::
7a93143dbf53 Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
    85
7a93143dbf53 Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
    86
  $ 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
    87
  $ 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
    88
    -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
    89
    -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
    90
1361
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    91
Convert video for Nokia 5320.
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    92
=============================
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    93
::
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    94
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    95
  $ mencoder -mc 0 -of lavf -lavfopts format=mp4 \
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    96
    -oac lavc -ovc lavc \
f62fc97ba770 Convert video for Nokia 5320.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
    97
    -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
    98
    -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
    99
    -o out.mp4 in.avi
1358
7a93143dbf53 Synchronise video and audio streams.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
   100
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
How convert .3gp to .avi(mpeg)?
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
===============================
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
::
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
  $ sudo apt-get install ffmpeg
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
  $ ffmpeg -i test.3gp -f mpegvideo -ar 44100 -ac 1 -acodec mp3 test.mpg
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
  $ 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
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
  $ ffmpeg -i video-in.3gp -b 250 -s 160×120 -r 15 -f avi -an video-out.avi
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
  $ mencoder -oac mp3lame -ovc lavc -o video-out.avi -vf pp,2xsai,scale video-in.3gp
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
  $ mencoder -o video-in.avi -vf pp,2xsai,scale -ovc lavc video-out.3gp
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
  $ mencoder -o video-in.avi -vf rotate=2 -oac pcm -ovc divx4 video-out.3gp
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
You need to compile FFmpeg with AMR support (--enable-amr_nb --enable-amr_wb).
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
V5.1.0 from
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
and extracted the source to libavcodec/amrwb_float
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
REL-5 V5.1.0 from
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
and extracted the source to libavcodec/amr_float
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
and if u try this on an alpha, u may need to change Word32 to int in
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
amr/typedef.h
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
1518
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   128
Video editors.
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   129
==============
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   130
::
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
1518
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   132
  $ sudo apt-get install pitivi kino
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
1518
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   134
See:
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
1518
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   136
  http://www.pitivi.org/
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   137
                pitivi home page.
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   138
  http://www.kinodv.org/
46c3367e73c8 Video editors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1499
diff changeset
   139
                Kino home page.
1308
879d342c6e37 Web camera.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140