
Recherche avancée
Médias (3)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (73)
-
Modifier la date de publication
21 juin 2013, parComment changer la date de publication d’un média ?
Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
Dans la rubrique "Champs à ajouter, cocher "Date de publication "
Cliquer en bas de la page sur Enregistrer -
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 (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (7319)
-
Using ffmpeg, extract small part of .m4a audio file and set extract file duration correctly
30 août 2015, par KesI have Linux mint 17.1.
When I use ffmpeg to cut out a section of a 4 hour long .m4a audio file as follows :
ffmpeg -ss 0:10:00 -i in_file.m4a -vn -c copy -t 0:40:00 out_file.m4a
the correct position and duration of extract is extracted and the file plays just fine, but the audio duration meta-tag in the playback player is incorrectly shown as 4 hours.
How can I set the actual extract duration so it is correct, in this case 30mins, or even better get ffmpeg to calculate it and set it properly ?
Thank you
-
How to extract a small segment of H264 stream from a complete H264 stream ?
13 août 2024, par 陈炫宇I cut a large image into many tiles (150,000), and then encoded it into a .h264 file with FFmpeg at one frame per second and put it on the server. Now I want to randomly decode a picture from the .h264 file for analysis.
My idea for decoding locally is to record their indexes (i, j) when cutting the pictures, and then let the decoder find the corresponding frame in .h264 according to the index, and the effect is pretty good.
Now I put .h264 on the server (minio), and I want to intercept only a section of the code stream and decode it. Is this possible ?


(For example, my .h264 has 10 frames in total, and I want to decode the 5th frame and save it. Can I cache the 4th to 6th frames and then decode them ?)


----------------------This is the code I used to capture a small portion of the stream from the server.-----------------------------------------------------------


@lru_cache(1024)
def read_small_cached(self, start, length, retry=5):
 ''' read cached and thread safe, but do not read too large'''
 if length == 0:
 return b''
 resp = None
 for _ in range(retry):
 try:
 _client = minio_get_client()
 resp = _client.get_object(
 self.bucket, self.filename, offset=start, length=length)
 oup = resp.read()
 return oup
 except:
 time.sleep(3)
 finally:
 if resp is not None:
 resp.close()
 resp.release_conn()
 raise Exception(f'can not read {self.name}')




I tried parameters such as start = 0, length = 10241024100, and I can read part of the picture.


But when I used the function to find IDR frames and get their position, FFmpeg's decoder thought it was an invalid resource.


---here is my find key_frame 's code-


def get_all_content(file_path, search_bytes):

if not file_path or not search_bytes:
 raise ValueError("file_path 和 search_bytes 不能为空")

search_len = len(search_bytes)
positions = []

with open(file_path, 'rb') as fp:
 fp.seek(0, 2) # 移动到文件末尾 0表示文件移动的字节数,2表示到末尾,这样是为了获取文件的总大小
 file_size = fp.tell() # 文件大小
 fp.seek(0) # 回到文件开始

 pos = 0
 while pos <= (file_size - search_len):
 fp.seek(pos)
 buf = fp.read(search_len)
 if len(buf) < search_len:
 break
 if buf == search_bytes:
 positions.append(pos)
 pos += 1

return positions



I have only recently started to understand H264. Perhaps I have a misunderstanding of bitstream and H264. I hope to get some guidance. Thanks in advance !


-
Batch splitting large audio files into small fixed-length audio files in moments of silence
26 juillet 2023, par Haldjärvito train the SO-VITS-SVC neural network, we need 10-14 second voice files. As a material, let's say I use phrases from some game. I have already made a batch script for decoding different files into one working format, another batch script for removing silence, as well as a batch script for combining small audio files into files of 13-14 seconds (I used Python, pydub and FFmpeg). To successfully automatically create a training dataset, it remains only to make one batch script - Cutting audio files lasting more than 14 seconds into separate files lasting 10-14 seconds, cutting in places of silence or close to silence is highly preferable.


So, it is necessary to batch cut large audio files (20 seconds, 70 seconds, possibly several hundred seconds) into segments of approximately 10-14 seconds, however, the main task is to look for the quietest place in the cut areas so as not to cut phrases in the middle of a word (this is not very good for model training). So, is it really possible to do this in a very optimal way, so that the processing of a 30-second file does not take 15 seconds, but is fast ? Quiet zone detection is required only in the area of cuts, that is, 10-14 seconds, if counted from the very beginning of the file.


I would be very grateful for any help.


I tried to write a script together with ChatGPT, but all options gave completely unpredictable results and were not even close to what I needed... I had to stop at the option with a sharp cut of files for exactly 14000 milliseconds. However, I hope there is a chance to make a variant with cutting exactly in quiet areas.


import os
from pydub import AudioSegment

input_directory = ".../RemSilence/"
output_directory = ".../Split/"
max_duration = 14000

def split_audio_by_duration(input_file, duration):
 audio = AudioSegment.from_file(input_file)
 segments = []
 for i in range(0, len(audio), duration):
 segment = audio[i:i + duration]
 segments.append(segment)
 return segments

if __name__ == "__main__":
 os.makedirs(output_directory, exist_ok=True)
 audio_files = [os.path.join(input_directory, file) for file in os.listdir(input_directory) if file.endswith(".wav")]
 audio_files.sort(key=lambda file: len(AudioSegment.from_file(file)))
 for file in audio_files:
 audio = AudioSegment.from_file(file)
 if len(audio) > max_duration:
 segments = split_audio_by_duration(file, max_duration)
 for i, segment in enumerate(segments):
 output_filename = f"output_{len(os.listdir(output_directory))+1}.wav"
 output_file_path = os.path.join(output_directory, output_filename)
 segment.export(output_file_path, format="wav")
 else:
 output_filename = f"output_{len(os.listdir(output_directory))+1}.wav"
 output_file_path = os.path.join(output_directory, output_filename)
 audio.export(output_file_path, format="wav")