86.5 Video Formats

20200811 There are many video formats and we can generally convert between them, though the conversions may take some time. Many formats, like avi files, are essentially a container for video and audio encodings. A container file might contain, for example, a DivX encoded video.

The command ffmpeg can perform conversions. Here we convert from the common mp4 to webm which is more suitable for streaming through browsers. The -i option simply identifies the input video file. The command line argument is the output video file name.

$ ffmpeg -i myvideo.mp4 myvideo.webm

The informational output is quite extensive. Below is a snippet.

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened ...
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from myvideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:27:53.51, start: 0.000000, bitrate: 364 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1600x900 [SAR 1:1 DAR ...
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s ...
    Metadata:
      handler_name    : SoundHandler

Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> vp9 (libvpx-vp9))
  Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))

Output #0, webm, to 'myvideo.webm':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: vp9 (libvpx-vp9), yuv420p, 1600x900 [SAR 1:1 DAR 16:9], q=-1--1, ...
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.54.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: opus (libopus), 48000 Hz, stereo, flt, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.54.100 libopus

frame= 4586 fps=7.9 q=0.0 size=    6703kB time=00:02:33.13 bitrate= 358.6kbits/s speed=0.265x    


Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.