
Recherche avancée
Médias (1)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
Autres articles (111)
-
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Utilisation et configuration du script
19 janvier 2011, parInformations spécifiques à la distribution Debian
Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
Récupération du script
Le script d’installation peut être récupéré de deux manières différentes.
Via svn en utilisant la commande pour récupérer le code source à jour :
svn co (...)
Sur d’autres sites (7317)
-
Can not add thumbnail image to MP4 using FFMPEG CLI
5 novembre 2019, par Youssof H.After searching for hours, about the easiest solution for adding a thumbnail to an MP4 using a CLI, I came back to the start "FFMPEG". Though I skipped it at first wishing I will get a working tool but no, I will stick to "FFMPEG".
Even after updating the repository ==> Same issue.
I followed the exact code present at the official documentation that says :
ffmpeg -i path/to/in.mp4 -i path/to/IMAGE.png -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic path/to/out.mp4
The following error log shows :
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:0 -> #0:2 (mjpeg (native) -> png (native))
Press [q] to stop, [?] for help
[swscaler @ 0x1fd0860] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x1fd0860] No accelerated colorspace conversion found from yuv420p to rgb24.
[mp4 @ 0x1f747e0] track 1: codec frame size is not set
[mp4 @ 0x1f747e0] opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Error initializing output stream 0:2 --
Conversion failed!I have no idea how to fix this. I read the issues forum of the website but I did not find a similar issue. So I hope you guys will give a hand.
Any suggested edits will be taken into consideration.
Edit1 :
Test1 : I brought an image(thumbnail) from the video itself and ran the command.
Test2 : I brought a unique image(thumbnail) with different resolutions than the video yet the same error appears.
==>Useless
Edit2 :
First :
After fixing my command to be like this
ffmpeg -i path/to/in.mp4 -i path/to/IMAGE.png -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic -strict -2 path/to/out.mp4
I viewed the thumbnail using VLC (video player) so it showed up at first. But when I replaced the video and the thumbnail image with others I ran the command it runned smoothly, untill I viewed thumbnail again using VLC it showed the old thumbnail image it seemed to be cached somewhere during "FFMPEG" process. I had to delete the folder and make a new one in order to update the new thumbnail, but again it "caches" the first thumbnail used and shows it in VLC.Is it an issue from VLC or the "FFMPEG" is doing something weird ?
Second :
After I had the thumbnail showing up in VLC I wanted to test this feature by sending it to a contact on WhatsApp but it didn’t show. After a little search, I realized it might be connected to "og:image" metadata. Is there a way to edit this using CLI ?
Third :
Further, the video embedded with a thumbnail doesn’t play on Windows nor on iPhone nor on Android. When I open this using windows media player it says
Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file.
From here I think there is something I have to do with the codec.
Note : the thumbnail shows in Windows File Explorer (but can not play video)
Do you have any idea ?
-
Run python ffmpeg audio convertion code file from subprocess.call() within a flask server
11 novembre 2019, par KasunI have build a small flask server to handle the request. I have 3 parameters in the api function that i want to get. those are
type
,user_id
,audio_file
, One is a file. Since it’s used for the audio file conversion. I have to get a file.. I have tested with this in Postman audio file get saved but the subprocess.call(command) in the api function doesn’t work..this is the flask server code
@app.route('/voice', methods=['GET','POST'])
def process_audio():
try:
if request.method == 'POST':
input_type = request.form['type']
user_id = request.form['user_id']
static_file = request.files['audio_file']
audio_name = secure_filename(static_file.filename)
path = 't/'
status = static_file.save(path + audio_name)
full_file = path + audio_name
if input_type == 1:
cmd = "python t/convert_english.py --audio " + full_file
res = subprocess.call([cmd],shell=True)
f = open('t/ress.txt', 'w')
f.write(str(res))
f.close()
return "true"
else:
cmd = "python t/convert_sinhala.py --audio " + full_file
os.system(cmd)
return "true"
else:
return "false"
except Exception as e:
print(e)
logger.error(e)
return eThe audio file get saved in the directory as expected..
this is the
convert_english.py
import subprocess
import argparse
import os
import logging
import speech_recognition as sr
from tqdm import tqdm
from multiprocessing.dummy import Pool
#subprocess.call('pip install pydub',shell=True)
from os import path
from pydub import AudioSegment
logging.basicConfig(filename='/var/www/img-p/t/ee.log', level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger=logging.getLogger(__name__)
ap = argparse.ArgumentParser()
ap.add_argument("-a", "--audio", required=True,
help="path to input audio file")
args = vars(ap.parse_args())
src = args["audio"]
dst = "audio.wav"
sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")
#subprocess.call('pip install ffmpeg-python',shell=True)
subprocess.call('mkdir parts',shell=True)
subprocess.call('ffmpeg -i audio.wav -f segment -segment_time 30 -c copy parts/out%09d.wav',shell=True)
#subprocess.call('pip install SpeechRecognition',shell=True)
pool = Pool(8) # Number of concurrent threads
with open("api-key.json") as f:
GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
r = sr.Recognizer()
files = sorted(os.listdir('parts/'))
def transcribe(data):
idx, file = data
name = "parts/" + file
print(name + " started")
# Load audio file
with sr.AudioFile(name) as source:
audio = r.record(source)
# Transcribe audio file
text = r.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS)
print(name + " done")
return {
"idx": idx,
"text": text
}
all_text = pool.map(transcribe, enumerate(files))
pool.close()
pool.join()
transcript = ""
for t in sorted(all_text, key=lambda x: x['idx']):
total_seconds = t['idx'] * 30
# Cool shortcut from:
# https://stackoverflow.com/questions/775049/python-time-seconds-to-hms
# to get hours, minutes and seconds
m, s = divmod(total_seconds, 60)
h, m = divmod(m, 60)
# Format time as h:m:s - 30 seconds of text
transcript = transcript + "{:0>2d}:{:0>2d}:{:0>2d} {}\n".format(h, m, s, t['text'])
print(transcript)
with open("transcript.txt", "w") as f:
f.write(transcript)
f = open("transcript.txt")
lines = f.readlines()
f.close()
f = open("transcript.txt", "w", encoding="utf-8")
for line in lines:
f.write(line[8:])
f.close()The thing is above code works when i manually run the command -> python t/convert_english.py —audio t/tttttttttt.mp3 like this in the terminal..
But when i try to run from the flask server itself it doesn’t works.. And I’m not getting an error either.
-
Limit output framerate to maximum 30 [duplicate]
10 décembre 2019, par CharThis question already has an answer here :
I have a bunch of videos in a folder to convert. The videos come in a variety of container formats - mp4, mkv, avi, mpg, etc. All I would do is to drag videos into this folder and I run a script to read each file in the folder and execute ffmpeg to convert each video to a specific setting.
What I want to do is to set the output framerate of each video to the following logic :
- if the input framerate is 30 fps or less, keep the output framerate to the input file framerate, eg. if the input framerate is 24 fps.
- if the input framerate is more than 30, set the output framerate to 30 fps, eg. if the input framerate is 60 fps.
eg. something like :
if=input<=30fps -r input_framerate else=input>30fps -r 30
I have read the documentation and more than two hours of Googling, but did not find a suitable command to do this.
Please enlighten.