
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (21)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
Sur d’autres sites (7069)
-
How to reconnect using avformat_open_input without having to alloc the decoder again ?
26 septembre 2012, par JonaCurrently, I have a code based on ffplay to stream live content.
One thing I'm looking to do is be able to reconnect upon loosing a connection without having to shutdown the whole decoding process.
To me the solution is alloc the decoder myself once and keep using it across reconnections. I can't seem to figure out how to setup a decoder without having to depend on the
AVFormatContext
. Right now my code is failing when trying to use my own allocatedAVCodecContext
to decode. But it doesn't fail if I use theAVCodecContext
given byAVFormatContext
.This is part of my initial code :
// attempt to find more information about the codec
// also it will open the codecs needed.
fferror = avformat_find_stream_info(ic, NULL);
if (0 > fferror)
{
// TODO verify type of error to better map it to our errors
error = ERROR_FAIL_TO_CONNECT;
LOGE("download() -> avformat_find_stream_info failed! fferror:%d, error:%d", fferror, error);
goto fail;
}
AVCodec *dec;
// select the audio stream
int ret = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0);
if (0 > ret) {
error = ERROR_UNEXPECTED_ERROR;
LOGE("download() -> av_find_best_stream failed! ret:%d, error:%d", ret, error);
goto fail;
}
LOGI("download() -> STREAM: nb_streams:%d", ic->nb_streams);
LOGI("download() -> STREAM: audio format:%s", ic->iformat->name);
LOGI("download() -> STREAM: audio bitrate:%d", ic->bit_rate);
// save the audio stream index and source
is->audio_stream_index = ret;
is->audio_st = ic->streams[is->audio_stream_index];
is->audio_buf_size = 0;
is->audio_buf_index = 0;
is->audio_st->discard = AVDISCARD_DEFAULT;
if(ic->pb) {
ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
}
if (show_status) {
av_dump_format(ic, 0, is->filename, 0);
}
// open codec
error = open_decoder(is->audio_st->codec, dec);
if (ERROR_NO_ERROR != error) {
LOGE("receive_thread() -> open_decoder failed! error:%d", error);
goto fail;
}And this is the funtion that initializes the decoder.
static int open_decoder (AVCodecContext *avctx, AVCodec *codec)
{
int fferror = 0;
AVCodecContext *c = NULL;
if (smDecoder.open) {
LOGW("open_decoder() -> decoder is already open!");
return ERROR_NO_ERROR;
}
// find the decoder
if (!codec)
{
codec = avcodec_find_decoder(avctx->codec_id);
if (!codec)
{
LOGE("open_decoder() -> avcodec_find_decoder failed!");
return ERROR_UNEXPECTED_ERROR;
}
}
// allocate the decoder av context
c = avcodec_alloc_context3(codec);
if (NULL == c) {
LOGE("open_decoder() -> avcodec_alloc_context3 failed! Out of memory?");
return ERROR_UNEXPECTED_ERROR;
}
// check if the type of codec we support
if (AVMEDIA_TYPE_AUDIO != c->codec_type)
{
LOGE("open_decoder() -> codec_type not supported! codec_type:%d",c->codec_type);
return ERROR_UNEXPECTED_ERROR;
}
// set the proper channels if not properly set
if (c->channels > 0) {
c->request_channels = FFMIN(2, c->channels);
} else {
c->request_channels = 2;
}
c->debug_mv = 0;
c->debug = 0;
c->workaround_bugs = workaround_bugs;
c->idct_algo= idct;
if(fast) c->flags2 |= CODEC_FLAG2_FAST;
c->error_concealment= error_concealment;
c->thread_count = thread_count;
// open the decoder
fferror = avcodec_open2(avctx, codec, NULL);
if (fferror < 0)
{
LOGE("open_decoder() -> avcodec_open2 failed! fferror:%d", fferror);
return ERROR_UNEXPECTED_ERROR;
}
// clean up our reusable packet
memset(&smDecoder.audio_pkt, 0, sizeof(smDecoder.audio_pkt));
smDecoder.open = 1;
smDecoder.codec = codec;
smDecoder.avctx = c;
return ERROR_NO_ERROR;
} -
"File descriptor in bad state" error while running ffmpeg on android device and selecting an input device
25 août 2012, par user1545779Below is the output of the ffmpeg command :# ./ffmpeg -y -f s16le -i /dev/snd/pcmC3D0c 1640.wmv -to create an audio file from a Logitech webcam on an android device.
As shown in the output, I received a File descriptor in bad state error for referring to the mic input as /dev/snd/pcmC3D0c I determined the value of the device (webcam mic) by reviewing the contents of /proc/asound. The webcam mic was card3 and its STREAM0 file indicated that the mic has an audio format of format S16_LE
It was also confirmed that it is a capture device and its' pcm id was pcmC3D0c (C3 being the card number and D0 being the Device number. I then confirmed the correct device by checking the /dev/snd/ directory to confirm its proper and full description. The /dev/snd folder confirmed that the mic was /dev/snd/pcmC3D0c
I then checked the permissions and ownership to make sure that I could use that device. Hence as far as identifying the correct device to used I do believe that /dev/snd/pcmC3D0c is the correct device. I do believe this error could possibly have something to do with the OS, however after all these checks, I still cannot figure out what is giving the bad file descriptor state error.
Please note that I tested for different output formats, etc and that did not make any difference. Any leads or suggestions ?
# ./ffmpeg -y -f s16le -i /dev/snd/pcmC3D0c 1640.wmv
ffmpeg version N-43170-gd84dd35 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 24 2012 09:16:05 with gcc 4.4.3 (GCC) configuration : —enable-cross-compile —arch=arm —cpu=cortex-a9 —target-os=linux —enable-runtime-cpudetect —prefix=/output —enable-pic —cross-prefix=/home/jasongipsyblues/Desktop/apps/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- —sysroot=/home/jasongipsyblues/Desktop/apps/android-ndk-r8b/platforms/android-14/arch-arm —enable-version3 —enable-gpl —enable-memalign-hack —disable-doc —enable-yasm —enable-libx264 —enable-zlib —extra-cflags=-I../x264 —extra-ldflags='-L../x264 -lc'libavutil 51. 66.100 / 51. 66.100
libavcodec 54. 48.100 / 54. 48.100
libavformat 54. 22.100 / 54. 22.100
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 5.102 / 3. 5.102
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100[s16le @ 0xfd84f0] Invalid sample rate 0 specified using default of 44100
[s16le @ 0xfd84f0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, s16le, from '/dev/snd/pcmC3D0c' :
Duration : N/A, bitrate : 705 kb/s
Stream #0:0 : Audio : pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, asf, to '1640.wmv' :
Metadata :
WM/EncodingSettings : Lavf54.22.100
Stream #0:0 : Audio : wmav2 (a[1][0][0] / 0x0161), 44100 Hz, mono, s16, 128 kb/s
Stream mapping :
Stream #0:0 -> #0:0 (pcm_s16le -> wmav2)
Press [q] to stop, [?] for help
/dev/snd/pcmC3D0c : File descriptor in bad state
size= 1kB time=00:00:00.00 bitrate= 0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 5340.000000% -
Open stream with FFmpeg libavformat exits with I/O error after once in Android Application
15 février 2015, par miazimaI am trying to open a video stream in an android application. The first time I open the stream, the stream is opened and everything runs fine. However, if I press back and open the stream again, the app crashes.
I am a newbie to this, so I used log statements to see if the argument values for the methods could lead me to the issue. I figured out that
avformat_open_input(&ic, is->filename, is->iformat, NULL)
is returning I/O error. However I can’t figure out where the error lies, the filename and the format is the same but am not sure about the&ic
which is fromis->ic = (AVFormatContext*) avformat_alloc_context()
, I would appreciate any help !void get_video_info(int p_debug, const char* path) {
int flags;
//VideoState *is;
int err, i, orig_nb_streams, ret;
isquit = 0;
av_log_set_flags(AV_LOG_SKIP_REPEATED);
int st_index[3];
st_index[AVMEDIA_TYPE_AUDIO]=-1;
st_index[AVMEDIA_TYPE_VIDEO]=-1;
/* register all codecs, demux and protocols */
avcodec_register_all();
#if CONFIG_AVDEVICE
avdevice_register_all();
#endif
#if CONFIG_AVFILTER
avfilter_register_all();
#endif
av_register_all();
#if CONFIG_NETWORK
ret = avformat_network_init();
#endif
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {
fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
exit(1);
}
av_init_packet(&flush_pkt);
flush_pkt.data = "FLUSH";
// open video stream
is = av_mallocz(sizeof(VideoState));
if (!is) {
do_exit(NULL);
return;
}
is->abort_request = 0; // FIXME: abort_request changes when on closing or exit
is->pictq_mutex = SDL_CreateMutex();
is->pictq_cond = SDL_CreateCond();
is->pictq_size = 0;
is->pictq_rindex = 0;
is->pictq_windex = 0;
is->av_sync_type = av_sync_type;//AV_SYNC_AUDIO_MASTER;//
if(path != NULL)
{
av_strlcpy(is->filename, path, sizeof(is->filename));
}
else
{
if(streamProtocal==0) {
av_strlcpy(is->filename, "/sdcard/download/sdp_file.sdp", sizeof(is->filename));
}
else
{
av_strlcpy(is->filename, "udp://@:3001", sizeof(is->filename));
is->iformat = av_find_input_format("m4v");
}
}
is->ic = (AVFormatContext*) avformat_alloc_context();
//It is assumed that server always sends m4v data, so that codec search can be avoided
AVFormatContext *ic = is->ic;
if ((err = avformat_open_input(&ic, is->filename, is->iformat, NULL))
!= 0) {
LOGE(1, "Error open video file: %s", is->filename);
char* error = (char*)malloc(1024);
av_strerror(err, error, 1024);
LOGE(1, "Error open video file: %s", error);
do_exit(is);
}
LOGE(1, "entered get_video_info");
is->ic = ic;
orig_nb_streams = ic->nb_streams;
if ((err = avformat_find_stream_info(is->ic, NULL)) < 0) {
LOGE(1, "Error find stream information: %d", err);
return;
}
LOGE(1, "avformat_find_stream_info");
if(is->ic->pb)
is->ic->pb->eof_reached= 0;//FIXME hack, ffplay maybe should not use url_feof() to test for the end
AVCodec *lvideoCodec;
int g_audio_file_type = 0;
// Find the first video stream
for (i=0; iic->nb_streams; i++) {
//take video stream only for video file types
if (g_audio_file_type == 0) {
if (is->ic->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO &&
st_index[AVMEDIA_TYPE_VIDEO] < 0)
{
st_index[AVMEDIA_TYPE_VIDEO]=i;
}
}
if(is->ic->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO &&
st_index[AVMEDIA_TYPE_AUDIO] < 0)
{
st_index[AVMEDIA_TYPE_AUDIO]=i;
}
}
if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) {
stream_component_open(is, st_index[AVMEDIA_TYPE_AUDIO]);
}
if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) {
stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]);
}
if (is->video_stream < 0) {
do_exit(is);
return;
}
is->read_tid = SDL_CreateThread(read_thread, is);
rgb_frame = avcodec_alloc_frame();
}