AVCONV - video file conversion for video HTML5 tag and watermark overlay

Published on March 01, 2013

AVCONV - video file conversion for video HTML5 tag and watermark overlay

    For a good post habrahabr.ru/post/171213

    Some time ago, FFMPEG in Ubuntu announced non grata. As a replacement, a duplicate project is developing - AVCONV.

    The principle of operation is similar, but there are some minor differences.

    I’ll give an example of solving a popular problem - preparing videos for publication in the HTML5 video tag.

    1. Convert video from an arbitrary format to a set of FLV, MP4 and OGV
    2. Imposing watermark



    #!/bin/sh
    avconv -i $1 -vf "movie=$3 [wm];[in][wm] overlay=5:5 [out]" -ar 44100 -ab 128k -f flv -vcodec flv -vb 1000k $2.flv
    avconv -i $1 -vf "movie=$3 [wm];[in][wm] overlay=5:5 [out]" -ab 128k -vcodec libx264 -vb 1000k $2.mp4
    avconv -i $1 -vf "movie=$3 [wm];[in][wm] overlay=5:5 [out]" -ab 128k -vcodec libtheora -acodec libvorbis -vb 1000k $2.ogv
    


    1. Save to a file, for example encode.sh
    2. We give execution rights
    3. Calling by the principle ./encode.sh {FROM} {TO} {WATERMARK}


    Parameters
    {FROM} - full path to the source video
    {TO} - path to the result, without extension
    {WATERMARK} - full path to the watermark

    As a watermark, PNG reliably works with alpha.

    It can be modified in any way, at your discretion.

    It can be made a CMS function, but it is necessary to provide that the interpreter does not hang, waiting for the end of decoding. For PHP, it is solved by directing the output of the script to / dev / null. I will not give details, since a lot has already been written on this subject.