I need a ffmpeg command that works with every video (with audio) format / type to encode it to h264 mp4. The output may have a maximum width of 800px and a maximum height of 800px. It would also be necesary to add a watermark in to bottom right corner... Is there a way to get all those things done with a single command line? Even if it's WMV, MOV, 3gp and whatever filetype is beeing used?
Use
ffmpeg -i video -i watermark
-filter_complex "[0]scale=min(800,iw):min(800,ih):force_original_aspect_ratio=decrease,
scale=2*trunc(iw/2):2*trunc(ih/2)[v];
[v][1]overlay=x=W-w-10:y=H-h-10" output.mp4
The first scale filter fits the video to within a 800x800 canvas but proportionally. The 2nd scale filter makes sure that the video has even dimensions - required for standard H264 playback compatibility.
The image overlay is overlaid at bottom-right corner, offset by 10 pixels from both edges.