You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android端FFmpeg blend滤镜向下揭幕转场异常问题求助

Fixing Downward Curtain Transition with FFmpeg on Samsung S4 (Android 4.4.2)

Let's break down your issue and work through a solution. Your downward curtain transition works perfectly on Windows but misbehaves on the Samsung S4 running Android 4.4.2, and the log hints at pixel format compatibility problems. Here's what's going wrong and how to fix it:

Key Clues from Your Log

The repeated warning is the main red flag:

[swscaler @ 0x438292b0] deprecated pixel format used, make sure you did set range correctly

Your input JPEGs are decoded as yuvj420p—a full-range YUV format that older Android frameworks (like 4.4.2) struggle to handle reliably. On top of that, your FFmpeg version (n3.0.1, 2016) has known quirks with expression handling and ARM device compatibility.

Revised FFmpeg Command (Fixed for Android)

I've adjusted your command to address these compatibility gaps. Here's the updated version:

ffmpeg -loop 1 -t 1 -r 24 -i img001.jpg \
-loop 1 -t 1 -r 24 -i img002.jpg \
-loop 1 -t 1 -r 24 -i img003.jpg \
-loop 1 -t 1 -r 24 -i img004.jpg \
-loop 1 -t 1 -r 24 -i img005.jpg \
-filter_complex "
[0:v]format=yuv420p[v0];
[1:v]format=yuv420p[v1];
[2:v]format=yuv420p[v2];
[3:v]format=yuv420p[v3];
[4:v]format=yuv420p[v4];
[v1][v0]blend=all_expr='if(lte(Y,(N*H)/24),A,B)'[b1v];
[v2][v1]blend=all_expr='if(lte(Y,(N*H)/24),A,B)'[b2v];
[v3][v2]blend=all_expr='if(lte(Y,(N*H)/24),A,B)'[b3v];
[v4][v3]blend=all_expr='if(lte(Y,(N*H)/24),A,B)'[b4v];
[v0][b1v][v1][b2v][v2][b3v][v3][b4v][v4]concat=n=9:v=1:a=0,format=yuv420p[v]
" -map "[v]" -c:v libx264 -profile:v baseline -level 3.0 out_cover_top.mp4 -y

What Changed & Why

  1. Standardized Pixel Format

    • Added format=yuv420p to each input stream. This converts the deprecated yuvj420p format to limited-range YUV420p, which Android 4.4.2 handles consistently. This eliminates the swscaler warnings and ensures uniform pixel data throughout the pipeline.
  2. Stable Integer Arithmetic in Blend Expression

    • Modified N*H/24 to (N*H)/24. Older FFmpeg builds on ARM have floating-point precision issues; wrapping the multiplication in parentheses forces integer math, making the Y-coordinate threshold calculation accurate for every frame of the transition.
  3. Android-Optimized Encoding

    • Added -c:v libx264 -profile:v baseline -level 3.0. The Samsung S4 natively supports H.264 Baseline Profile (Level 3.0), so this ensures the output video plays smoothly without decoding errors.
  4. Consistent Frame Rate

    • Added -r 24 to each input. This aligns the frame rate with your transition logic (24 frames per 1-second slide), so the N variable in the blend expression maps exactly to the number of frames, making the animation smooth and predictable.

Extra Troubleshooting Tips

If you still run into issues:

  • Update FFmpeg: Version 3.0.1 is outdated. Compile a newer static build (e.g., 4.4+ with ARM optimizations) — many filter and pixel format bugs have been fixed in later releases.
  • Verify Image Consistency: Double-check that all input images are the exact same size (your log shows 480x480, which is ideal — mismatched sizes can break blending logic).
  • Test with a Simplified Command: Try a two-image transition first to isolate the issue, then scale up to five images once that works.

内容的提问来源于stack exchange,提问作者tainguyen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:09:51