
Recherche avancée
Médias (91)
-
Spoon - Revenge !
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
My Morning Jacket - One Big Holiday
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Zap Mama - Wadidyusay ?
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
David Byrne - My Fair Lady
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Beastie Boys - Now Get Busy
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Granite de l’Aber Ildut
9 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
Autres articles (38)
-
Le plugin : Gestion de la mutualisation
2 mars 2010, parLe plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
Installation basique
On installe les fichiers de SPIP sur le serveur.
On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
< ?php (...) -
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation" -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (2573)
-
Multivariate Testing vs A/B Testing (Quick-Start Guide)
7 mars 2024, par Erin -
Resampling audio using libswresample, leaves small amount of noise after resampling
20 juillet 2020, par MiloI'm trying to resample audio from 44Khz to 48Khz and I'm getting s small light noise after resampling. As if someone is gently ticking the mic. This happens both ways. From 48Khz to 44Khz and vice versa.


I've read that this can happen because swrContext still has some data left and that I shoudl flush the context before resampling next frame. And although this helps a little (less noticeable noise), it's still present.


I've tried using FFmpeg resample filter instead, but the output is just loud incoherent noise. I'm pretty sure that libswresample should not output any noise on resampling which means that I just don't know how to use it well and I'm missing some options.


This is the code for resampler.


int ResampleFrame(VideoState * videoState, AVFrame *decoded_audio_frame, enum AVSampleFormat out_sample_fmt, uint8_t * out_buf)
{
 int in_sample_rate = videoState->audio->ptrAudioCodecCtx_->sample_rate;
 int out_sample_rate = SAMPLE_RATE;

// get an instance of the AudioResamplingState struct, create if NULL
AudioResamplingState* arState = getAudioResampling(videoState->audio->ptrAudioCodecCtx_->channel_layout);

if (!arState->swr_ctx)
{
 printf("swr_alloc error.\n");
 return -1;
}

// get input audio channels
arState->in_channel_layout = (videoState->audio->ptrAudioCodecCtx_->channels ==
 av_get_channel_layout_nb_channels(videoState->audio->ptrAudioCodecCtx_->channel_layout)) ?
 videoState->audio->ptrAudioCodecCtx_->channel_layout :
 av_get_default_channel_layout(videoState->audio->ptrAudioCodecCtx_->channels);


// check input audio channels correctly retrieved
if (arState->in_channel_layout <= 0)
{
 printf("in_channel_layout error.\n");
 return -1;
}


arState->out_channel_layout = AV_CH_LAYOUT_STEREO;

// retrieve number of audio samples (per channel)
arState->in_nb_samples = decoded_audio_frame->nb_samples;
if (arState->in_nb_samples <= 0)
{
 printf("in_nb_samples error.\n");
 return -1;
}

// Set SwrContext parameters for resampling
av_opt_set_int(arState->swr_ctx, "in_channel_layout", arState->in_channel_layout, 0);
av_opt_set_int(arState->swr_ctx, "in_sample_rate", in_sample_rate, 0);
av_opt_set_sample_fmt(arState->swr_ctx, "in_sample_fmt", videoState->audio->ptrAudioCodecCtx_->sample_fmt, 0);


// Set SwrContext parameters for resampling
av_opt_set_int(arState->swr_ctx, "out_channel_layout", arState->out_channel_layout, 0);
av_opt_set_int(arState->swr_ctx, "out_sample_rate", out_sample_rate, 0);
av_opt_set_sample_fmt(arState->swr_ctx, "out_sample_fmt", out_sample_fmt, 0);


// initialize SWR context after user parameters have been set
int ret = swr_init(arState->swr_ctx);
if (ret < 0)
 {
 printf("Failed to initialize the resampling context.\n");
 return -1;
 }


 // retrieve output samples number taking into account the progressive delay
int64_t delay = swr_get_delay(arState->swr_ctx, videoState->audio->ptrAudioCodecCtx_->sample_rate) + arState->in_nb_samples;
arState->out_nb_samples = av_rescale_rnd(delay, out_sample_rate, in_sample_rate, AV_ROUND_UP );

// check output samples number was correctly rescaled
if (arState->out_nb_samples <= 0)
{
 printf("av_rescale_rnd error\n");
 return -1;
}

// get number of output audio channels
arState->out_nb_channels = av_get_channel_layout_nb_channels(arState->out_channel_layout);

// allocate data pointers array for arState->resampled_data and fill data
// pointers and linesize accordingly
// check memory allocation for the resampled data was successful
ret = av_samples_alloc_array_and_samples(&arState->resampled_data, &arState->out_linesize, arState->out_nb_channels, arState->out_nb_samples, out_sample_fmt, 0);
if (ret < 0)
 {
 printf("av_samples_alloc_array_and_samples() error: Could not allocate destination samples.\n");
 return -1;
 }


if (arState->swr_ctx)
 {
 // do the actual audio data resampling
 // check audio conversion was successful
 int ret_num_samples = swr_convert(arState->swr_ctx,arState->resampled_data,arState->out_nb_samples,(const uint8_t**)decoded_audio_frame->data, decoded_audio_frame->nb_samples);
 //int ret_num_samples = swr_convert_frame(arState->swr_ctx,arState->resampled_data,arState->out_nb_samples,(const uint8_t**)decoded_audio_frame->data, decoded_audio_frame->nb_samples);

 if (ret_num_samples < 0)
 {
 printf("swr_convert_error.\n");
 return -1;
 }


 // get the required buffer size for the given audio parameters
 // check audio buffer size
 arState->resampled_data_size = av_samples_get_buffer_size(&arState->out_linesize, arState->out_nb_channels,ret_num_samples,out_sample_fmt,1);

 if (arState->resampled_data_size < 0)
 {
 printf("av_samples_get_buffer_size error.\n");
 return -1;
 }
 } else {
 printf("swr_ctx null error.\n");
 return -1;
 }



// copy the resampled data to the output buffer
memcpy(out_buf, arState->resampled_data[0], arState->resampled_data_size);


// flush the swr context
int delayed = swr_convert(arState->swr_ctx,arState->resampled_data,arState->out_nb_samples,NULL,0);



if (arState->resampled_data)
 {
 av_freep(&arState->resampled_data[0]);
 }

av_freep(&arState->resampled_data);
arState->resampled_data = NULL;

int ret_data_size = arState->resampled_data_size;



return ret_data_size;
}



