
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (94)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (4733)
-
Facing issue with mp4Parser
20 novembre 2014, par RohitI am trying to trim video with the help of mp4Parser. In output am getting trimmed video but just before video finishes it give error "Sorry cant Play this video". Video am making is H264.
public static void main(String args) throws IOException {
Movie movie = new MovieCreator()
.build(new RandomAccessFileIsoBufferWrapperImpl(
new File(
"/sdcard/Videos11/"+args+".mp4")));
List<track> tracks = movie.getTracks();
Log.e("Tracks","Following are the Tracks:- "+tracks);
movie.setTracks(new LinkedList<track>());
// remove all tracks we will create new tracks from the old
double startTime = 0.000;
double endTime = 6.000;
boolean timeCorrected = false;
// Here we try to find a track that has sync samples. Since we can only
// start decoding
// at such a sample we SHOULD make sure that the start of the new
// fragment is exactly
// such a frame
for (Track track : tracks) {
if (track.getSyncSamples() != null
&& track.getSyncSamples().length > 0) {
if (timeCorrected) {
// This exception here could be a false positive in case we
// have multiple tracks
// with sync samples at exactly the same positions. E.g. a
// single movie containing
// multiple qualities of the same video (Microsoft Smooth
// Streaming file)
throw new RuntimeException(
"The startTime has already been corrected by another track with SyncSample. Not Supported.");
}
startTime = correctTimeToNextSyncSample(track, startTime);
endTime = correctTimeToNextSyncSample(track, endTime);
timeCorrected = true;
}
}
for (Track track : tracks) {
long currentSample = 0;
double currentTime = 0;
long startSample = -1;
long endSample = -1;
for (int i = 0; i < track.getDecodingTimeEntries().size(); i++) {
TimeToSampleBox.Entry entry = track.getDecodingTimeEntries().get(i);
for (int j = 0; j < entry.getCount(); j++) {
// entry.getDelta() is the amount of time the current sample
// covers.
if (currentTime <= startTime) {
// current sample is still before the new starttime
startSample = currentSample;
}
if (currentTime <= endTime) {
// current sample is after the new start time and still
// before the new endtime
endSample = currentSample;
} else {
// current sample is after the end of the cropped video
break;
}
currentTime += (double) entry.getDelta()
/ (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
}
movie.addTrack(new CroppedTrack(track, startSample, endSample));
}
IsoFile out = new DefaultMp4Builder().build(movie);
String filePath = "sdcard/test"+i+".mp4";
i++;
File f = new File(filePath);
FileOutputStream fos = new FileOutputStream(f);
BufferedOutputStream bos = new BufferedOutputStream(fos, 65535);
out.getBox(new IsoOutputStream(fos));
bos.close();
fos.flush();
fos.close();
}
private static double correctTimeToNextSyncSample(Track track,
double cutHere) {
double[] timeOfSyncSamples = new double[track.getSyncSamples().length];
long currentSample = 0;
double currentTime = 0;
for (int i = 0; i < track.getDecodingTimeEntries().size(); i++) {
TimeToSampleBox.Entry entry = track.getDecodingTimeEntries().get(i);
for (int j = 0; j < entry.getCount(); j++) {
if (Arrays.binarySearch(track.getSyncSamples(),
currentSample + 1) >= 0) {
// samples always start with 1 but we start with zero
// therefore +1
timeOfSyncSamples[Arrays.binarySearch(
track.getSyncSamples(), currentSample + 1)] = currentTime;
}
currentTime += (double) entry.getDelta()
/ (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
}
for (double timeOfSyncSample : timeOfSyncSamples) {
if (timeOfSyncSample > cutHere) {
return timeOfSyncSample;
}
}
return timeOfSyncSamples[timeOfSyncSamples.length - 1];
}
</track></track>Making video of 30 seconds and want to trim first 6 seconds. Working but in last(between 5 to 6 sec) it shows Cant play this video. Any help will be appreciated.
-
Pydub FFMPEG issue [closed]
14 janvier, par Nikolai van den HovenI am attempting to use FFMPEG with Pydub to create a program that chops .mp3 files into different words, each contained in their own .mp3 file, but when I run the script I am getting the following error :


PS C:\Users\nik> & C:/Users/nik/AppData/Local/Microsoft/WindowsApps/python3.12.exe "d:/Python/Word Splitter.py"
C:\Users\nik\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
 warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)



This is the code I am using.


import os
from pydub import AudioSegment
from pydub.silence import split_on_silence
import speech_recognition as sr
AudioSegment.ffmpeg = r"D:\Python\ffmpeg\bin\ffmpeg.exe"
def mp3_to_words(mp3_file, output_folder):
 # Ensure output folder exists
 os.makedirs(output_folder, exist_ok=True)

 # Load MP3 file
 print("Loading audio file...")
 audio = AudioSegment.from_mp3(mp3_file)

 # Split audio into chunks using silence detection
 print("Splitting audio into chunks...")
 chunks = split_on_silence(
 audio,
 min_silence_len=200, # Minimum silence duration in ms to consider as a split point
 silence_thresh=audio.dBFS - 14, # Silence threshold relative to average loudness
 keep_silence=100 # Retain some silence in chunks
 )

 recognizer = sr.Recognizer()

 for i, chunk in enumerate(chunks):
 print(f"Processing chunk {i + 1}/{len(chunks)}...")

 # Save the chunk temporarily
 temp_file = os.path.join(output_folder, f"chunk_{i}.wav")
 chunk.export(temp_file, format="wav")

 # Recognize words in the chunk
 with sr.AudioFile(temp_file) as source:
 audio_data = recognizer.record(source)
 try:
 text = recognizer.recognize_google(audio_data)
 words = text.split()

 # Export each word as its own MP3
 word_start = 0
 for j, word in enumerate(words):
 word_duration = len(chunk) // len(words) # Approximate duration per word
 word_audio = chunk[word_start:word_start + word_duration]
 word_file = os.path.join(output_folder, f"word_{i}_{j}.mp3")
 word_audio.export(word_file, format="mp3")
 word_start += word_duration

 except sr.UnknownValueError:
 print(f"Could not understand chunk {i + 1}.")
 except sr.RequestError as e:
 print(f"Could not request results; {e}")

 # Clean up temporary file
 os.remove(temp_file)

 print(f"Processed {len(chunks)} chunks. Word MP3s saved in {output_folder}.")

if __name__ == "__main__":
 input_file = input("Enter the path to the MP3 file: ").strip()
 output_dir = input("Enter the output folder path: ").strip()

 mp3_to_words(input_file, output_dir)



I have added the Base FFMPEG folder and the bin folder within it to Windows PATH
My PATH variable on Windows 11,
But it does not show up in the variable when I typed PATH into cmd


-
ffmpeg skips frames/packets while playing a file over http
24 janvier 2020, par cobanMicrosoft Windows [Version 10.0.18362.592]
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[hls @ 0600cac0] Skip ('#EXT-X-VERSION:3') 0KB sq= 0B f=0/0
[hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/chunklist_w1481451763.m3u8' for reading
[hls @ 0600cac0] Skip ('#EXT-X-VERSION:3') 0KB sq= 0B f=0/0
[hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_0.ts' for reading
[hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_1.ts' for reading
Input #0, hls, from 'http://ok2.se:8000/movie/xxxxxxxxxx/67933.m3u8':
Duration: 02:02:22.46, start: 0.000000, bitrate: N/A
Program 0
Metadata: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
variant_bitrate : 2788912
Stream #0:0: Data: timed_id3 (ID3 / 0x20334449)
Metadata:
variant_bitrate : 2788912
Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Metadata:
variant_bitrate : 2788912
Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
Metadata:
variant_bitrate : 2788912
[http @ 060662c0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_2.ts' for reading
[hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_2.ts' for reading
[http @ 0606fb40] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_3.ts' for reading
[hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_3.ts' for reading
[http @ 0c2442c0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_4.ts' for reading
[http @ 0606f8c0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_5.ts' for readingI am trying to create an A/V player using ffmpeg library and Delphi. After puzzling and puzzling I found out how to read/decode/sync/display etc...
I think this behaviour is in some specific situations, because I tested live streams and noticed no problems. In this case this is a video file, while playing my app and ffplay.exe (from ffmpeg not compiled by myself) behaving the same, and skipping packets "every time when the app has to wait while packetqueue is full ?" and loses about 10-30 seconds of audio and video.
VLC doesn’t seem to have such a like behaviour, while as I understand from VLC credits, they are using ffmpeg or ffmpeg methods imported for decoding/encoding. inspecting vlc source doesn’t make much sense for me because I am a (noob) Delphi programmer. It’s like my main language is Dutch and try to translate form French to German language.
Please any suggestions how to avoid this, because I think it has to do something with delivery of data from the server and/or read buffer of ffmpeg. If I increase the max size of packetqueue the skipping does happen later and if decrease the size, the skipping happens sooner.
Including code from my app is not necessary because ffplay.exe has exact the same behavior. You can see debug from ffplay.exe.