
Recherche avancée
Autres articles (95)
-
MediaSPIP Init et Diogène : types de publications de MediaSPIP
11 novembre 2010, parÀ l’installation d’un site MediaSPIP, le plugin MediaSPIP Init réalise certaines opérations dont la principale consiste à créer quatre rubriques principales dans le site et de créer cinq templates de formulaire pour Diogène.
Ces quatre rubriques principales (aussi appelées secteurs) sont : Medias ; Sites ; Editos ; Actualités ;
Pour chacune de ces rubriques est créé un template de formulaire spécifique éponyme. Pour la rubrique "Medias" un second template "catégorie" est créé permettant d’ajouter (...) -
Librairies et logiciels spécifiques aux médias
10 décembre 2010, parPour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...) -
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 (5311)
-
When using ffmpeg to create mp4 video file from batch of images the whole process is very slow how can i make it faster ?
29 juin 2015, par Brubaker HaimThe whole process is slow and also in the end the video file when playing it the frames moving very slow.
ffmpeg -framerate 1/5 -i screenshot%06d.jpg -c:v libx264 -r 30 -p
ix_fmt yuv420p out2.mp4Is that mean 1 frames each 5 seconds ?
So if i will make 5/1 it will be 5 frames in a second ?
What should be the best result ?And the second problem is that for testing i have 70 images but in the original i have over 1000 images is there any way to make all this process faster ?
-
Transcoding audio using xuggler
23 juin 2014, par amdI am trying to convert an audio file with the header
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)I want to transcode this file to mp3 format. I have following code snippet but its not working well. I have written it using XUGGLER code snippet for transcoding audio and video.
Audio decoder is
audioDecoder = IStreamCoder.make(IStreamCoder.Direction.DECODING, ICodec.findDecodingCodec(ICodec.ID.CODEC_ID_PCM_S16LE));
audioDecoder.setSampleRate(44100);
audioDecoder.setBitRate(176400);
audioDecoder.setChannels(2);
audioDecoder.setTimeBase(IRational.make(1,1000));
if (audioDecoder.open(IMetaData.make(), IMetaData.make()) < 0)
return false;
return true;Audio encoder is
outContainer = IContainer.make();
outContainerFormat = IContainerFormat.make();
outContainerFormat.setOutputFormat("mp3", urlOut, null);
int retVal = outContainer.open(urlOut, IContainer.Type.WRITE, outContainerFormat);
if (retVal < 0) {
System.out.println("Could not open output container");
return false;
}
outAudioCoder = IStreamCoder.make(IStreamCoder.Direction.ENCODING, ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_MP3));
outAudioStream = outContainer.addNewStream(outAudioCoder);
outAudioCoder.setSampleRate(new Integer(44100));
outAudioCoder.setChannels(2);
retVal = outAudioCoder.open(IMetaData.make(), IMetaData.make());
if (retVal < 0) {
System.out.println("Could not open audio coder");
return false;
}
retVal = outContainer.writeHeader();
if (retVal < 0) {
System.out.println("Could not write output FLV header: ");
return false;
}
return true;And here is encode method where i send packets of 32 byte to transcode
public void encode(byte[] audioFrame){
//duration of 1 video frame
long lastVideoPts = 0;
IPacket packet_out = IPacket.make();
int lastPos = 0;
int lastPos_out = 0;
IAudioSamples audioSamples = IAudioSamples.make(48000, audioDecoder.getChannels());
IAudioSamples audioSamples_resampled = IAudioSamples.make(48000, audioDecoder.getChannels());
//we always have 32 bytes/sample
int pos = 0;
int audioFrameLength = audioFrame.length;
int audioFrameCnt = 1;
iBuffer = IBuffer.make(null, audioFrame, 0, audioFrameLength);
IPacket packet = IPacket.make(iBuffer);
//packet.setKeyPacket(true);
packet.setTimeBase(IRational.make(1,1000));
packet.setDuration(20);
packet.setDts(audioFrameCnt*20);
packet.setPts(audioFrameCnt*20);
packet.setStreamIndex(1);
packet.setPosition(lastPos);
lastPos+=audioFrameLength;
int pksz = packet.getSize();
packet.setComplete(true, pksz);
/*
* A packet can actually contain multiple samples
*/
int offset = 0;
int retVal;
while(offset < packet.getSize())
{
int bytesDecoded = audioDecoder.decodeAudio(audioSamples, packet, offset);
if (bytesDecoded < 0)
throw new RuntimeException("got error decoding audio ");
offset += bytesDecoded;
if (audioSamples.isComplete())
{
int samplesConsumed = 0;
while (samplesConsumed < audioSamples.getNumSamples()) {
retVal = outAudioCoder.encodeAudio(packet_out, audioSamples, samplesConsumed);
if (retVal <= 0)
throw new RuntimeException("Could not encode audio");
samplesConsumed += retVal;
if (packet_out.isComplete()) {
packet_out.setPosition(lastPos_out);
packet_out.setStreamIndex(1);
lastPos_out+=packet_out.getSize();
retVal = outContainer.writePacket(packet_out);
if(retVal < 0){
throw new RuntimeException("Could not write data packet");
}
}
}
}
}
}I get an output file but it doesnt get played. I have very little experience of audio encoding and sampling. Thanks in advance.
-
libavcodec get video duration and framerate
17 septembre 2013, par TishuI have a video encoded in
.3gp
h.264
and I am looking to get its framerate and duration in C. Here is the code I use after opening the file and finding the appropriate codecs :AVRational rational = gVideoCodecCtx->time_base;
LOGI(10, "numerator is %i", rational.num);
LOGI(10, "denominator is %i", rational.den);
LOGI(10, "duration is %d", gFormatCtx->duration);
LOGI(10, "fps is %d", (double)av_q2d(rational));And here is the output :
12-02 12:30:19.819: I/FFmpegTest(23903): numerator is 1
12-02 12:30:19.819: I/FFmpegTest(23903): denominator is 180000
12-02 12:30:19.819: I/FFmpegTest(23903): duration is 6594490
12-02 12:30:19.819: I/FFmpegTest(23903): fps is 1692926992From the documentation I understand that the duration is meant to be "duration/time_base" which gives me
6594490 / 180000 = 36.6
. The duration of my video file is6 seconds
and I do not know where this factor of6
would come from.Also the framerate seems to be completely off.
It is currenlty hard to find help as a lot of tutorials use deprecated methods and the documentation does not give examples.
Any help would be appreciated.
Thanks
Edit :
Thanks to the comment below I managed to print the following12-02 18:59:36.279: I/FFmpegTest(435): numerator is 1
12-02 18:59:36.279: I/FFmpegTest(435): denominator is 180000
12-02 18:59:36.279: I/FFmpegTest(435): duration is 6594490
12-02 18:59:36.279: I/FFmpegTest(435): fps is 0.000006I also managed to find out a frame's timestamp in
msec
with this :int msec = 1000*(packet.pts * timeBase * gVideoCodecCtx->ticks_per_frame);
This returns me something that's roughly
33fps
(I expect30
). But I can't figure out how to retrieve the duration. The documentation says "duration of the stream, inAV_TIME_BASE
fractional seconds" but6594490 * 0.000006 = 39.5
- the correct duration is6.3
seconds). Also the exact fps is30
but nor sure how to get from0.000006
to30
with the above figures)Thanks