I also tries using the filter as shown here but my output is just noise.


This is my filter code


int ResampleFrame(AVFrame *frame, uint8_t *out_buf)
{
 /* Push the decoded frame into the filtergraph */
 qint32 ret;
 ret = av_buffersrc_add_frame_flags(buffersrc_ctx1, frame, AV_BUFFERSRC_FLAG_KEEP_REF);
 if (ret < 0) 
 {
 printf("ResampleFrame: Error adding frame to buffer\n");
 // Delete input frame and return null
 av_frame_unref(frame);
 return 0;
 }


 //printf("resampling\n");
 AVFrame *resampled_frame = av_frame_alloc();


 /* Pull filtered frames from the filtergraph */
 ret = av_buffersink_get_frame(buffersink_ctx1, resampled_frame);

 /* Set the timestamp on the resampled frame */
 resampled_frame->best_effort_timestamp = resampled_frame->pts;

 if (ret < 0) 
 {
 av_frame_unref(frame);
 av_frame_unref(resampled_frame);
 return 0;
 }


 int buffer_size = av_samples_get_buffer_size(NULL, 2,resampled_frame->nb_samples,AV_SAMPLE_FMT_S16,1);

 memcpy(out_buf,resampled_frame->data,buffer_size);

 //av_frame_unref(frame);
 av_frame_unref(resampled_frame);
 return buffer_size;
}





QString filter_description1 = "aresample=48000,aformat=sample_fmts=s16:channel_layouts=stereo,asetnsamples=n=1024:p=0";

