
Recherche avancée
Médias (1)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (61)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (8863)
-
Mix additional audio file with video(+audio) in ffmpeg
21 mai 2019, par SergI’m trying to mix additional audio file with video which has also audio within. But the problem is that I already have complex ffmpeg command and don’t know how to combine them together.
This is my existing ffmpeg command which uses some offsets and replaces additional audio file with embedded one (audio inside video) and also overlays few gauges and watermark to the video.
ffmpeg -y
-ss 00:00:01:213 -i videoFile.mp4
-ss 00:00:03:435 -i audioFile.wav
-i watermark.png
-framerate 6 -i gauge1_path/img-%04d.png
-framerate 1 -i gauge2_path/img-%04d.png
-framerate 2 -i gauge3_path/img-%04d.png
-framerate 2 -i gauge4_path/img-%04d.png
-framerate 2 -i gauge5_path/img-%04d.png
-framerate 2 -i gauge6_path/img-%04d.png
-filter_complex [0][2]overlay=(21):(H-h-21)[ovr0];
[ovr0][3]overlay=(W-w-21):(H-h-21)[ovr1];
[ovr1][4]overlay=(W-w-21):(H-h-333)[ovr2];
[ovr2][5]overlay=(W-w-21):(H-h-418)[ovr3];
[ovr3][6]overlay=(W-w-21):(H-h-503)[ovr4];
[ovr4][7]overlay=(W-w-21):(H-h-588)[ovr5];
[ovr5][8]overlay=(W-w-21):(H-h-673)
-map 0:v -map 1:a -c:v libx264 -preset ultrafast -crf 23 -t 00:5:10:000 output.mp4Now I would like to use
ffmpeg's amix
in order to mix both audios instead of replacing them, if possible with ability to set volumes. But official documentation amix says nothing about volume.Separately both seems to work ok.
ffmpeg -y -i video.mp4 -i audio.mp3 -filter_complex [0][1]amix=inputs=2[a] -map 0:v -map [a] -c:v copy output.mp4
and
ffmpeg -y -i video.mp4 -i audio.mp3 -i watermark.png -filter_complex [0][2]overlay=(21):(H-h-21)[ovr0] -map [ovr0]:v -map 1:a -c:v libx264 -preset ultrafast -crf 23 output.mp4
but together
ffmpeg -y -i video.mp4 -i audio.mp3 -i watermark.png -filter_complex [0][1]amix=inputs=2[a];[a][2]overlay=(21):(H-h-21)[ovr0] -map [ovr0]:v -map [a] -c:v libx264 -preset ultrafast -crf 23 output.mp4
I’m getting an error :
ffmpeg version N-93886-gfbdb3aa179 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.3.1 (GCC) 20190414
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 28.100 / 56. 28.100
libavcodec 58. 52.101 / 58. 52.101
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 53.101 / 7. 53.101
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01T00:00:00.000000Z
encoder : Lavf53.24.2
Duration: 00:00:29.57, start: 0.000000, bitrate: 1421 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1032 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : SoundHandler
[mp3 @ 0000015e2f934ec0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio.mp3':
Duration: 00:00:45.33, start: 0.000000, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Input #2, png_pipe, from 'watermark.png':
Duration: N/A, bitrate: N/A
Stream #2:0: Video: png, rgb24(pc), 100x56 [SAR 3779:3779 DAR 25:14], 25 tbr, 25 tbn, 25 tbc
[Parsed_amix_0 @ 0000015e2ff2e940] Media type mismatch between the 'Parsed_amix_0' filter output pad 0 (audio) and the 'Parsed_overlay_1' filter input pad 0 (video)
[AVFilterGraph @ 0000015e2f91c600] Cannot create the link amix:0 -> overlay:0
Error initializing complex filters.
Invalid argumentSo my question : whether it’s possible to combine
amix
andoverlay
together and how and in which order they should be used ? Or should I look something different becauseamix
unable to set volume levels ?Thanks in advance !
-
ffmpeg trouble with NetMaui and Android [closed]
15 juin 2024, par Billy VanegasI find myself in a following predicament. While I work with Visual Studio 2022, ffmpeg performs flawlessly on Windows platform. However, I'm encountering difficulties when attempting to replicate this functionality on Android. Despite exploring NuGet packages like FFMpegCore, which seem to be ffmpeg wrappers but lack ffmpeg itself, I'm still struggling to find a clear path forward. I've even tried integrating ffmpeg-kit for Android as per the instructions, only to face repeated failures and a sense of confusion. I must admit my puzzlement : why isn't there a straightforward method to seamlessly add ffmpeg to a .NET MAUI project that functions consistently across both iOS and Android platforms ?


I want to convert MP3 files to WAV format using FFmpeg on the Android platform within a .NET MAUI project.


I am using the FFmpegCore library and have downloaded the FFmpeg binaries from the official FFmpeg website. However, I encountered issues when attempting to pass the binary folder on the emulator, when I try to pass it, I get
permission denied
in working folder :
/data/user/0/com.companyname.projectname/files/ffmpeg
on this part of code :

await FFMpegArguments
 .FromFileInput(mp3Path)
 .OutputToFile(wavPath, true, options => options
 .WithAudioCodec("pcm_s16le")
 .WithAudioSamplingRate(44100)
 .WithAudioBitrate(320000)
 )
 .ProcessAsynchronously();



This is the
AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest>
 <application></application>
 
 
 
 
</manifest>



private async Task ConvertMp3ToWav(string mp3Path, string wavPath)
 {
 try
 {
 var directory = Path.GetDirectoryName(wavPath);
 if (!Directory.Exists(directory))
 Directory.CreateDirectory(directory!);
 if (!File.Exists(wavPath))
 Console.WriteLine($"File not found {wavPath}, creating empty file.");
 using var fs = new FileStream(wavPath, FileMode.CreateNew);
 if (!File.Exists(mp3Path))
 Console.WriteLine($"File not found {mp3Path}");

 string? ffmpegBinaryPath = await ExtractFFmpegBinaries(Platform.AppContext);
 FFMpegCore.GlobalFFOptions.Configure(new FFOptions { BinaryFolder = Path.GetDirectoryName(ffmpegBinaryPath!)! });

 await FFMpegArguments
 .FromFileInput(mp3Path)
 .OutputToFile(wavPath, true, options => options
 .WithAudioCodec("pcm_s16le")
 .WithAudioSamplingRate(44100)
 .WithAudioBitrate(320000)
 )
 .ProcessAsynchronously();
 }
 catch (Exception ex)
 {
 Console.WriteLine($"An error occurred during the conversion process: {ex.Message}");
 throw;
 }
 }



private async Task<string> ExtractFFmpegBinaries(Context context)
 {
 var architectureFolder = "x86"; // "armeabi-v7a";
 var ffmpegBinaryName = "ffmpeg"; 
 var ffmpegBinaryPath = Path.Combine(context.FilesDir!.AbsolutePath, ffmpegBinaryName);
 var tempFFMpegFileName = Path.Combine(FileSystem.AppDataDirectory, ffmpegBinaryName);

 if (!File.Exists(ffmpegBinaryPath))
 {
 try
 {
 var assetPath = $"Libs/{architectureFolder}/{ffmpegBinaryName}";
 using var assetStream = context.Assets!.Open(assetPath);
 
 await using var tempFFMpegFile = File.OpenWrite(tempFFMpegFileName);
 await assetStream.CopyToAsync(tempFFMpegFile);

 //new MainActivity().RequestStoragePermission();
 Java.Lang.Runtime.GetRuntime()!.Exec($"chmod 755 {tempFFMpegFileName}");
 }
 catch (Exception ex)
 {
 Console.WriteLine($"An error occurred while extracting FFmpeg binaries: {ex.Message}");
 throw;
 }
 }
 else
 {
 Console.WriteLine($"FFmpeg binaries already extracted to: {ffmpegBinaryPath}");
 }

 return tempFFMpegFileName!;
 }
</string>


-
Problems with Python's azure.cognitiveservices.speech when installing together with FFmpeg in a Linux web app
15 mai 2024, par Kakobo kakoboI need some help.
I'm building an web app that takes any audio format, converts into a .wav file and then passes it to 'azure.cognitiveservices.speech' for transcription.I'm building the web app via a container Dockerfile as I need to install ffmpeg to be able to convert non ".wav" audio files to ".wav" (as azure speech services only process wav files). For some odd reason, the 'speechsdk' class of 'azure.cognitiveservices.speech' fails to work when I install ffmpeg in the web app. The class works perfectly fine when I install it without ffpmeg or when i build and run the container in my machine.


I have placed debug print statements in the code. I can see the class initiating, for some reason it does not buffer in the same when when running it locally in my machine. The routine simply stops without any reason.


Has anybody experienced a similar issue with azure.cognitiveservices.speech conflicting with ffmpeg ?


Here's my Dockerfile :


# Use an official Python runtime as a parent imageFROM python:3.11-slim

#Version RunRUN echo "Version Run 1..."

Install ffmpeg

RUN apt-get update && apt-get install -y ffmpeg && # Ensure ffmpeg is executablechmod a+rx /usr/bin/ffmpeg && # Clean up the apt cache by removing /var/lib/apt/lists saves spaceapt-get clean && rm -rf /var/lib/apt/lists/*

//Set the working directory in the container

WORKDIR /app

//Copy the current directory contents into the container at /app

COPY . /app

//Install any needed packages specified in requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

//Make port 80 available to the world outside this container

EXPOSE 8000

//Define environment variable

ENV NAME World

//Run main.py when the container launches

CMD ["streamlit", "run", "main.py", "--server.port", "8000", "--server.address", "0.0.0.0"]`and here's my python code:



def transcribe_audio_continuous_old(temp_dir, audio_file, language):
 speech_key = azure_speech_key
 service_region = azure_speech_region

 time.sleep(5)
 print(f"DEBUG TIME BEFORE speechconfig")

 ran = generate_random_string(length=5)
 temp_file = f"transcript_key_{ran}.txt"
 output_text_file = os.path.join(temp_dir, temp_file)
 speech_recognition_language = set_language_to_speech_code(language)
 
 speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
 speech_config.speech_recognition_language = speech_recognition_language
 audio_input = speechsdk.AudioConfig(filename=os.path.join(temp_dir, audio_file))
 
 speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_input, language=speech_recognition_language)
 done = False
 transcript_contents = ""

 time.sleep(5)
 print(f"DEBUG TIME AFTER speechconfig")
 print(f"DEBUG FIle about to be passed {audio_file}")

 try:
 with open(output_text_file, "w", encoding=encoding) as file:
 def recognized_callback(evt):
 print("Start continuous recognition callback.")
 print(f"Recognized: {evt.result.text}")
 file.write(evt.result.text + "\n")
 nonlocal transcript_contents
 transcript_contents += evt.result.text + "\n"

 def stop_cb(evt):
 print("Stopping continuous recognition callback.")
 print(f"Event type: {evt}")
 speech_recognizer.stop_continuous_recognition()
 nonlocal done
 done = True
 
 def canceled_cb(evt):
 print(f"Recognition canceled: {evt.reason}")
 if evt.reason == speechsdk.CancellationReason.Error:
 print(f"Cancellation error: {evt.error_details}")
 nonlocal done
 done = True

 speech_recognizer.recognized.connect(recognized_callback)
 speech_recognizer.session_stopped.connect(stop_cb)
 speech_recognizer.canceled.connect(canceled_cb)

 speech_recognizer.start_continuous_recognition()
 while not done:
 time.sleep(1)
 print("DEBUG LOOPING TRANSCRIPT")

 except Exception as e:
 print(f"An error occurred: {e}")

 print("DEBUG DONE TRANSCRIPT")

 return temp_file, transcript_contents



The transcript this callback works fine locally, or when installed without ffmpeg in the linux web app. Not sure why it conflicts with ffmpeg when installed via container dockerfile. The code section that fails can me found on note #NOTE DEBUG"