Ffmpeg

From
Revision as of 08:50, 27 March 2023 by Chkummer (talk | contribs)
Jump to: navigation, search

A complete, cross-platform solution to record, convert and stream audio and video. One may use ffprobe to analysze the current format and ffmpeg to convert.

Converting Files

The file PM5644_1080p_25fps_h264_main.mov has the following format:

bin/ffprobe Movies/test_clips_1080_25fps/PM5644_1080p_25fps_h264_main.mov
ffprobe version 5.1.2-tessus Copyright (c) 2007-2022 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Movies/test_clips_1080_25fps/PM5644_1080p_25fps_h264_main.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 2022-05-24T13:30:17.000000Z
    encoder         : Blackmagic Design DaVinci Resolve Studio
  Duration: 00:00:14.40, start: 0.000000, bitrate: 3193 kb/s
  Stream #0:0[0x1]: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 1589 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      creation_time   : 2022-05-24T13:30:17.000000Z
      handler_name    : VideoHandler
      vendor_id       :     
      encoder         : H.264
      timecode        : 00:00:00:00
  Stream #0:1[0x2]: Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2022-05-24T13:30:17.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      creation_time   : 2022-05-24T13:30:17.000000Z
      handler_name    : TimeCodeHandler
      timecode        : 00:00:00:00
Unsupported codec with id 0 for input stream 2

A Sample usage is like this to convert into H264 Main profile compatible with Blackmagic Recorders (like Blackmagic HyperDeck Shuttle HD):

ffmpeg -i <src_file> -c:v libx264 -profile:v main -filter:v fps=25 -c:a copy <dst_file>

Links