0

Using Xamarin and https://www.nuget.org/packages/Xamarin.Android.FFmpeg/

I am trying to vertically stitch an image on a video at bottom (not overlap), so that I have a banner running under video without affecting original video height.

The command I am running is (removed original path):

Command: ffmpeg -y -i /path/source.mp4 -i /path/share.jpg -filter_complex "[1:v]scale=640:-1[bottom];[0:v][bottom]vstack" /output/temp.mp4

But getting error like this:

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers  built with gcc 4.9.x (GCC) 20150123 (prerelease)  configuration: --target-os=linux --cross-prefix=/root/ffmpeg-android/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/ffmpeg-android/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --enable-hwaccels --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --disable-asm --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/root/ffmpeg-android/ffmpeg-android/ffmpeg-pkg-config --prefix=/root/ffmpeg-android/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/ffmpeg-android/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/ffmpeg-android/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=  libavutil      55. 17.103 / 55. 17.103  libavcodec     57. 24.102 / 57. 24.102  libavformat    57. 25.100 / 57. 25.100  libavdevice    57.  0.101 / 57.  0.101  libavfilter     6. 31.100 /  6. 31.100  libswscale      4.  0.100 /  4.  0.100  libswresample   2.  0.101 /  2.  0.101  libpostproc    54.  0.100 / 54.  0.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/source.mp4':  Metadata:    major_brand     : mp42    minor_version   : 0    compatible_brands: mp42isom  Duration: 00:00:06.00, start: 0.000000, bitrate: 697 kb/s    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x640, 694 kb/s, 30 fps, 30 tbr, 1000k tbn, 2000k tbc (default)[mjpeg @ 0xeb4e3800] Changing bps to 8Input #1, image2, from '/path/share.jpg':  Duration: 00:00:00.04, start: 0.000000, bitrate: 9064 kb/s    Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 534x123 [SAR 1:1 DAR 178:41], 25 tbr, 25 tbn, 25 tbc[swscaler @ 0xeb224000] deprecated pixel format used, make sure you did set range correctly[libx264 @ 0xeb4e4400] height not divisible by 2 (640x787)Output #0, mp4, to '/output/temp.mp4':  Metadata:    major_brand     : mp42    minor_version   : 0    compatible_brands: mp42isom    Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, 30 fps (default)    Metadata:      encoder         : Lavc57.24.102 libx264Stream mapping:  Stream #0:0 (h264) -> vstack:input0  Stream #1:0 (mjpeg) -> scale  vstack -> Stream #0:0 (libx264)Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Any idea what is going wrong in this command? (as I am very new to FFMpeg)

seopower
  • 127
  • 4
  • 14
  • 1
    The combined height is resulting in an odd value, but the encoder requires an even value. Change `scale=640:-1` to `scale=640:-2` or append the filterchain with pad, crop, or scale to ensure even output. There are dozens of answers here involving the same error: `height not divisible by 2`. – llogan May 21 '20 at 16:20
  • Thanks @llogan for your help. My problem is solved. – seopower May 22 '20 at 02:03

0 Answers0