int InitAudioFilter(AVStream *inputStream) 
{

 char args[512];
 int ret;
 const AVFilter *buffersrc = avfilter_get_by_name("abuffer");
 const AVFilter *buffersink = avfilter_get_by_name("abuffersink");
 AVFilterInOut *outputs = avfilter_inout_alloc();
 AVFilterInOut *inputs = avfilter_inout_alloc();
 filter_graph = avfilter_graph_alloc();


 const enum AVSampleFormat out_sample_fmts[] = {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE};
 const int64_t out_channel_layouts[] = {AV_CH_LAYOUT_STEREO, -1};
 const int out_sample_rates[] = {48000, -1};

 snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%" PRIx64,
 inputStream->codec->time_base.num, inputStream->codec->time_base.den,
 inputStream->codec->sample_rate,
 av_get_sample_fmt_name(inputStream->codec->sample_fmt),
 inputStream->codec->channel_layout);


 ret = avfilter_graph_create_filter(&buffersrc_ctx1, buffersrc, "in", args, NULL, filter_graph);

 if (ret < 0) 
 {
 printf("InitAudioFilter: Unable to create buffersrc\n");
 return -1;
 }

 ret = avfilter_graph_create_filter(&buffersink_ctx1, buffersink, "out", NULL, NULL, filter_graph);

 if (ret < 0) 
 {
 printf("InitAudioFilter: Unable to create buffersink\n");
 return ret;
 }

 // set opt SAMPLE FORMATS
 ret = av_opt_set_int_list(buffersink_ctx1, "sample_fmts", out_sample_fmts, -1, AV_OPT_SEARCH_CHILDREN);

 if (ret < 0) 
 {
 printf("InitAudioFilter: Cannot set output sample format\n");
 return ret;
 }

 // set opt CHANNEL LAYOUTS
 ret = av_opt_set_int_list(buffersink_ctx1, "channel_layouts", out_channel_layouts, -1, AV_OPT_SEARCH_CHILDREN);

 if (ret < 0) {
 printf("InitAudioFilter: Cannot set output channel layout\n");
 return ret;
 }

 // set opt OUT SAMPLE RATES
 ret = av_opt_set_int_list(buffersink_ctx1, "sample_rates", out_sample_rates, -1, AV_OPT_SEARCH_CHILDREN);

 if (ret < 0) 
 {
 printf("InitAudioFilter: Cannot set output sample rate\n");
 return ret;
 }

 /* Endpoints for the filter graph. */
 outputs -> name = av_strdup("in");
 outputs -> filter_ctx = buffersrc_ctx1;
 outputs -> pad_idx = 0;
 outputs -> next = NULL;

 /* Endpoints for the filter graph. */
 inputs -> name = av_strdup("out");
 inputs -> filter_ctx = buffersink_ctx1;
 inputs -> pad_idx = 0;
 inputs -> next = NULL;


 if ((ret = avfilter_graph_parse_ptr(filter_graph, filter_description1.toStdString().c_str(), &inputs, &outputs, NULL)) < 0) 
 {
 printf("InitAudioFilter: Could not add the filter to graph\n");
 }


 if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0) 
 {
 printf("InitAudioFilter: Could not configure the graph\n");
 }

 /* Print summary of the sink buffer
 * Note: args buffer is reused to store channel layout string */
 AVFilterLink *outlink = buffersink_ctx1->inputs[0];
 av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout);

 QString str = args;
 printf("Output: srate:%dHz fmt:%s chlayout: %s\n", (int) outlink->sample_rate, 
 av_get_sample_fmt_name((AVSampleFormat) outlink->format),
 str.toStdString().c_str());


 filterGraphInitialized_ = true; 
}



And since I don't have much experience with filters or audio for that matter, I'm also probably missing something here. But Can't figure out what.


Thanks


