
Recherche avancée
Autres articles (101)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)
Sur d’autres sites (8433)
-
ffmpeg : match audio video duration post concatenation
20 janvier 2020, par Massimo VantaggioI wrote this bash to automate concatentation of videos for dash mpeg streaming infinite loop.
Im unable to obtain same duration for audio and video, with the videos that i’m using for testing i get always 6 ms more for audio track.
May ask help to debug it and understand how to get same duration for both audio and video track ?#!/bin/bash
#CANCAT 0.3
cd input
fps=()
# GET FPS OF EACH VIDEO INTO ARRAY
for f in *.mp4; do
_f=$(ffmpeg -i "$f" 2>&1 | sed -n "s/.*, \\(.*\\) fp.*/\\1/p")
fps+=("$_f")
done
#GET NUMBER OF ELEMENTS IN FPS ARRAY
tLen=${#fps[@]}
#CHECK FPS EQUALITY
for tLen in "${fps[@]:1}"; do
if [[ $tLen != ${fps[0]} ]]; then
printf "WARNING: VIDEO’S FRAME-RATE ARE NOT EQUALS, THE PROCESS CAN’T START."
printf "%s\\0" "${fps[@]}" |
sort -zu |
xargs -0 printf " %s"
printf "\\n"
exit 1
fi
done
#AUDIO ENCODING
for f in *.mp4;
do
NAME=$(echo "$f" | cut -d'.' -f1)
ffmpeg -y -i "$f" -c copy -video_track_timescale 90k -c:a aac -b:a 384k -ar 44100 -ac 2 -shortest -af aresample=async=1 ../buffer/${NAME}_buffer.mp4
done
#-af aresample=async=1000
#-filter_complex " [1:0] apad "
cd ..
cd buffer
times=()
for f in *.mp4;
do
echo "file '$f'" >> list.txt;
# GET DURATION OF EACH VIDEO
_t=$(ffprobe -i "$f" -show_entries format=duration -v quiet -of csv="p=0")
times+=("$_t")
done
#SUM ALL DURATIONS
TOTALDURATION=$( echo "${times[@]}" | sed 's/ /+/g' | bc )
DURROUND=$(echo "$TOTALDURATION" | cut -d'.' -f1)
TOTDELTA="$((DURROUND%2))"
TOTDUR="$(($DURROUND-$TOTDELTA))"
#GET FPS
FPS="$(ffmpeg -i ${f[0]} 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p")"
#ROUND FPS
FPSC=$( echo "($FPS+0.5)/1" | bc )
#GET GOP
GOP="$((FPSC*2))"
#ENCODING MASTER TRACK
ffmpeg -f concat -safe 0 -y -i list.txt -loop 1 -i ../logo/logo.png -c:a copy -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -r $FPSC -b:v 4800k -maxrate 9600k -bufsize 19200k -profile:v main -crf 22 -filter_complex "[0:v][1:v]overlay=main_w-overlay_w-10:10,scale=1920:1080,setsar=1" -t $TOTDUR 1080set.mp4
#EXTRACTING AUDIO FROM MASTER VIDEO TRACK
ffmpeg -y -i 1080set.mp4 -c copy -vn ../output/output_audio.mp4
#REMOVE AUDIO FROM MASTER VIDEO TRACK
ffmpeg -y -i 1080set.mp4 -c copy -an ../output/output_1080.mp4
#CLEAN BUFFER
rm *.mp4
rm *.txt
cd ..
cd output
#ENCODE 720p
ffmpeg -y -i output_1080.mp4 -an -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -s 1280x720 -r $FPSC -b:v 2400k -maxrate 4800k -bufsize 9600k -profile:v main -crf 22 output_720.mp4
#ENCODE 360p
ffmpeg -y -i output_1080.mp4 -an -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -s 640x360 -r $FPSC -b:v 800k -maxrate 1600k -bufsize 3200k -profile:v main -crf 22 output_360.mp4
#VALIDATOR
echo 1080p ENCODING
echo GOP: $GOP
echo VIDEO FORMAT CONTAINER DURATION:
ffprobe -v error -show_entries format=duration \
-of default=noprint_wrappers=1:nokey=1 output_1080.mp4
echo VIDEO STREAM DURATION:
ffprobe -v error -select_streams v:0 -show_entries stream=duration \
-of default=noprint_wrappers=1:nokey=1 output_1080.mp4
echo AUDIO FORMAT CONTAINER DURATION:
ffprobe -v error -show_entries format=duration \
-of default=noprint_wrappers=1:nokey=1 output_audio.mp4
echo ______________________________________________________________
echo 720p ENCODING
echo GOP: $GOP
echo VIDEO FORMAT CONTAINER DURATION:
ffprobe -v error -show_entries format=duration \
-of default=noprint_wrappers=1:nokey=1 output_720.mp4
echo VIDEO STREAM DURATION:
ffprobe -v error -select_streams v:0 -show_entries stream=duration \
-of default=noprint_wrappers=1:nokey=1 output_720.mp4
echo DONE
exit 1Here the script with my videos for test and relative folders :
https://gofile.io/?c=WPAC0Q -
POST 500 (internal server error) involving ffmpeg and ffprobe on Gradio [closed]
24 juillet 2023, par AlessandraI'm trying to run a local program on my Windows computer off Visual Studio Code. However, when I run it I keep getting the error below in the console :


