
Recherche avancée
Autres articles (49)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
Sur d’autres sites (5469)
-
Revision 35436 : Petites pétouilles en passant par là (écriture aux dernières normes ...
22 février 2010, par marcimat@… — LogPetites pétouilles en passant par là (écriture aux dernières normes ISO)…
-
FFmpeg RTP : Bad packed header lengths
13 septembre 2016, par bot1131357I use the
av_sdp_create()
to generate my SDP file but I think something’s wrong. Here is the output :Output #0, rtp, to 'rtp://127.0.0.1:8554':
Stream #0:0: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp, 64 kb/s
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 57.25.101
m=audio 8554 RTP/AVP 96
b=AS:64
a=rtpmap:96 vorbis/44100/2
a=fmtp:96 configuration=AAAAAf7Nug7RAh4AAXZvcmJpcwAAAAACRKwAAP////8A+gAA/////7gBBXZvcmJpcyFCQ1YBAAABABhjVClGmVLSSokZc5QxRplikkqJpYQWQkidcxRTqTnXnGusubUghBAaU1ApBZlSjlJpGWOQKQWZUhBLSSV0EjonnWMQW0nB1phri0G2HIQNmlJMKcSUUopCCBlTjCnFlFJKQgcldA465hxTjkooQbicc6u1lpZji6l0kkrnJGRMQkgphZJKB6VTTkJINZbWUikdc1JSakHoIIQQQrYghA2C0JBVAAABAMBAEBqyCgBQAAAQiqEYigKEhqwCADIAAASgKI7iKI4jOZJjSRYQGrIKAAACABAAAMBwFEmRFMmxJEvSLEvTRFFVfdU2VVX2dV3XdV3XdSA0ZBUAAAEAQEinmaUaIMIMZBgIDVkFACAAAABGKMIQA0JDVgEAAAEAAGIoOYgmtOZ8c46DZjloKsXmdHAi1eZJbirm5pxzzjknm3PGOOecc4pyZjFoJrTmnHMSg2YpaCa05pxznsTmQWuqtOacc8Y5p4NxRhjnnHOatOZBajbW5pxzFrSmOWouxeaccyLl5kltLtXmnHPOOeecc84555xzqhenc3BOOOecc6L25lpuQhfnnHM+Gad7c0I455xzzjnnnHPOOeecc4LQkFUAABAAAEEYNoZxpyBIn6OBGEWIacikB92jwyRoDHIKqUejo5FS6iCUVMZJKZ0gNGQVAAAIAAAhhBRSSCGFFFJIIYUUUoghhhhiyCmnnIIKKqmkoooyyiyzzDLLLLPMMuuws8467DDEEEMMrbQSS0211VhjrbnnnGIf I try to use the SDP file anyway, I get the following message :
>ffplay -i test2.sdp -protocol_whitelist file,udp,rtp
ffplay version N-78598-g98a0053 Copyright (c) 2003-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 18.100 / 55. 18.100
libavcodec 57. 24.103 / 57. 24.103
libavformat 57. 25.101 / 57. 25.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 34.100 / 6. 34.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[NULL @ 05aea880] Bad packed header lengths (30,0,616,3793) f=0/0
[vorbis @ 05aea880] Extradata missing.
[sdp @ 05ad7ec0] Failed to open codec in av_find_stream_info
nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0Am I overlooking something important ? Am I going about this the wrong way ? Any help would be much appreciated.
Here is my source :
#include "stdafx.h"
#include
extern "C"
{
#include <libavutil></libavutil>opt.h>
#include <libavcodec></libavcodec>avcodec.h>
#include <libavutil></libavutil>channel_layout.h>
#include <libavutil></libavutil>common.h>
#include <libavutil></libavutil>imgutils.h>
#include <libavutil></libavutil>mathematics.h>
#include <libavutil></libavutil>samplefmt.h>
#include <libavformat></libavformat>avformat.h>
}
/* check that a given sample format is supported by the encoder */
static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt)
{
const enum AVSampleFormat *p = codec->sample_fmts;
while (*p != AV_SAMPLE_FMT_NONE) {
if (*p == sample_fmt)
return 1;
p++;
}
return 0;
}
/* just pick the highest supported samplerate */
static int select_sample_rate(AVCodec *codec)
{
const int *p;
int best_samplerate = 0;
if (!codec->supported_samplerates)
return 44100;
p = codec->supported_samplerates;
while (*p) {
best_samplerate = FFMAX(*p, best_samplerate);
p++;
}
return best_samplerate;
}
/* select layout with the highest channel count */
static int select_channel_layout(AVCodec *codec)
{
const uint64_t *p;
uint64_t best_ch_layout = 0;
int best_nb_channels = 0;
if (!codec->channel_layouts)
return AV_CH_LAYOUT_STEREO;
p = codec->channel_layouts;
while (*p) {
int nb_channels = av_get_channel_layout_nb_channels(*p);
if (nb_channels > best_nb_channels) {
best_ch_layout = *p;
best_nb_channels = nb_channels;
}
p++;
}
return best_ch_layout;
}
static int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt)
{
/* rescale output packet timestamp values from codec to stream timebase */
av_packet_rescale_ts(pkt, *time_base, st->time_base);
/* Write the compressed frame to the media file. */
return av_interleaved_write_frame(fmt_ctx, pkt);
}
/*
* Audio encoding example
*/
static void audio_encode_example(const char *filename)
{
AVPacket pkt;
int i, j, k, ret, got_output;
int buffer_size;
uint16_t *samples;
float t, tincr;
AVCodec *outCodec = NULL;
AVCodecContext *outCodecCtx = NULL;
AVFormatContext *outFormatCtx = NULL;
AVStream * outAudioStream = NULL;
AVFrame *outFrame = NULL;
ret = avformat_alloc_output_context2(&outFormatCtx, NULL, "rtp", filename);
if (!outFormatCtx || ret < 0)
{
fprintf(stderr, "Could not allocate output context");
}
outFormatCtx->flags |= AVFMT_FLAG_NOBUFFER | AVFMT_FLAG_FLUSH_PACKETS;
outFormatCtx->max_interleave_delta = 1;
outFormatCtx->oformat->audio_codec = AV_CODEC_ID_VORBIS;
/* find the encoder */
outCodec = avcodec_find_encoder(outFormatCtx->oformat->audio_codec);
if (!outCodec) {
fprintf(stderr, "Codec not found\n");
exit(1);
}
outAudioStream = avformat_new_stream(outFormatCtx, outCodec);
if (!outAudioStream)
{
fprintf(stderr, "Cannot add new audio stream\n");
exit(1);
}
outAudioStream->id = outFormatCtx->nb_streams - 1;
outAudioStream->time_base.den = 44100; // 44.100 kHz
outAudioStream->time_base.num = 1;
outCodecCtx = outAudioStream->codec;
outCodecCtx->bit_rate = 64000;
outCodecCtx->time_base.den = outAudioStream->time_base.den;
outCodecCtx->time_base.num = outAudioStream->time_base.num;
/* check that the encoder supports input */
outCodecCtx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (!check_sample_fmt(outCodec, outCodecCtx->sample_fmt)) {
fprintf(stderr, "Encoder does not support sample format %s",
av_get_sample_fmt_name(outCodecCtx->sample_fmt));
exit(1);
}
/* select other audio parameters supported by the encoder */
outCodecCtx->sample_rate = select_sample_rate(outCodec);
outCodecCtx->channel_layout = select_channel_layout(outCodec);
outCodecCtx->channels = av_get_channel_layout_nb_channels(outCodecCtx->channel_layout);
/* open it */
if (avcodec_open2(outCodecCtx, outCodec, NULL) < 0) {
fprintf(stderr, "Could not open codec\n");
exit(1);
}
av_dump_format(outFormatCtx, 0, filename, 1);
char buff[2048] = { 0 };
av_sdp_create(&outFormatCtx, 1, buff, 1024);
printf("%s", buff);
(...SDP printed here...)
ret = avio_open2(&outFormatCtx->pb, filename, AVIO_FLAG_WRITE, NULL, NULL);
ret = avformat_write_header(outFormatCtx, NULL);
printf("ret = %d\n", ret);
if (ret <0)
exit(1);
/* frame containing input audio */
outFrame = av_frame_alloc();
if (!outFrame) {
fprintf(stderr, "Could not allocate audio frame\n");
exit(1);
}
outFrame->nb_samples = outCodecCtx->frame_size;
outFrame->format = outCodecCtx->sample_fmt;
outFrame->channel_layout = outCodecCtx->channel_layout;
/* the codec gives us the frame size, in samples,
* we calculate the size of the samples buffer in bytes */
buffer_size = av_samples_get_buffer_size(NULL, outCodecCtx->channels, outCodecCtx->frame_size,
outCodecCtx->sample_fmt, 0);
if (buffer_size < 0) {
fprintf(stderr, "Could not get sample buffer size\n");
exit(1);
}
samples = (uint16_t*)av_malloc(buffer_size);
if (!samples) {
fprintf(stderr, "Could not allocate %d bytes for samples buffer\n",
buffer_size);
exit(1);
}
/* setup the data pointers in the AVFrame */
ret = avcodec_fill_audio_frame(outFrame, outCodecCtx->channels, outCodecCtx->sample_fmt,
(const uint8_t*)samples, buffer_size, 0);
if (ret < 0) {
fprintf(stderr, "Could not setup audio frame\n");
exit(1);
}
/* encode a single tone sound */
t = 0;
int next_pts = 0;
tincr = 2 * M_PI * 440.0 / outCodecCtx->sample_rate;
for (i = 0; i < 44000; i++) {
av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
for (j = 0; j < outCodecCtx->frame_size; j++) {
samples[2 * j] = (int)(sin(t) * 10000);
for (k = 1; k < outCodecCtx->channels; k++)
samples[2 * j + k] = samples[2 * j];
t += tincr;
}
// Sets time stamp
next_pts += outFrame->nb_samples;
outFrame->pts = next_pts;
/* encode the samples */
ret = avcodec_encode_audio2(outCodecCtx, &pkt, outFrame, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding audio frame\n");
exit(1);
}
if (got_output) {
//fwrite(pkt.data, 1, pkt.size, f);
//pkt.stream_index = pktidx++;
write_frame(outFormatCtx, &outCodecCtx->time_base, outAudioStream, &pkt);
av_packet_unref(&pkt);
}
}
/* get the delayed frames */
for (got_output = 1; got_output; i++) {
ret = avcodec_encode_audio2(outCodecCtx, &pkt, NULL, &got_output);
if (ret < 0) {
fprintf(stderr, "Error encoding frame\n");
exit(1);
}
if (got_output) {
//fwrite(pkt.data, 1, pkt.size, f);
pkt.pts = AV_NOPTS_VALUE;
write_frame(outFormatCtx, &outCodecCtx->time_base, outAudioStream, &pkt);
av_packet_unref(&pkt);
}
}
av_freep(&samples);
av_frame_free(&outFrame);
avcodec_close(outCodecCtx);
av_free(outCodecCtx);
}
int main(int argc, char **argv)
{
const char *output;
/* register all the codecs */
//avcodec_register_all();
av_register_all();
avformat_network_init(); // for network streaming
audio_encode_example("rtp://127.0.0.1:8554");
return 0;
} -
omxplayer AVPacket
6 février 2013, par Oleksandr KyrpaHi Im trying decode video usin OpenMax component and hello_video example from GitHub.
I simply edit video.c and replace "main frame while" on AVFormat -read frame packet for read not only *.h264 files . (I need read mp4, mov, mkv....)..
So with test.h264 files and other files that I generate with ffmpeg, all works fine and on screen I can see movie.ffmpeg -i file.mp4 -vcodec copy -vbsf h264_mp4toannexb out.h264
But if I open test.mp4 file I can't see pictures on the screen, and log in console show me that data read correctly and parsed to the input buffer of the video decoder correctly.
Can any explain me why I can't see anything on the screen on second test ?do{
printf("###before DO!\n");
status=av_read_frame(pFormatCtx,&packet);
//only for video
if(packet.stream_index==*video_stream_index){
printf("=>Read frame, status: %d, index: %d, stream index: %d, packet duration: %d, size: %d\n",pstatus,index++,packet.stream_index,packet.duration,packet.size);
int psize=packet.size;
int preaded=0;
double pts=packet.duration;
while(psize!=0){
buf = ilclient_get_input_buffer(video_decode, 130, 1);
buf->nFlags = 0;
buf->nOffset = 0;
uint64_t val = (uint64_t)(pts == DVD_NOPTS_VALUE) ? 0 : pts;
if(first_frame==true){buf->nFlags = OMX_BUFFERFLAG_STARTTIME;first_frame=false;}else{buf->nFlags = OMX_BUFFERFLAG_TIME_UNKNOWN;}
buf->nTimeStamp = ToOMXTime(val);
buf->nFilledLen = (psize > buf->nAllocLen) ? buf->nAllocLen : psize;
memcpy(buf->pBuffer, packet.data+preaded,buf->nFilledLen);
psize-=buf->nFilledLen;
preaded+=buf->nFilledLen;
if(psize == 0){buf->nFlags|=OMX_BUFFERFLAG_ENDOFFRAME;printf("#######################################OMX_BUFFERFLAG_ENDOFFRAME\n");}
printf("=>BUFF size: %d\n",buf->nFilledLen);
OMX_ERRORTYPE r;
if(pstatus==0){if(r=OMX_EmptyThisBuffer(ILC_GET_HANDLE(video_decode), buf) != OMX_ErrorNone){status = -6;printf("Failed, OMX_EmptyThisBuffer, error: 0x%08x , buf allocate: %d, buf lenght: %d \n", r,buf->nAllocLen,buf->nFilledLen);break;}}
}//while psize
av_free_packet(&packet);
}//if index
}//do
while(pstatus==0);