
Recherche avancée
Autres articles (45)
-
L’agrémenter visuellement
10 avril 2011MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté. -
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)
Sur d’autres sites (6940)
-
FFMPEG Loudnorm reading JSON data
9 juillet 2022, par NineCattoRulesI tried to normalize some audio files using FFMPEG Loudnorm as described here.


However, in Python, I don't understand how to read data info from 1st pass.


My code :


getLoud = subprocess.Popen(f"ffmpeg -i {file_path} -filter:a loudnorm=print_format=json -f null NULL", shell=True, stdout=subprocess.PIPE).stdout
getLoud = getLoud.read().decode()
# parse json_str:
jsonstr_loud = json.loads(getLoud)



This gives me
"errorMessage": "Expecting value: line 1 column 1 (char 0)"


I tried also this :


os.system(f"ffmpeg -i {file_path} -filter:a loudnorm=print_format=json -f null NULL")



and it outputs :


ffmpeg version N-60236-gffb000fff8-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers...
...
[Parsed_loudnorm_0 @ 0x5921940] 
{
 "input_i" : "-9.33",
 "input_tp" : "-0.63",
 "input_lra" : "0.60",
 "input_thresh" : "-19.33",
 "output_i" : "-24.08",
 "output_tp" : "-15.40",
 "output_lra" : "0.60",
 "output_thresh" : "-34.08",
 "normalization_type" : "dynamic",
 "target_offset" : "0.08"
}



In Python, how can I use those parameters, such as
input_i
,input_tp
etc. that I need for the 2nd pass ?

I can't use
ffmpeg-normalize
because I'm using FFMPEG as a Layer in Lambda.

-
OSError : [Errno 9] Bad file descriptor when downloading using pytube and playing with discord.py
15 septembre 2022, par Trevor MathisenWhen using pytube to download a YouTube video and discord.py to play it, I am getting a OSError : [Errno 9] Bad file descriptor error. I've had this working at one point and can't seem to figure out what I changed which broke it.


Full traceback :


2022-09-15 20:20:44 INFO discord.voice_client The voice handshake is being terminated for Channel ID 902294184994693224 (Guild ID 902294184994693220)
2022-09-15T20:20:44.010142763Z 2022-09-15 20:20:44 INFO discord.voice_client Disconnecting from voice normally, close code 1000.
2022-09-15T20:20:44.058592513Z 2022-09-15 20:20:44 ERROR discord.player Exception in voice thread Thread-5
2022-09-15T20:20:44.058623864Z Traceback (most recent call last):
2022-09-15T20:20:44.058629130Z File "/usr/local/lib/python3.10/dist-packages/discord/player.py", line 698, in run
2022-09-15T20:20:44.058632003Z self._do_run()
2022-09-15T20:20:44.058634500Z File "/usr/local/lib/python3.10/dist-packages/discord/player.py", line 691, in _do_run
2022-09-15T20:20:44.058637013Z play_audio(data, encode=not self.source.is_opus())
2022-09-15T20:20:44.058639334Z File "/usr/local/lib/python3.10/dist-packages/discord/voice_client.py", line 683, in send_audio_packet
2022-09-15T20:20:44.058648759Z self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
2022-09-15T20:20:44.058653057Z OSError: [Errno 9] Bad file descriptor
2022-09-15T20:20:44.058673762Z 2022-09-15 20:20:44 INFO discord.player ffmpeg process 12 has not terminated. Waiting to terminate...
2022-09-15T20:20:44.062083854Z 2022-09-15 20:20:44 INFO discord.player ffmpeg process 12 should have terminated with a return code of -9.



Dockerfile :


ENV MEDIA_DIR='/media/'
RUN mkdir -p /media



Download function (check_path returns True, showing the file is there) :


def download_videos(stream, filename):
 print(f'downloading {filename}')
 filepath = stream.download(output_path=config_db.environ_path, filename=f'{filename}.mp4')
 print(f'completed download of {filepath}')
 check_path = Path(filepath)
 if check_path.is_file():
 print(check_path)
 return filepath



Play function :


async def play(voice_channel, message, control = None):
 vc = get_vc()
 if not vc:
 vc = await voice_channel.connect()
 next_yt = YouTube(next_song)
 next_file = sub(r'\W+', '', next_yt.title.replace(' ', '_').replace('__', '_')).lower()
 next_song_path = download_videos(next_yt.streams.filter(only_audio=True, file_extension='mp4')[0], next_file)

 await message.channel.send(f'Done getting ready, I\'ll be there in a moment.')

while next_song:
 while vc.is_playing():
 await asynciosleep(0.5)
 continue

 try:
 vc.play(FFmpegPCMAudio(next_song_path))
 print(f'Playing {next_song_path} with latency of {vc.average_latency}')
 vc.source = PCMVolumeTransformer(vc.source, volume=0.15)
 except Exception as e:
 print(e)
 await vc.disconnect()
 next_song = None
 return
 next_song = sounds_db.get_next_song()
 next_yt = YouTube(next_song) if next_song else None
 next_file = sub(r'\W+', '', next_yt.title.replace(' ', '_').replace('__', '_')).lower() if next_song else None
 next_song_path = download_videos(next_yt.streams.filter(only_audio=True, file_extension='mp4')[0], next_file) if next_song else None



I've mounted the /media/ dir during docker -v and can see the file is getting downloaded and when I copy the file to my local machine I can play it in an audio player.


The program can access the SQLite database right next to the files in question just fine.


I've deployed the container locally and to two different VPS's with the same file structure with the same behavior. I'm ripping my hair out.


-
ffmpeg framemd5 errors with FFV1.mkv in Windows
19 août 2022, par jim_e_jibI'm using framemd5 to check lossless transcoding to FFV1.mkv and am getting mismatches between my source and FFV1 files.


If I generate the framemd5 files in Windows, I get presentation timestamp mismatches on the audio between the source file and FFV1. The MD5s themselves match.


If I generate the framemd5 files for the FFV1 in Linux (WSL), everything matches just fine.


Is there something I am doing wrong, or is this just a quirk of the ffmpeg/FFV1/Windows combination ?


I am using ffmpeg version 2022-07-14-git-882aac99d2-full_build-www.gyan.dev in Windows and
ffmpeg version 4.4.2-0ubuntu1 20.04.sav2 in WSL.


Many thanks !


Jim