Search code examples
videoffmpegwatermarkvideo-watermarking

FFmpeg Commands to add text watermark to mpg2,mss,lxf,3g2 video files


I am using following command to add watermark on a video file:

ffmpeg -i input.mpg2 -vf "drawtext=text='Hello World':x=(w-text_w)/2:y=(h-text_h)/2:fontsize=24:fontcolor=white" TextOutput.mpg2

Error with mpg2 input file:

Input #0, mpeg, from 'mpg2.mpg2':
Duration: 00:02:27.07, start:0.213367, bitrate: 4419 kb/s Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg/bt470m/bt4 70m, bottom first), 704x480 [SAR 1:1 DAR 22:15], 29.97 fps, 29.97 tbr, 90k tbn,59.94 tbc Side data: cpb: bitrate max/min/avg: 6000000/0/0 buffer size: 1835008 vbv_delay: N/A Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16p, 224 kb/s [NULL @ 000000bd67d2b3c0] Unable to find a suitable output format for 'Output.mp g2' Output.mpg2: Invalid argument

Similar error occurs with mss, lxf and 3g2 video files. How can I add watermark to these video file formats?


Solution

  • FFmpeg does not support these arbitrary extensions/formats. Instead, use:

    Unsupported Supported equivalent
    .mpg2 -c:v mpeg2video output.mpg
    .mss .wmv
    .lxf Not supported (or use .mpg)
    .3g2 This is supported but is constrained to certain parameters. See below.

    3G2

    The output must be:

    • Mono audio with 8000 Hz sample rate. (Assuming you want AMR audio.)
    • One of the following audio bitrates: 4.75k, 5.15k, 5.90k, 6.70k, 7.40k, 7.95k, 10.20k, 12.20k, 12.20k (Assuming you want AMR audio.)
    • One of the following video sizes: 128x96, 176x144, 352x288, 704x576, and 1408x1152.

    If it fails then look at the error messages. They will tell you what is wrong.

    Example command:

    ffmpeg -i input.mp4 -ar 8000 -ac 1 -s 352x288 -b:a 10.2k output.3g2