-
Nexus One
19 mars 2010, par Mans — UncategorizedI have had a Nexus One for about a week (thanks Google), and naturally I have an opinion or two about it.
Hardware
With the front side dominated by a touch-screen and a lone, round button, the Nexus One appearance is similar to that of most contemporary smartphones. The reverse sports a 5 megapixel camera with LED flash, a Google logo, and a smaller HTC logo. Power button, volume control, and headphone and micro-USB sockets are found along the edges. It is with appreciation I note the lack of a front-facing camera ; the silly idea of video calls is finally put to rest.
Powering up the phone (I’m beginning to question the applicability of that word), I am immediately enamoured with the display. At 800×480 pixels, the AMOLED display is crystal-clear and easily viewable even in bright light. In a darker environment, the display automatically dims. The display does have one quirk in that the subpixel pattern doesn’t actually have a full RGB triplet for each pixel. The close-up photo below shows the pattern seen when displaying a solid white colour.
The result of this is that fine vertical lines, particularly red or blue ones, look a bit jagged. Most of the time this is not much of a problem, and I find it an acceptable compromise for the higher effective resolution it provides.
Basic interaction
The Android system is by now familiar, and the Nexus offers no surprises in basic usage. All the usual applications come pre-installed : browser, email, calendar, contacts, maps, and even voice calls. Many of the applications integrate with a Google account, which is nice. Calendar entries, map placemarks, etc. are automatically shared between desktop and mobile. Gone is the need for the bug-ridden custom synchronisation software with which mobile phones of the past were plagued.
Launching applications is mostly speedy, and recently used apps are kept loaded as long as memory needs allow. Although this garbage-collection-style of application management, where you are never quite sure whether an app is still running, takes a few moments of acclimatisation, it works reasonably well in day to day use. Most of the applications are well-behaved and save their data before terminating.
Email
Two email applications are included out of the box : one generic and one Gmail-only. As I do not use Gmail, I cannot comment on this application. The generic email client supports IMAP, but is rather limited in functionality. Fortunately, a much-enhanced version, K-9, is available for download. The main feature I find lacking here is threaded message view.
The features, or lack thereof, in the email applications is not, however, of huge importance, as composing email, or any longer piece of text, is something one rather avoids on a system like this. The on-screen keyboard, while falling among the better of its kind, is still slow to use. Lack of tactile feedback means accidentally tapping the wrong key is easily done, and entering numbers or punctuation is an outright chore.
Browser
Whatever the Nexus lacks in email abilities, it makes up for with the browser. Surfing the web on a phone has never been this pleasant. Page rendering is quick, and zooming is fast and simple. Even pages not designed for mobile viewing are easy to read with smart reformatting almost entirely eliminating the sideways scrolling which hampered many a mobile browser of old.
Calls and messaging
Being a phone, the Nexus One is obviously able to make and receive calls, and it does so with ease. Entering a number or locating a stored contact are both straight-forward operations. During a call, audio is clear and of adequate loudness, although I have yet to use the phone in really noisy surroundings.
The other traditional task of a mobile phone, messaging, is also well-supported. There isn’t really much to say about this.
Multimedia
Having a bit of an interest in most things multimedia, I obviously tested the capabilities of the Nexus by throwing some assorted samples at it, revealing ample space for improvement. With video limited to H.264 and MPEG4, and the only supported audio codecs being AAC, MP3, Vorbis, and AMR, there are many files which will not play.
To make matters worse, only selected combinations of audio and video will play together. Several video files I tested played without sound, yet when presented with the very same audio data alone, it was correctly decoded. As for container formats, it appears restricted to MP4/MOV, and Ogg (for Vorbis). AVI files are recognised as media files, but I was unable to find an AVI file which would play.
With a device clearly capable of so much more, the poor multimedia support is nothing short of embarrassing.
The Market
Much of the hype surrounding Android revolves around the Market, Google’s virtual marketplace for app authors to sell or give away their creations. The thousands of available applications are broadly categorised, and a search function is available.
The categorised lists are divided into free and paid sections, while search results, disappointingly, are not. To aid the decision, ratings and comments are displayed alongside the summary and screenshots of each application. Overall, the process of finding and installing an application is mostly painless. While it could certainly be improved, it could also have been much worse.
The applications themselves are, as hinted above, beyond numerous. Sadly, quality does not quite match up to quantity. The vast majority of the apps are pointless, though occasionally mildly amusing, gimmicks of no practical value. The really good ones, and they do exist, are very hard to find unless one knows precisely what to look for.
Battery
Packing great performance into a pocket-size device comes with a price in battery life. The battery in the Nexus lasts considerably shorter time than that in my older, less feature-packed Nokia phone. To some extent this is probably a result of me actually using it a lot more, yet the end result is the same : more frequent recharging. I should probably get used to the idea of recharging the phone every other night.
Verdict
The Nexus One is a capable hardware platform running an OS with plenty of potential. The applications are still somewhat lacking (or very hard to find), although the basic features work reasonably well. Hopefully future Android updates will see more and better core applications integrated, and I imagine that over time, I will find third-party apps to solve my problems in a way I like. I am not putting this phone on the shelf just yet.