FFMPEG and LibAV

19
FFmpeg and Libav Sep-2015 Dani Gutiérrez Porset Associate Professor Communications Engineering Eman ta zabal zazu

Transcript of FFMPEG and LibAV

FFmpeg and Libav

Sep-2015

Dani Gutiérrez PorsetAssociate Professor

Communications Engineering

Eman ta zabal zazu

2 2FFmpeg and Libav

Thanks, Licences and Tools

● Thanks to people and organizations who took and take part in free software and free knowledge projects.

● This presentation is licensed as CC BY-SA 3.0 EShttp://creativecommons.org/licenses/by-sa/3.0/es/

● Tools used to make this presentation: GNU/Linux, KDE, Inkscape, Gimp, LibreOffice, Firefox, Chromium

● All images are taken from Wikimedia Foundation. Logos and trademarks belong to respective organizations

3 3FFmpeg and Libav

Index● What are FFmpeg and Libav? Uses● FFmpeg or Libav ● Example of Commands and Libraries in Libav● Files, Streams, Containers and Codecs● Transcoding process● Some supported formats and codecs● Laws. “Extra” libraries in Debian and Ubuntu● Supported protocols and devices● Some uses

4 4FFmpeg and Libav

What areFFmpeg and Libav?

● Tools and librariesto convert, manipulate and streammultimedia formats and protocols

● Written in C● Multiplatform: GNU/Linux, Mac OS X, Ms

Windows,...● License: GNU GPL or GNU LGPL

5 5FFmpeg and Libav

Uses

Net Services

Video/Audio Playersand Media centers

Video/Audio/3DEditors

k3b

Other Software

VoIP

Browser

Graphic Libraries

Disk authoring

6 6FFmpeg and Libav

FFmpeg or Libav

● Libav (2011) = fork of FFmpeg (2000)● Incompatible libraries (libavcodec)● See each program to check wich one is using

https://en.wikipedia.org/wiki/Libav#Software_using_Libav_instead_of_FFmpeg

7 7FFmpeg and Libav

Example: Libav Commands and Libraries in Ubuntu package

avconv avprobe

libavdevice

libavcodec

libavfilter

libavformat

libavutil

libpostproc

libswscale

avplay avserver

Video postprocessing

Video software scaling

Commands provided for compatibility: ffmpeg, ffplay, ffprobe, ffserverCom

man

ds(c

onso

le)

Libr

arie

s

Shared utilities

Codecs+ Highly optimized implementationsof DCT, color space conversion,...

Mux/ Demux

SDL

8 8FFmpeg and Libav

Files, Streams,Containers and Codecs

● Each stream type is encoded according to a codec

● Allowed number, type and codification of streams depends on file format (container)

● Some files can contain streams that don't begin at starte.g. subtitles in some VOB files

● Some codecs only allow a small number of fixed frame ratese.g. MPEG-1/2

● Libav supports:

– Some containers only for mux, only for demux, or for both

– Some codecs only for codec, only for decodec, or for both

9 9FFmpeg and Libav

Files, Streams,Containers and Codecs

● A file can be: Regular file, Pipe, Network stream, Device● A file has distinct multiplexed streams, each stream of 5

possible types:

10 10FFmpeg and Libav

Files, Streams,Containers and Codecs

● Each stream type is encoded according to a codec

● Allowed number, type and codification of streams depends on file format (container)

● Some files can contain streams that don't begin at starte.g. subtitles in some VOB files

● Some codecs only allow a small number of fixed frame ratese.g. MPEG-1/2

● Libav supports:

– Some containers only for mux, only for demux, or for both

– Some codecs only for codec, only for decodec, or for both

11 11FFmpeg and Libav

Transcoding process

12 12FFmpeg and Libav

Some supportedFormats and Codecs

13 13FFmpeg and Libav

Laws

● Some codecs are patented● Are there software patents? Yes in USA, not in

UE,...● And if the codecs' terms forbid reverse

engineering? Allowed in some countries for interoperability

14 14FFmpeg and Libav

Example: “Extra” Libav librariesin Debian and Ubuntu

● Unrestricted functionality related to patents, e.g. libavcodec-extra-53:– OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band (Encoder/Decoder)– OpenCORE Adaptive Multi-Rate (AMR) Wide-Band (Decoder)– Android VisualOn AAC (Encoder)– Android VisualOn Adaptive Multi-Rate (AMR) Wide-Band (Encoder)– OpenCV filtering– Dirac decoding support via libdirac– MP3 encoding with liblame– H.264 encoding via libx264– MPEG4 Part 2 encoding via libxvidcore– JPEG 2000 format managing

15 15FFmpeg and Libav

Supported protocols

Protocol Input Output

file, pipe X X

tcp, udp X X

tls X X

http, httpproxy, https

X X

rtmp, rtp X X

applehttpconcatcryptommsh, mmst

X

md5 X

gopher X X

16 16FFmpeg and Libav

Au

dio

Lin

ux

Vid

eo

Lin

ux

Oth

ers

Supported devices

Input

ALSA OSSPulseaudio JACK

Video4Linux2

DV 1394

Framebuffer

BKTR

X11 grabbing

Input/Output

VfW capture

LIBCDIO

LIBDC1394

sndio

17 17FFmpeg and Libav

Some uses

● Video and audio grabbing● Convert formats and codecs (audio, video, from images to

video and viceversa● Mux, demux, copy, dump, delete streams● Change bit rate and frame rate● Filters:

– Without decoding: bitstream filters– Decoding. Connected filters (sources, sinks,...)

18 18FFmpeg and Libav

Some uses of advanced filtersfor audio

● Trim and split● Mix in one or distinct channels

Example: convert 6 sources to 5.1● Separate channels● Change volume● ...

19 19FFmpeg and Libav

Some uses of advanced filtersfor video

● Geometric: crop, flip, scale, pad● Time: overlay, split, trim● Deinterlace● Draw box or text, fade, negate,...● ...