POST http://127.0.0.1:7860/run/predict 500 (Internal Server Error)



The terminal in Visual Studio Code displays the following error :


Running on local URL: http://127.0.0.1:7860

Could not create share link. Missing file: C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\frpc_windows_amd64_v0.2.

Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps: 

1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_windows_amd64.exe
2. Rename the downloaded file to: frpc_windows_amd64_v0.2
3. Move the file to this location: C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio
C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
 warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
Traceback (most recent call last):
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\processing_utils.py", line 145, in audio_from_file
 audio = AudioSegment.from_file(filename)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\audio_segment.py", line 728, in from_file
 info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
 res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in __init__
 self._execute_child(args, executable, preexec_fn, close_fds,
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child
 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\routes.py", line 439, in run_predict
 output = await app.get_blocks().process_api(
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\blocks.py", line 1387, in process_api
 inputs = self.preprocess_data(fn_index, inputs, state)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\blocks.py", line 1230, in preprocess_data
 processed_input.append(block.preprocess(inputs[i]))
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\components\audio.py", line 204, in preprocess
 sample_rate, data = processing_utils.audio_from_file(
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\02009753\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\processing_utils.py", line 155, in audio_from_file
 raise RuntimeError(msg) from e
RuntimeError: Cannot load audio from file: `ffprobe` not found. Please install `ffmpeg` in your system to use non-WAV audio file formats and make sure `ffprobe` is in your PATH.



Below is my code :


import gradio as gr
import openai
import winsound
import os
#pip install elevenlabs
from elevenlabslib import *
from pydub import AudioSegment
from pydub.playback import play
import io

#in my actual code my API keys are entered below instead of "**(OPENAI) API KEY HERE**" 
openai.api_key = "**OPENAI API KEY HERE**"
api_key = "**API KEY HERE**"
from elevenlabslib import ElevenLabsUser
user = ElevenLabsUser(api_key)

messages = ["you are a friendly AI assistant"]


def transcribe(audio): #handles audio input from the user
 global messages
 audio_file = open(audio,"rb")
 transcript = openai.Audio.transcribe("whisper-1",audio_file)

 #commit the transcript to the console for debugging
 messages.append(f"\nUser: {transcript['text']}")

 #send audio transcription to NLP model
 response = openai.Completion.create(
 engine='text-davinci-003',
 prompt=messages[-1],
 max_tokens=4096,
 n=1,
 stop=None,
 temperature=0
 )

 system_message=response["choices"][0]["text"]
 messages.append(f"{system_message}")

 #generate ElevenLabs audio response
 voice = user.get_voices_by_name("Antoni")[0]
 audio = voice.generate_audio_bytes(system_message)

 audio = AudioSegment.from_file(io.BytesIO(audio), format="mp3")
 audio.export("output.wav", format="wav")

 winsound.PlaySound("output.wav, winsound.SND_FILENAME")

 chat_transcript = "\n".join(messages)
 
 return chat_transcript

iface=gr.Interface(
 fn=transcribe,
 inputs=gr.Audio(source="microphone", type = "filepath", placeholder="Please start speaking..."),
 outputs="text",
 title="AI Assistant",
 description="Hi, I'm your AI assistant. How can I help?")

iface.launch(share=True)



I have already downloaded FFmpeg via the following instructions : https://www.wikihow.com/Install-FFmpeg-on-Windows . However that didn't solve the error.


How do I fix internal server error ? Thank you in advance for your help.


-
mpeg4videodec : move mpeg4-specific post-frame-decode code from h264dec to mpeg4videodec
26 novembre 2013, par Anton Khirnov