
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (42)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (4782)
-
How do I convert ADPCM to PCM using FFmpeg ?
26 janvier 2013, par mystaferI have a video feed that sends me audio using the ADPCM codec. However, android only supports PCM format. How can I convert the ADPCM audio feed into a PCM audio feed ?
The answer to this may be similar to the answer to this question.
I have successfully decoded the frame with this code :
int len = avcodec_decode_audio4(pAudioCodecCtx, pAudioFrame, &frameFinished, &packet);
Is the secret here to use a reverse encode function ?
Here is what I have so far in my audio decode function :
if(packet_queue_get(env, javaThread, pAudioPacketQueue, &packet, 1) < 0) {
LOGE("audio - after get packet failed");
return;
}
LOGD("Dequeued audio packet");
// calculate frame size
int frameSize;
if (pPcmAudioCodecCtx->frame_size) {
frameSize = pPcmAudioCodecCtx->frame_size;
} else {
/* if frame_size is not set, the number of samples must be
* calculated from the buffer size */
int64_t nb_samples = (int64_t)AUDIO_PCM_OUTBUFF_SIZE * 8 /
(av_get_bits_per_sample(pPcmAudioCodecCtx->codec_id) *
pPcmAudioCodecCtx->channels);
frameSize = nb_samples;
}
int pcmBytesPerSample = av_get_bytes_per_sample(pPcmAudioCodecCtx->sample_fmt);
int pcmFrameBytes = frameSize * pcmBytesPerSample * pPcmAudioCodecCtx->channels;
uint8_t *pDataStart = packet.data;
while(packet.size > 0) {
int len = avcodec_decode_audio4(pAudioCodecCtx, pAudioFrame, &frameFinished, &packet);
LOGD("Decoded ADPCM frame");
if (len < 0) {
LOGE("Error while decoding audio");
return;
}
if (frameFinished) {
// store frame data in FIFO buffer
uint8_t *inputBuffer = pAudioFrame->data[0];
int inputBufferSize = pAudioFrame->linesize[0];
av_fifo_generic_write(fifoBuffer, inputBuffer, inputBufferSize, NULL);
LOGD("Added ADPCM frame to FIFO buffer");
// check if fifo buffer has enough data for a PCM frame
while (av_fifo_size(fifoBuffer) >= pcmFrameBytes) {
LOGI("PCM frame data in FIFO buffer");
// read frame's worth of data from FIFO buffer
av_fifo_generic_read(fifoBuffer, pAudioPcmOutBuffer, pcmFrameBytes, NULL);
LOGD("Read data from FIFO buffer into pcm frame");
avcodec_get_frame_defaults(pPcmAudioFrame);
LOGD("Got frame defaults");
pPcmAudioFrame->nb_samples = pcmFrameBytes / (pPcmAudioCodecCtx->channels *
pcmBytesPerSample);
avcodec_fill_audio_frame(pPcmAudioFrame, pPcmAudioCodecCtx->channels,
pPcmAudioCodecCtx->sample_fmt,
pAudioPcmOutBuffer, pcmFrameBytes, 1);
LOGD("Filled frame audio with data");
// fill audio play buffer
int dataSize = pPcmAudioFrame->linesize[0];
LOGD("Data to output: %d", dataSize);
jbyteArray audioPlayBuffer = (jbyteArray) env->GetObjectField(ffmpegCtx, env->GetFieldID(cls, "audioPlayBuffer", "[B"));
jbyte *bytes = env->GetByteArrayElements(audioPlayBuffer, NULL);
memcpy(bytes, pPcmAudioFrame->data[0], dataSize);
env->ReleaseByteArrayElements(audioPlayBuffer, bytes, 0);
LOGD("Copied data into Java array");
env->CallVoidMethod(player, env->GetMethodID(playerCls, "updateAudio", "(I)V"), dataSize);
} -
Decoding video frames and sending them to RabbitMQ using FFmpeg
28 janvier 2023, par viatorI've built ffmpeg with AMQP support and tried
ffmpeg -i /videos/episode.mp4 -f mpegts amqp://localhost
which apparently works. But AFAIK mpegts has some muxing overhead, so I don't really know how it splits stream into messages.

Is it possible to decode all the frames from a video and send them one-by-one in some format (say, JPEG or PNG) to RabbitMQ ?


-
Making Sure The PNG Gets There
14 juin 2013, par Multimedia Mike — GeneralRewind to 1999. I was developing an HTTP-based remote management interface for an embedded device. The device sat on an ethernet LAN and you could point a web browser at it. The pitch was to transmit an image of the device’s touch screen and the user could click on the picture to interact with the device. So we needed an image format. If you were computing at the time, you know that the web was insufferably limited back then. Our choice basically came down to GIF and JPEG. Being the office’s annoying free software zealot, I was championing a little known up and coming format named PNG.
So the challenge was to create our own PNG encoder (incorporating a library like libpng wasn’t an option for this platform). I seem to remember being annoyed at having to implement an integrity check (CRC) for the PNG encoder. It’s part of the PNG spec, after all. It just seemed so redundant. At the time, I reasoned that there were 5 layers of integrity validation in play.
I don’t know why, but I was reflecting on this episode recently and decided to revisit it. Here are all the encapsulation layers of a PNG file when flung over an ethernet network :
So there are up to 5 encapsulations for the data in this situation. At the innermost level is the image data which is compressed with the zlib DEFLATE method. At first, I thought that this also had a CRC or checksum. However, in researching this post, I couldn’t find any evidence of such an integrity check. Further, I don’t think we bothered to compress the PNG data in this project long ago. It was a small image, monochrome, and transferring via LAN, so the encoder could get away with signaling uncompressed data.
The graphical data gets wrapped up in a PNG chunk and all PNG chunks have a CRC. To transmit via the network, it goes into a TCP frame, which also has a checksum. That goes into an IP packet. I previously believed that this represented another integrity check. While an IP frame does have a checksum, the checksum only covers the IP header and not the payload. So that doesn’t really count towards this goal.
Finally, the data gets encapsulated into an ethernet frame which has — you guessed it — a CRC.
I see that other link layer protocols like PPP and wireless ethernet (802.11) also feature frame CRCs. So I guess what I’m saying is that, if you transfer a PNG file over the network, you can be confident that the data will be free of any errors.