
Recherche avancée
Autres articles (22)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
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" ; -
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.
Sur d’autres sites (6786)
-
Can I get pictures/stills/photos from inside a container file from a CD-I disc ?
8 décembre 2017, par user9047197I have
ffmpeg
setup.Is there a way to extract
pictures/stills/photos
(etc) from a container (file) that’s from an old CD-I game that I have.I don’t want to extract the audio nor video. And I don’t want frames from the videos either.
I want the bitmaps (etc) from INSIDE that container file.
I know my Windows 8.1 PC can’t read inside that container file - so I’m hoping there’s a way to extract all the files (I want) instead using
ffmpeg
.(IsoBuster only gives the audio and video so I know already about IsoBuster.)
I think there are no individual headers for the
pictures/stills/photos
, etc.Here’s what ExifTool decoded the file as :
ExifTool Version Number (10.68)
File Name (green.3t)
File Size (610 MB)
File Permissions (rw-rw-rw-)
File Type (MPEG)
File Type Extension (mpg)
MIME Type (video/mpeg)
MPEG Audio Version (1)
Audio Layer (2)
Audio Bitrate (80 kbps)
Sample Rate (44100)
Channel Mode (Single Channel)
Mode Extension (Bands 4-31)
Copyright Flag (False)
Original Media (False)
Emphasis (None)
Image Width (368)
Image Height (272)
Aspect Ratio (1.0695)
Frame Rate (25 fps)
Video Bitrate (1.29 Mbps)
Duration (1:02:12 approx)
Image Size (368x272)
Megapixels (0.100)Thank you for reading and - help !! :D
-
Slow, robotic audio encoding with Humble-Video api (ffmpeg)
30 novembre 2017, par Walker KnappI have a program that is trying to parse pcm_s16le audio samples from a .wav file and encode it into mp3 using the Humble-Video api.
This isn’t what the final program is trying to do, but it outlines the problem I’m encountering.
The issue is that the output audio files sound robotic and slow.input.wav
(Just some random audio from a video game, ignore the wonky size headers) : https://drive.google.com/file/d/1nQOJGIxoSBDzprXExyTVNyyipSKQjyU0/view?usp=sharingoutput.mp3
:
https://drive.google.com/file/d/1MfEFw2V7TiKS16SqSTv3wrbh6KoankIj/view?usp=sharingoutput.wav
: https://drive.google.com/file/d/1XtDdCtYao0kS0Qe2l6JGu1tC5xvqt62f/view?usp=sharingimport io.humble.video.*;
import java.io.*;
public class AudioEncodingTest {
private static AudioChannel.Layout inLayout = AudioChannel.Layout.CH_LAYOUT_STEREO;
private static int inSampleRate = 44100;
private static AudioFormat.Type inFormat = AudioFormat.Type.SAMPLE_FMT_S16;
private static int bytesPerSample = 2;
private static File inFile = new File("input.wav");
public static void main(String[] args) throws IOException, InterruptedException {
render("output.mp3");
render("output.wav");
}
public static void render(String filename) throws IOException, InterruptedException {
//Starting everything up.
Muxer muxer = Muxer.make(new File(filename).getAbsolutePath(), null, null);
Codec codec = Codec.guessEncodingCodec(muxer.getFormat(), null, null, null, MediaDescriptor.Type.MEDIA_AUDIO);
AudioFormat.Type findType = null;
for(AudioFormat.Type type : codec.getSupportedAudioFormats()) {
if(findType == null) {
findType = type;
}
if(type == inFormat) {
findType = type;
break;
}
}
if(findType == null){
throw new IllegalArgumentException("Couldn't find valid audio format for codec: " + codec.getName());
}
Encoder encoder = Encoder.make(codec);
encoder.setSampleRate(44100);
encoder.setTimeBase(Rational.make(1, 44100));
encoder.setChannels(2);
encoder.setChannelLayout(AudioChannel.Layout.CH_LAYOUT_STEREO);
encoder.setSampleFormat(findType);
encoder.setFlag(Coder.Flag.FLAG_GLOBAL_HEADER, true);
encoder.open(null, null);
muxer.addNewStream(encoder);
muxer.open(null, null);
MediaPacket audioPacket = MediaPacket.make();
MediaAudioResampler audioResampler = MediaAudioResampler.make(encoder.getChannelLayout(), encoder.getSampleRate(), encoder.getSampleFormat(), inLayout, inSampleRate, inFormat);
audioResampler.open();
MediaAudio rawAudio = MediaAudio.make(1024/bytesPerSample, inSampleRate, 2, inLayout, inFormat);
rawAudio.setTimeBase(Rational.make(1, inSampleRate));
//Reading
try(BufferedInputStream reader = new BufferedInputStream(new FileInputStream(inFile))){
reader.skip(44);
int totalSamples = 0;
byte[] buffer = new byte[1024];
int readLength;
while((readLength = reader.read(buffer, 0, 1024)) != -1){
int sampleCount = readLength/bytesPerSample;
rawAudio.getData(0).put(buffer, 0, 0, readLength);
rawAudio.setNumSamples(sampleCount);
rawAudio.setTimeStamp(totalSamples);
totalSamples += sampleCount;
rawAudio.setComplete(true);
MediaAudio usedAudio = rawAudio;
if(encoder.getChannelLayout() != inLayout ||
encoder.getSampleRate() != inSampleRate ||
encoder.getSampleFormat() != inFormat){
usedAudio = MediaAudio.make(
sampleCount,
encoder.getSampleRate(),
encoder.getChannels(),
encoder.getChannelLayout(),
encoder.getSampleFormat());
audioResampler.resample(usedAudio, rawAudio);
}
do{
encoder.encodeAudio(audioPacket, usedAudio);
if(audioPacket.isComplete()) {
muxer.write(audioPacket, false);
}
} while (audioPacket.isComplete());
}
}
catch (IOException e){
e.printStackTrace();
muxer.close();
System.exit(-1);
}
muxer.close();
}
}Edit
I’ve gotten wave file exporting to work, however mp3s remain the same, which is very confusing. I changed the section counting how many samples each buffer of bytes is.
MediaAudio rawAudio = MediaAudio.make(1024, inSampleRate, channels, inLayout, inFormat);
rawAudio.setTimeBase(Rational.make(1, inSampleRate));
//Reading
try(BufferedInputStream reader = new BufferedInputStream(new FileInputStream(inFile))){
reader.skip(44);
int totalSamples = 0;
byte[] buffer = new byte[1024 * bytesPerSample * channels];
int readLength;
while((readLength = reader.read(buffer, 0, 1024 * bytesPerSample * channels)) != -1){
int sampleCount = readLength/(bytesPerSample * channels);
rawAudio.getData(0).put(buffer, 0, 0, readLength);
rawAudio.setNumSamples(sampleCount);
rawAudio.setTimeStamp(totalSamples); -
Is there a way to use youtube-dl in async
8 octobre 2024, par Stam KalyI have an application where I use
zmq
withasyncio
to communicate with the clients who have the ability to download a video withyoutube-dl
to the server. I tried addingawait
toyoutube_dl
's download function but it gave me an error since it was not a coroutine. My code right now is simply looking like this :


import asyncio
import youtube_dl


async def networking_stuff():
 download = True
 while True:
 if download:
 print("Received a request for download")
 await youtube_to_mp3("https://www.youtube.com/watch?v=u9WgtlgGAgs")
 download = False
 print("Working..")
 await asyncio.sleep(2)


async def youtube_to_mp3(url):
 ydl_opts = {
 'format': 'bestaudio/best',
 'postprocessors': [{
 'key': 'FFmpegExtractAudio',
 'preferredcodec': 'mp3',
 'preferredquality': '192',
 }]
 }

 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 ydl.download([url])


loop = asyncio.get_event_loop()
loop.create_task(networking_stuff())
loop.run_forever()




which gives the following output :



Received a request for download
[youtube] u9WgtlgGAgs: Downloading webpage
[youtube] u9WgtlgGAgs: Downloading video info webpage
[youtube] u9WgtlgGAgs: Extracting video information
[youtube] u9WgtlgGAgs: Downloading MPD manifest
[download] Destination: The Cardigans - My Favourite Game “Stone Version”-u9WgtlgGAgs.webm
[download] 100% of 4.20MiB in 00:03
[ffmpeg] Destination: The Cardigans - My Favourite Game “Stone Version”-u9WgtlgGAgs.mp3
Deleting original file The Cardigans - My Favourite Game “Stone Version”-u9WgtlgGAgs.webm (pass -k to keep)
Working..
Working..
....
Working..
Working..




whereas I would expect the
Working..
message to be printed in betweenyoutube-dl
's messages as well. Am I missing something here or is this impossible withasync
/await
? Isffmpeg
blocking ? If so, can I run the download inasync
without converting tomp3
or is using threads the only way ?