缩放视频后,它将透明背景转换为白色

时间:2017-03-08 04:55:31

标签: android video ffmpeg video-editing

我使用ffmpeg缩放视频。当我缩放视频时,输出视频具有白色背景,而输入视频具有透明背景。 以下命令用于缩放视频。

ffmpeg -i inputVideo.mp4 -vf scale = 100:100 outputVideo.mp4

您可以在我的视频中看到下面的图片,以便更好地了解我的问题。

来自输入视频的图像 enter image description here

您可以从没有白色背景的输入视频中看到上面的图像。

输出视频中的

图像 enter image description here

您可以从具有白色背景的输出视频中看到上面的图像。

请就这个问题向我提出宝贵的答案。 任何答案都将非常感谢。D: onProgress: configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags= D: onProgress: libavutil 55. 17.103 / 55. 17.103 D: onProgress: libavcodec 57. 24.102 / 57. 24.102 D: onProgress: libavformat 57. 25.100 / 57. 25.100 D: onProgress: libavdevice 57. 0.101 / 57. 0.101 D: onProgress: libavfilter 6. 31.100 / 6. 31.100 D: onProgress: libswscale 4. 0.100 / 4. 0.100 D: onProgress: libswresample 2. 0.101 / 2. 0.101 D: onProgress: libpostproc 54. 0.100 / 54. 0.100 D: onProgress: Input #0, gif, from '/storage/emulated/0/Pictures/eye.gif': D: onProgress: Duration: N/A, bitrate: N/A D: onProgress: Stream #0:0: Video: gif, bgra, 480x190, 5 fps, 10 tbr, 100 tbn, 100 tbc D: onProgress: Output #0, gif, to '/storage/emulated/0/GIF/REV20170308_101145.gif': D: onProgress: Metadata: D: onProgress: encoder : Lavf57.25.100 D: onProgress: Stream #0:0: Video: gif, bgr8, 125x56, q=2-31, 200 kb/s, 10 fps, 100 tbn, 10 tbc D: onProgress: Metadata: D: onProgress: encoder : Lavc57.24.102 gif D: onProgress: Stream mapping: D: onProgress: Stream #0:0 -> #0:0 (gif (native) -> gif (native)) D: onProgress: Press [q] to stop, [?] for help D: onProgress: frame= 11 fps=0.0 q=-0.0 Lsize= 17kB time=00:00:02.90 bitrate= 48.8kbits/s speed=14.8x
D: onProgress: video:16kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.287261% D: Started command : ffmpeg [Ljava.lang.String;@422f62d0 D: onSuccess: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (GCC) configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/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.100 Input #0, gif, from '/storage/emulated/0/Pictures/eye.gif': Duration: N/A, bitrate: N/A Stream #0:0: Video: gif, bgra, 480x190, 5 fps, 10 tbr, 100 tbn, 100 tbc Output #0, gif, to '/storage/emulated/0/GIF/REV20170308_101145.gif': Metadata: encoder : Lavf57.25.100 Stream #0:0: Video: gif, bgr8, 125x56, q=2-31, 200 kb/s, 10 fps, 100 tbn, 10 tbc Metadata: encoder : Lavc57.24.102 gif Stream mapping: Stream #0:0 -> #0:0 (gif (native) -> gif (native)) Press [q] to stop, [?] for help frame= 11 fps=0.0 q=-0.0 Lsize= 17kB time=00:00:02.90 bitrate= 48.8kbits/s speed=14.8x
video:16kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.287261%

1 个答案:

答案 0 :(得分:0)

尝试添加-gifflags transdiff,所以

ffmpeg -i in.gif -gifflags transdiff out.gif

您必须添加所有其他过滤器&你需要的参数。