
Recherche avancée
Autres articles (93)
-
Configuration spécifique pour PHP5
4 février 2011, parPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (6329)
-
Discord bot stops playing music at a certain iteration
3 mai 2023, par denisnumbI'm using the following code to play music in a discord voice channel :


import discord
import asyncio
from yt_dlp import YoutubeDL

YDL_OPTIONS = {
 'format': 'bestaudio/best', 
}

FFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 
 'options': '-vn'
}

bot = discord.Client(intents=discord.Intents.all())

async def get_source_url(url: str) -> str:
 with YoutubeDL(YDL_OPTIONS) as ydl:
 return ydl.extract_info(url, download=False).get('url')

@bot.slash_command(name='play')
async def __play(ctx, url: str) -> None:
 source = await get_source_url(url)
 vc = await ctx.author.voice.channel.connect()
 vc.play(discord.FFmpegPCMAudio(source=source, **FFMPEG_OPTIONS))

 while vc.is_playing() or vc.is_paused():
 await asyncio.sleep(1)

 await vc.disconnect()

bot.run('TOKEN')



The principle of operation is as follows :


- 

-
The
/play
command handler receives aurl
argument, in the form of a link to a live stream from YouTube : https://youtu.be/jfKfPfyJRdk (or any other video)

-
The link is passed to the
get_source_url
function, which, using theyt-dlp
library, returns a direct link to the sound from the video

-
The direct link is passed via
discord.FFmpegPCMAudio
to theffmpeg
program, which then returns audio bytes for transmission to the discord voice channel via thevc.play
method










Problem :


Bot is hosted on the virtual hosting server aeza, OS -
Ubuntu Server 22.04
. I installed theffmpeg
version4.4.2
with the commandsudo apt install ffmpeg
.

On the first day everything worked fine, but the next day the bot began to steadily stop playing music at the same moment in different videos (this moment is different for each video). Restarting the bot or server did not help.


Only reinstalling the operating system helps, but also only for one day.


Specific problem :


I checked the execution of every single line of the
discord.VoiceClient.play
method, including all methods called internally. It turned out that the bot hangs every time on the same iteration of the cycle of receiving and sending bytes. Namely, on the first line of thediscord.FFmpegPCMAudio.read
method, that is does not receive data fromffmpeg
and waits indefinitely.


Source of the problem :


The problem is not with a specific
ffmpeg
:

- 

- I also installed
ffmpeg
on another version5.1.2
and the problem was repeated on it.




The problem is not
Ubuntu Server
:

- 

- I changed OS
Ubuntu Server
toDebian 11
and it's the same there




The problem is not in
Linux
:

- 

- When I put the same OS on my virtual machine, everything worked fine with any version of
ffmpeg
.





So the problem is on the hosting side ? I asked those. support to change the server itself and the location of the location. Changed from Sweden to Germany - the same result.


If the data does not come from
ffmpeg
, then you need to find out what is wrong in the program itself. When calling, I pass the-loglevel debug
argument, which shows the most detailed report on the program's operation - all debugging information is displayed, but there are no errors on the "hung" iteration.

What could be the problem ?



UPD 03.05.2023 : I reinstalled OS Ubuntu Server again and the bot works now. But obviously not for long. Maybe I need to clear some cache ?


-
-
C# Windows Forms Using FFMPEG to change video format got no response
21 mai 2023, par TSLeeI am trying to make an exe program to change a video format by using FFMPEG instead of doing it in the terminal. The formatted video will be saved in the download folder. I have tried my code below and got no output response. I wonder if I used process() and StartInfo correctly, as examples I found and the documentation just confused me. I have double-checked the ffmpeg.exe is in the bin folder and the StartInfo() is just for getting information, which is under Process(). This is why Process() can access the information and use Start() to start the process. Please help and correct my understanding.
Below is part of my code :


