Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How to install MPD filter "ffmpeg" into MPD running on RaspberryPi [closed]
13 mai, par Weston MitchellI’m using Moode audio player OS on a Raspberry Pi 5 to play audio through two USB devices: headphones (card 3: Device_1) for the full spectrum and a subwoofer (card 0: Device) for low frequencies (20–100Hz) in a meditation lounge setup. The audio source is a NAS on a Mac. My goal is simultaneous playback: headphones in stereo, subwoofer in mono with low-pass filtering. I have configured the mpd.conf file to setup audio ouputs for both devices. Now I need to apply a lowpass filter to the subwoofer device. I tried using MDP's "ffmpeg" as a lowpass filter, but the logs say:
Failed to initialize filter chain for "Subwoofer": No such filter plugin: ffmpeg
So I checked MPD's list of filters using
mpd --version
and it shows only one filter:Decoder plugins:
[mpg123] mp3
[mad] mp3 mp2
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[opus] opus ogg oga
[dsdiff] dff
[dsf] dsf
[faad] aac
[wavpack] wv
[adplug] amd d00 hsc laa rad raw sa2
[ffmpeg] 264 265 ...Filters:
soxrTag plugins:
id3tag...
So it's listed as a Decoder, but not a as a filter. MPD docs says it can be used as a filter: MPD Docs - Filters
So how do I add the ffmpeg to the list of filters?
-
Flutter ffmpeg_kit_flutter_new can't build Android app in any version
13 mai, par user31929I can't build my project on Android ( on Ios it works and the project itself without ffmpeg_kit_flutter_new builds without problems ) This is the error i obtain:
/GeneratedPluginRegistrant.java:51: error: cannot find symbol com.antonkarpenko.ffmpegkit.MainActivity.registerWith(shimPluginRegistry.registrarFor("com.antonkarpenko.ffmpegkit.MainActivity")); ^ symbol: class MainActivity location: package com.antonkarpenko.ffmpegkit
This is my flutter doctor :
[✓] Flutter (Channel stable, 3.19.4, on macOS 15.4.1 24E263 darwin-x64, locale it-IT) • Flutter version 3.19.4 on channel stable at …. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 68bfaea224 (1 year, 2 months ago), 2024-03-20 15:36:31 -0700 • Engine revision a5c24f538d • Dart version 3.3.2 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at ….. • Platform android-35, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 16.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16E140 • CocoaPods version 1.16.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) [✓] VS Code (version 1.99.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.110.0 [✓] Connected device (5 available) • SM A135F (mobile) • RF8T40TMS6Z • android-arm • Android 12 (API 31) • cri SE 128 (mobile) • 00008030-001268303E38402E • ios • iOS 18.4.1 22E252 • iPhone di WacMini (mobile) • 00008030-00121D543CE8802E • ios • iOS 18.4.1 22E252 • macOS (desktop) • macos • darwin-x64 • macOS 15.4.1 24E263 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 136.0.7103.93 [✓] Network resources • All expected network resources are available.
My android/app/build.gradle
def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'org.jetbrains.kotlin.android' android { compileSdkVersion 35 namespace = "com.app.app" sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { applicationId "com.appid.appid" minSdkVersion 24 targetSdkVersion 35 versionCode flutterVersionCode.toInteger() versionName flutterVersionName // insert this line of code in order to manage correct build abi configuration only on supported devices not supported tablet device emulator /* ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' }*/ } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } buildTypes { debug { debuggable true } release { signingConfig signingConfigs.release debuggable false shrinkResources true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.24" }
My android/build.gradle
buildscript { ext.kotlin_version = '1.9.24' repositories { google() mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:8.4.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.14' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' } } allprojects { repositories { google() mavenCentral() jcenter() } subprojects { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { kotlinOptions.jvmTarget = "1.8" } afterEvaluate { project -> if (project.hasProperty('android')) { project.android { if (namespace == null) { namespace project.group } } } } } } ext { flutterFFmpegPackage = "min-gpl-lts" } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir }
My gradle.wrapper.properties
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
What i have already tried :
- flutter clean/flutter pub get
- remove .gradle folder/flutter clean/flutter pub get
- remove GeneratedPluginRegistrant.java file then remove .gradle/flutter clean/flutter pub get
I have this issue in every version of the plugin. There is something wrong in my configurations or maybe this is a plugin issue ?
-
FFMPEG subtitle only apply if the first subtitle in the source is default
13 mai, par the_hornestI'm trying to create a batch script that should contain the following properties. Search for all MKV files in the folder and create a new MKV file with the same file name in another folder.
The video track should be copied. The first audio track should be recreated with specific properties. The first subtitle track, if present, should only be copied if it is flagged by default. Everything else should be ignored.
Here is my code created so far.
FOR /F "tokens=*" %%G IN ('dir /b *.mkv') DO "D:\Progs\ffmpeg\bin\ffmpeg.exe" -i "%%G" -map 0:v:0 -map 0:a:0 -map 0:s:0? -c:v copy -c:a eac3 -b:a 640k -ar 48000 -c:s copy "E:\%%~nG.mkv"
So far everything works great, but I can't find a command for copying only the subtitle with the default flag. It would be great if someone could help me with this.
-
v4l2loopback+ffmpeg input for uvc gadget
13 mai, par MosiI'm trying to use an MP4 video file as the input for a UVC Gadget setup on my Raspberry Pi 4 Model B, but I'm running into an issue when streaming through V4L2.
Goal:
To emulate a webcam that streams a looping MP4 video file to a Windows 11 host.
My setup:
- Hardware: Raspberry Pi 4 Model B
- OS: Raspberry Pi OS Lite 64-bit (
2025-05-06-raspios-bookworm-arm64-lite
) - Kernel:
6.12.25+rpt-rpi-v8
- Host System: Windows 11
- UVC Gadget version:
v0.3.0
Workflow:
[MP4 Video] → [FFmpeg] → [V4L2 Loopback] → [UVC Gadget] → Windows sees virtual webcam
What works:
The UVC Gadget works perfectly when I use a real webcam as the source (e.g.,
/dev/video0
). Windows detects the virtual webcam and displays a smooth video stream.The problem:
When I try to use an MP4 video file through FFmpeg and send it to the loopback device (
/dev/video3
), the UVC Gadget fails with the following error:
Command I'm using:
ffmpeg -re -stream_loop -1 -i input.mp4 -vf scale=640:480 \ -c:v rawvideo -pix_fmt yuyv422 -r 30 -f v4l2 /dev/video3
Then I run:
sudo uvc-gadget -d /dev/video3 uvc.0
Output:
bRequestType 21 bRequest 01 wValue 0200 wIndex 0001 wLength 0022 streaming request (req SET_CUR cs 02) setting commit control, length = 34 Setting format to 0x56595559 640x480 === Setting frame rate to 30 fps Starting video stream. --> [At this point I open the camera on the Windows host] /dev/video3: 2 buffers requested. Failed to export buffer 0. Failed to export buffers on source: Inappropriate ioctl for device (25)
Things I've tried:
- Multiple FFmpeg formats, resolutions, and pixel formats
- Various
ffmpeg
buffer and framerate tweaks - Different UVC Gadget versions
- GitHub related projects (
showcamera
, etc.) - Older Raspberry Pi OS versions
Most guides and GitHub projects I found are outdated (5+ years old), and newer methods seem undocumented or incompatible with current kernel/UVC gadget tools.
My question:
How can I stream an MP4 file as a virtual webcam using UVC Gadget without getting ioctl errors?
Is there a proper way to set up FFmpeg and loopback devices so that UVC Gadget can read the stream correctly?Any modern working example or tips would be very appreciated. Thanks in advance!
-
How to correct aspect ratio - ffmpeg poisoned video
13 mai, par Kurt FitznerI have a video that I converted from the original in a way that seems to have poisoned my aspect ratio. The intended aspect ratio is 12:5 (2.4.:1) at 1920x800.
The video was created with:
ffmpeg -analyzeduration 1000000000 -probesize 100G -loglevel warning -stats -hwaccel cuda \ -hwaccel_output_format cuda -y -i "UHDSOURCE.mkv" -map 0:v? -c:v hevc_nvenc \ -preset p7 -2pass true -multipass fullres -rc vbr -rc-lookahead 55 -b:v 1000k -minrate 0 -maxrate 3000k \ -bufsize 120000k -vf crop=3840:1600:0:280,scale_cuda=1920:800 -metadata title="HDDEST" \ -map 0:a:2 -c:a:0 aac -b:a:0 160k -map 0:a:4 -c:a:1 aac -b:a:1 96k \ -map 0:s? -c:s copy -map_metadata 0 "HDDEST.mkv"
The original was 16:9 letterboxed, and the above command seems to have decided the PAR should reflect that. The result is a video with:
Stream #0:0(eng): Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 1920x800 [SAR 20:27 DAR 16:9], SAR 27:20 DAR 81:25, 23.98 fps, 23.98 tbr, 1k tbn (default)
I can get halfway to fixing this with:
ffmpeg -i HDDEST.mkv -aspect 12:5 -c copy HDDEST_ASPECT.mkv
But the resultant video still shows two different SAR and DARs. Some players use one, some players insist on the 16:9, though:
Stream #0:0[0x1](eng): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 1920x800 [SAR 20:27 DAR 16:9], 1072 kb/s, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 16k tbn, Start 0.021000 (default)
Q1: What are the two aspect ratio displays? I think one of them is the file globally and one of them is the stream, but can get no clear answer
Q2: How to correct this without re-encoding? The disc this came from was damaged when my burner was knocked off the table.