
Advanced search
Medias (1)
-
Revolution of Open-source and film making towards open film making
6 October 2011, by
Updated: July 2013
Language: English
Type: Text
Other articles (111)
-
Le profil des utilisateurs
12 April 2011, byChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 November 2010, byAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 May 2011, byDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
On other websites (11759)
-
store pcm data into file, but can not play that file
25 May 2016, by Peng QuI am writing a simple program, which reads mp3 file and store its pcm data into another file. I could get that file now, but when I play that on windows, I failed. So is there any wrong in my code, or windows couldn’t play raw audio data?
#include
#include
#include <libavutil></libavutil>avutil.h>
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
int main()
{
int err;
FILE *fout = fopen("test.wav", "wb");
av_register_all();
// step 1, open file and find audio stream
AVFormatContext *fmtx = NULL;
err = avformat_open_input(&fmtx, "melodylove.mp3", NULL, NULL);
assert(!err);
err = avformat_find_stream_info(fmtx, NULL);
assert(!err);
int audio_stream_idx = -1;
AVStream *st;
AVCodecContext *decx;
AVCodec *dec;
for (int i = 0; i < fmtx->nb_streams; ++i) {
audio_stream_idx = i;
if (fmtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
st = fmtx->streams[i];
decx = st->codec;
dec = avcodec_find_decoder(decx->codec_id);
decx->request_channel_layout = AV_CH_LAYOUT_STEREO_DOWNMIX;
decx->request_sample_fmt = AV_SAMPLE_FMT_FLT;
avcodec_open2(decx, dec, NULL);
break;
}
}
assert(audio_stream_idx != -1);
int channels = decx->channels;
int sample_rate = decx->sample_rate;
int planar = av_sample_fmt_is_planar(decx->sample_fmt);
int num_planes = planar? decx->channels : 1;
const char *sample_name = av_get_sample_fmt_name(decx->sample_fmt);
printf("sample name: %s, channels: %d, sample rate: %d\n",
sample_name, channels, sample_rate);
printf("is planar: %d, planes: %d\n", planar, num_planes);
/*
* above I print some infomation about mp3 file, they are:
* sample name: s16p, channels: 2, sample rate: 48000
* is planar: 1, planes: 2
*/
getchar();
AVPacket pkt;
av_init_packet(&pkt);
AVFrame *frame = av_frame_alloc();
while (1) {
err = av_read_frame(fmtx, &pkt);
if (err < 0) {
printf("read frame fail\n");
fclose(fout);
exit(-1);
}
if (pkt.stream_index != audio_stream_idx) {
printf("we don't need this stream\n");
continue;
}
printf("data size: %d\n", pkt.size);
int got_frame = 0;
int bytes = avcodec_decode_audio4(decx, frame, &got_frame, &pkt);
if (bytes < 0) {
printf("decode audio fail\n");
continue;
}
printf("frame size: %d, samples: %d\n", bytes, frame->nb_samples);
if (got_frame) {
int input_samples = frame->nb_samples * decx->channels;
int sz = input_samples / num_planes;
short buffer1[input_samples];
for (int j = 0; j < frame->nb_samples; ++j) {
for (int i = 0; i < num_planes; ++i) {
short *d = (short *)frame->data[i];
buffer1[j*2+i] = d[j];
}
}
fwrite(buffer1, input_samples, 2, fout);
} else {
printf("why not get frame???");
}
}
} -
Streaming ffmpeg from fifo file starts only when i close the fifo file
23 June 2022, by tamirgIm starting an ffmpeg process, where the input is a FIFO file i created.
Im writing some data in a loop to the FIFO file, but the ffmpeg process doesn't start streaming until one of the two happens:


- 

- i'm closing the file
- iv'e written a certain amount of data. after a while of writing, the ffmpeg process starts streaming. The more data i write, the faster it starts running. (im writing a chunk of data on each loop, if i just duplicate those chunks times 100, it starts much faster).






What can be the reason for that? Is there a minimum of data required for the ffmpeg process to start streaming? How can i "force" it to start, without closing the FIFO file after writing?


-
How can I convert WebM file to WebP file with transparency?
24 August 2020, by c-anI tried it with ffmpeg.


ffmpeg input.webm output.webp



input.webm
contains transparent background and But the alpha channel becomes white in webp. I think that means alpha channel doesn't come together.

I extracted frames with this command:


ffmpeg -i input.xxx -c:v libwebp output_%03d.webp



And it also gives me webp files with white background.


How can I convert it properly with alpha channel? OR should I convert it from other format(extension)?