private void convertButton_Click(object sender, EventArgs e)
 {
 String input = filepathTextBox.Text;
 String outputResolution = resolutionLabel.Text;
 String output;
 String outputFileType;
 int inputLength = input.Length;
 int l = 0;
 for (int i = (inputLength - 1); inputLength > -1; i--)
 {
 if (input[i] == '.')
 {
 l = i;
 break;
 }
 }
 output = input.Substring(0, l - 1);
 outputFileType = input.Substring(l + 1, inputLength - 1);
 Process process = new Process();
 process.StartInfo.UseShellExecute = true;
 process.StartInfo.FileName = "ffmpeg.exe";
 process.StartInfo.WorkingDirectory = @"C:\Users\User\Downloads\ffmpeg-2023-05-15-git-2953ebe7b6-full_build\bin";
 process.StartInfo.Arguments = "ffmpeg -i" + @"C:\Users\User\Downloads\file_example_MP4_640_3MG.mp4" + "-s 320x240 -r 25 -b:v 500000 -pix_fmt yuv420p -c:v libx264 -vprofile baseline -level 2.1 -x264opts stitchable=1:level=3.0:keyint=15:ref=1:merange=16:mvrange=32 -acodec pcm_s16le -ar 16000 -ac 1" + @"C:\Users\User\Downloads\440.mp4";
 process.Start();
 }



Output :
"myprogram.exe(CoreCLR : clrhost) : Loaded 'C :\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.15\System.Diagnostics.Process.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled."
The thread 0x79e0 has exited with code 0 (0x0).


-
/bin/sh : ffmpeg : command not found while merge audio with with using ffmpeg aws lamda [duplicate]
1er mai 2023, par bhavesh kailaI am trying to merge audio with video using the below command in AWS lambda using Python but the getting and below error.


ffmpeg Command


cmd = 'ffmpeg -stream_loop -1 -i mayur.mp4 -i audio.mp3 -shortest -map 0:v:0 -map 1:a:0 -y out/output.mp4'
subprocess.call(cmd, shell=True) 



Aws Lambda Error


2023-05-01T16:08:18.591+05:30 INIT_START Runtime Version: python:3.10.v2 Runtime Version ARN: arn:aws:lambda:eu-north-1::runtime:7764dc7f3ff1fc45718f596be4cd03d7bca223f0586f3bfa5fe6584d6af81cd8

2023-05-01T16:08:19.631+05:30 START RequestId: 4557a174-e12c-4924-971a-ef8f852b106b Version: $LATEST

2023-05-01T16:08:22.286+05:30

Copy
/bin/sh: ffmpeg: command not found
/bin/sh: ffmpeg: command not found

2023-05-01T16:08:23.926+05:30 [ERROR] FileNotFoundError: [Errno 2] No such file or directory: '/tmp/output.mp4' Traceback (most recent call last): File "/var/task/lambda_function.py", line 65, in lambda_handler s3_upload_response = s3.put_object(Bucket=bucket, Body=open('/tmp/output.mp4', 'rb'), Key =filename)

2023-05-01T16:08:23.929+05:30 END RequestId: 4557a174-e12c-4924-971a-ef8f852b106b



Full Code snippet


import json
from gtts import gTTS
import openpyxl
import boto3
import base64
import openai
import os
import random
import ffmpeg
import subprocess

# os.system("cp -ra bin/ffmpeg /tmp/")
# os.system("chmod -R 775 /tmp")

#from botocore.vendored import requests
language = 'en'
def lambda_handler(event, context):
 input1 = event["queryStringParameters"]['question']
 outputText=""
 
 # Define variable to load the dataframe
 dataframe = openpyxl.load_workbook('QNA/Book1.xlsx')
 
 #accesskey and secretkey for the S3 bucket
 accesskey = os.getenv("access_key")
 secretkey = os.getenv("secret_key")
 
 # Define variable to read sheet
 ws = dataframe['Sheet1']
 
 for row in ws.iter_rows(0,dataframe.active.max_row):
 for cell in row:
 #print(cell.value)
 if input1 in str(cell.value):
 outputText=row[1].value
 
 
 
 #Save Audio File
 audio = gTTS(text=outputText, lang=language, slow=False)
 audio.save("/tmp/audio.mp3")
 
 cmd='ffmpeg -stream_loop -1 -i QNA/mayur.mp4 -i tmp/audio.mp3 -shortest -map 0:v:0 -map 1:a:0 -y tmp/output.mp4'
 subprocess.run(cmd, shell=True)



Note : I Download the static library from Here and added it to the python folder and generate python.zip with other dependencies and upload it on the aws layer and the AWS layer is linked with the python function.


Note : Above code is working fine with google codelab and is able to generate a merged video working fine.


Any help would be appriciated