2017-12-02 22:02:37 +00:00
|
|
|
********
|
|
|
|
Snippets
|
|
|
|
********
|
|
|
|
|
|
|
|
Change container
|
|
|
|
================
|
|
|
|
|
2021-09-18 00:06:06 +00:00
|
|
|
.. code:: shell
|
2017-12-02 22:02:37 +00:00
|
|
|
|
2021-09-18 00:06:06 +00:00
|
|
|
ffmpeg \
|
|
|
|
-i input.avi \
|
|
|
|
-y output.mkv
|
|
|
|
|
|
|
|
Record video device
|
|
|
|
===================
|
|
|
|
|
|
|
|
List formats
|
|
|
|
------------
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ffmpeg \
|
|
|
|
-f v4l2 -list_formats all \
|
|
|
|
-i /dev/video0
|
|
|
|
|
|
|
|
Acquire fastly
|
|
|
|
--------------
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ffmpeg \
|
|
|
|
-f v4l2 -use_wallclock_as_timestamps true \
|
|
|
|
-video_size 1280x720 -framerate 60 \
|
|
|
|
-input_format bgr24 \
|
|
|
|
-i /dev/video0 \
|
|
|
|
-vf vflip \
|
|
|
|
-codec:v libx264 -preset ultrafast -qp 0 \
|
|
|
|
-y ultrafast.mkv
|
|
|
|
|
|
|
|
Cut and shrink
|
|
|
|
--------------
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ffmpeg -i ultrafast.mkv \
|
|
|
|
-ss 00:00:01.000 -to 00:00:02.000 \
|
|
|
|
-codec:v libx264 -preset veryslow -qp 0 \
|
|
|
|
-y uf.mkv
|
|
|
|
|
|
|
|
Compress for web
|
|
|
|
----------------
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ffmpeg -i uf.mkv \
|
|
|
|
-codec:v libx264 -preset veryslow -qp 23 \
|
|
|
|
-movflags +faststart -pix_fmt yuv420p \
|
|
|
|
-y uf.23.mkv
|
|
|
|
|
|
|
|
Cut file
|
|
|
|
========
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ffmpeg \
|
|
|
|
-i input.mkv \
|
|
|
|
-ss 00:00:01.000 \
|
|
|
|
-to 00:00:02.000 \
|
|
|
|
-codec copy \
|
|
|
|
-y output.mkv
|
|
|
|
|
|
|
|
Closest I frames
|
|
|
|
----------------
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
ffmpeg \
|
|
|
|
-ss 00:00:01.000 \
|
|
|
|
-i input.mkv \
|
|
|
|
-to 00:00:02.000 \
|
|
|
|
-codec copy \
|
|
|
|
-y output.mkv
|