핸드폰으로 비디오 찍어서 후딱 편집해서 공유할때 좋은 tip1,
FFMPEG으로 자동으로 10초씩 짤라놓는 방법
ffmpeg -loglevel quiet -n -r 60 -ss 2 -t 10 -i 0613/20190613_000.mp4 test_10_sec.mp4
ffmpeg -loglevel quiet -n -r 60 -ss 2 -t 10 -c:v h264 -i 0613/20190613_000.mp4 test_10_sec2.mp4
ffmpeg -loglevel quiet -n -ss 2 -t 10 -i 0613/20190613_000.mp4 -c:v h264 test_10_sec3.mp4
h264 codec이 NVidia Card를 이용하지 않으면 최신 드라이버로 update하고 FFMPEG을 다시 빌드하면 저절로 nvenc_h264 codec을 선택하게 됨. 엄청 빠름.
----------------
-loglevel
-n : never overwrite output file
-i : input file
-r : frame rate
-vcodec : video codec
-s : frame size WxH
-ss : start offset 00:00:30
-t : time duration 00:00:05
----------------
$ ffmpeg -hwaccels
ffmpeg version N-94455-g01994c93db Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Ubuntu 8.3.0-6ubuntu1~18.10.1)
configuration:
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
Hardware acceleration methods:
vdpau
cuda
vaapi
cuvid
.....
-----------------
$ ffmpeg -codecs
ffmpeg version N-94455-g01994c93db Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Ubuntu 8.3.0-6ubuntu1~18.10.1)
configuration:
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
-------
D.V.L. h263i Intel H.263
DEV.L. h263p H.263+ / H.263-1998 / H.263 version 2
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_cuvid ) (encoders: h264_nvenc h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
D.VIL. hap Vidvox Hap
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m hevc_cuvid ) (encoders: nvenc_hevc hevc_nvenc hevc_v4l2m2m hevc_vaapi )
D.V.L. msmpeg4v1 MPEG-4 part 2 Microsoft variant version 1
DEV.L. msmpeg4v2 MPEG-4 part 2 Microsoft variant version 2
DEV.L. msmpeg4v3 MPEG-4 part 2 Microsoft variant version 3 (decoders: msmpeg4 ) (encoders: msmpeg4 )
.....
-----------------
$ ffmpeg -encoders
ffmpeg version N-94455-g01994c93db Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Ubuntu 8.3.0-6ubuntu1~18.10.1)
configuration:
libavutil 56. 33.100 / 56. 33.100
libavcodec 58. 55.100 / 58. 55.100
libavformat 58. 30.100 / 58. 30.100
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.100 / 7. 58.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
Encoders:
V..... = Video
A..... = Audio
S..... = Subtitle
.F.... = Frame-level multithreading
..S... = Slice-level multithreading
...X.. = Codec is experimental
....B. = Supports draw_horiz_band
.....D = Supports direct rendering method 1
....
V..... h263 H.263 / H.263-1996
V..... h263_v4l2m2m V4L2 mem2mem H.263 encoder wrapper (codec h263)
V.S... h263p H.263+ / H.263-1998 / H.263 version 2
V..... h264_nvenc NVIDIA NVENC H.264 encoder (codec h264)
V..... h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec h264)
V..... h264_vaapi H.264/AVC (VAAPI) (codec h264)
V..... nvenc NVIDIA NVENC H.264 encoder (codec h264)
V..... nvenc_h264 NVIDIA NVENC H.264 encoder (codec h264)
V..... nvenc_hevc NVIDIA NVENC hevc encoder (codec hevc)
V..... hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc)
V..... hevc_v4l2m2m V4L2 mem2mem HEVC encoder wrapper (codec hevc)
V..... hevc_vaapi H.265/HEVC (VAAPI) (codec hevc)
.....
.....
FFMPEG으로 Rotate하기
# rotate video -filter:v transpose=1 or 2. 1=90 cw, 2=90 ccw
# -filter:v transpose=1