Category Archives: ffmpeg

FFMpeg Benchmark – Effect of Threads and Bitrate on Image Quality

 

If you have been following along, we have recently been doing a series on command line video tools. Here I review a recent ffmpeg benchmark I performed. After reviewing the documentation and encoding a few sample videos, my questions were as follows:

  • How long does each of the various ffmpeg preset take for h264 encoding?
  • How much faster is the encoding with multiple threads?
  • For a given variable bitrate, does a given preset make a difference in image quality?
  • What is the optimal preset for ffmpeg?

 

Read more at http://gentoovps.net/ffmpeg-benchmark-threads-bitrate/

 

Open-Sourced H.264 Removes Barriers to WebRTC

When it comes to making collaboration technology such as high-definition video open and broadly available, it’s clear that the web browser plays an important role. The question is, how do you enable real-time video natively on the Web? It’s a question that folks are anxious to have answered.

WebRTC–a set of enhancements to HTML5–will address the issue head on. But, there is an important hurdle that must first be cleared, and that’s standardizing on a common video codec for real-time communications on the web – something the Internet Engineering Task Force (IETF) will decide next week.

The industry has been divided on the choice of a common video codec for some time, namely because the industry standard–H.264–requires royalty payments to MPEG LA. Today, I am pleased to announce Cisco is making a bold move to take concerns about these payments off the table.

We plan to open-source our H.264 codec, and to provide it as a binary module that can be downloaded for free from the Internet. Cisco will not pass on our MPEG LA licensing costs for this module, and based on the current licensing environment, this will effectively make H.264 free for use in WebRTC.
Read more: http://blogs.cisco.com/collaboration/open-source-h-264-removes-barriers-webrtc

zencoder – what do they use…

 

  • aspera

Alternatives

Only encoding/transcoding
Encoding, hosting and video players

ffmpeg – watermark positions

This are the command lines that I use to add the watermark picture named watermark.png on the video named source.avi and export to output.flv.

Tested on a DigitalOcean Virtual server! 😉

rock ssd

The 10 values are the paddings!

Top left
ffmpeg –i source.avi -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" output.flv

Top right
ffmpeg –i source.avi -vf "movie=watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" output.flv

Bottom left
ffmpeg –i source.avi -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" output.flv

Bottom right
ffmpeg –i source.avi -vf "movie=watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" output.flv

Center?
ffmpeg –i source.avi -vf “movie=watermark.png [watermark]; [in][watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2 [out]” output.flv

 

UPDATE

If you get this error…

[NULL @ 0x45fd680] Unable to find a suitable output format for '–i'
–i: Invalid argument

try something like…

ffmpeg -i 'video-source.mp4' -i /watermark/path/image.png -filter_complex "overlay=main_w-overlay_w-10:main_h-overlay_h-10" -c:v libx264 -vsync 2 -strict -2 /output/video.mp4

A bunch of ffmpeg tutorials

https://wiki.archlinux.org/index.php/FFmpeg

 

 

YouTube Downloader Site
http://www.youtubedownloadersite.com/help.html
Iphone Video (MPEG-4 MP4) 

ffmpeg -i %1 -vcodec mpeg4 -s 480×320 -r 29 -b 900k -ar 44100 -ab 96k -ac 2 %1.mp4

ffmpeg -i %1 -vcodec mpeg4 -qscale 15 -s 480×320 -r 29 -b 900k -ar 44100 -ab 96k -ac 2 %1.mp4

ffmpeg -i %1 -vcodec mpeg4 -qscale 7 -s 480×320 -r 29 -b 900k -ar 44100 -ab 128k -ac 2 %1.mp4

ffmpeg -i %1 -vcodec mpeg4 -qscale 1 -s 640×480 -r 29 -b 1500k -ar 44100 -ab 128k -ac 2 %1.mp4

 

ffmpeg image thumbnail every minute, seconds… the math!

 

This will create one thumbnail image every minute, named img001.jpg, img002.jpg, img003.jpg, … (%03d means that ordinal number of each thumbnail image should be formatted using 3 digits)

ffmpeg -i myvideo.avi -f image2 -vf fps=fps=1/60 img%03d.jpg

This will create one thumbnail image every 10 minutes, named thumb0001.bmp, thumb0002.bmp, thumb0003.bmp, …

ffmpeg -i test.flv -f image2 -vf fps=fps=1/600 thumb%04d.bmp

This will create one thumbnail image every I-frame, named thumb0001.bmp, thumb0002.bmp, thumb0003.bmp, …

https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video

So, we can use some logical/math to make some conclusions…
1/60 stands for 1 thumb at each 60 seconds,  the same as say each minute…
1/600 stands for 1 thumb at each 60 seconds * 10, the same as say each 10 minutes…

if we want a thumb at each 2 minutes we should multiply the 60 per 2, that will gives us 1/120… this way we can also assume that if we want a thumb at each 4 seconds, we can use 1/4.

Useful link
https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video

pre-configurated of output dimensions on ffmpeg

Some pre-configurations of output dimensions on ffmpeg.

ffmpeg -i source.ext -r 1 -s 4cif -f image2 img%5d.jpg

This will produce you pictures with 704 width * 576 height

sqcif 128×96 qcif 176×144 cif 352×288
4cif 704×576 qqvga 160×120 qvga 320×240
vga 640×480 svga 800×600 xga 1024×768
uxga 1600×1200 qxga 2048×1536 sxga 1280×1024
qsxga 2560×2048 hsxga 5120×4096 wvga 852×480
wxga 1366×768 wsxga 1600×1024 wuxga 1920×1200
woxga 2560×1600 wqsxga 3200×2048 wquxga 3840×2400
whsxga 6400×4096 whuxga 7680×4800 cga 320×200
hd480 852×480 hd720 1280×720 hd1080 1920×1080

Some interesting readings for this weekend

 

Best Practice: vCPUs per physical core 

http://serverfault.com/questions/504626/best-practice-vcpus-per-physical-core

Compile FFmpeg on Ubuntu, Debian, or Mint

http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

FFmpeg Installation for Ubuntu

http://wiki.razuna.com/display/ecp/FFmpeg+Installation+for+Ubuntu

How to install all existing media codecs?

http://askubuntu.com/questions/171026/how-to-install-all-existing-media-codecs

OpenVZ on Ubuntu 12.04 (experimental)

http://www.janoszen.com/2013/06/04/openvz-on-ubuntu-12-04-experimental/