
Recherche avancée
Médias (1)
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
Autres articles (52)
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
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 (...)
-
Soumettre améliorations et plugins supplémentaires
10 avril 2011Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)
Sur d’autres sites (8980)
-
how to kill a thread which hang up and release resources [duplicate]
15 octobre 2019, par DJI_loverThis question already has an answer here :
-
How do I terminate a thread in C++11 ?
5 answers
I am doing some jobs in ubuntu with c++.I want to know how to kill a thread when function blocking in a thread and there is no timeout mechanism for this function. I want to force to kill the thread when function is blocking and release all the resources in the thread and then restart the thread.I can’t set a quit flag in thread because it nerver get there when function hang up.Could someone tell me the better way to do this ? Thanks !
Code :
static int encode_and_write_frame(AVCodecContext *codec_ctx, AVFormatContext *fmt_ctx, AVFrame *frame)
{
AVPacket pkt = {0};
av_init_packet(&pkt);
int ret = avcodec_send_frame(codec_ctx, frame);
if (ret < 0)
{
fprintf(stderr, "Error sending frame to codec context!\n");
return ret;
}
ret = avcodec_receive_packet(codec_ctx, &pkt);
if (ret < 0)
{
fprintf(stderr, "Error receiving packet from codec context!\n" );
return ret;
}
int ret1 = av_interleaved_write_frame(fmt_ctx, &pkt);
av_packet_unref(&pkt);
return ret1;
}
void thread_worker(){
while(ros::ok()){
encode_and_write_frame(param1,param2,param3);
usleep(500000);
}
}
thread t(&thread_worker);when the network situation is good, av_interleaved_write_frame() can return quickly,but when network was broken down, av_interleaved_write_frame() will hang forever, and I can’t set timeout for av_interleaved_write_frame so that I want to kill the blocking thread and restart it.
-
How do I terminate a thread in C++11 ?
-
Can't find error in function for changing sampling rate
29 avril 2024, par kitty uwuI have function for changing sampling rate of audio (only one channel) :


int change_sampling_rate(float *audio_input, int input_sample_rate, int output_sample_rate, int input_num_of_samples, float **audio_output, int *result_num_of_samples) {
 AVChannelLayout src_ch_layout = AV_CHANNEL_LAYOUT_MONO;
 AVChannelLayout dst_ch_layout = AV_CHANNEL_LAYOUT_MONO;

 struct SwrContext *swr_ctx;
 swr_ctx = swr_alloc();
 int ret;
 if (!swr_ctx) {
 fprintf(stderr, "Could not allocate resampler context\n");
 ret = AVERROR(ENOMEM);
 }

 av_opt_set_chlayout(swr_ctx, "in_chlayout", &src_ch_layout, 0);
 av_opt_set_int(swr_ctx, "in_sample_rate", input_sample_rate, 0);
 av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_FLT, 0);

 av_opt_set_chlayout(swr_ctx, "out_chlayout", &dst_ch_layout, 0);
 av_opt_set_int(swr_ctx, "out_sample_rate", output_sample_rate, 0);
 av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_FLT, 0);

 if ((ret = swr_init(swr_ctx)) < 0) {
 fprintf(stderr, "Failed to initialize the resampling context\n");
 return -1;
 }

 int output_samples_count = av_rescale_rnd(swr_get_delay(swr_ctx, input_sample_rate) + input_num_of_samples, output_sample_rate, input_sample_rate, AV_ROUND_UP);
 uint8_t **resampled_data = NULL;
 if (av_samples_alloc_array_and_samples(&resampled_data, NULL, 1, output_samples_count, AV_SAMPLE_FMT_FLT, 0) < 0) {
 fprintf(stderr, "Could not allocate resampled data\n");
 swr_free(&swr_ctx);
 return -1;
 }

 const uint8_t *in_samples[1] = {(const uint8_t *)audio_input};
 int frame_count = swr_convert(swr_ctx, resampled_data, output_samples_count, in_samples, input_num_of_samples);

 if (frame_count < 0) {
 fprintf(stderr, "Error while resampling\n");
 av_freep(&resampled_data[0]);
 free(resampled_data);
 swr_free(&swr_ctx);
 return -1;
 }

 *audio_output = (float *) malloc(frame_count * sizeof(float));
 if (!*audio_output) {
 fprintf(stderr, "Could not allocate memory for output\n");
 av_freep(&resampled_data[0]);
 free(resampled_data);
 swr_free(&swr_ctx);
 return -1;
 }

 memcpy(*audio_output, resampled_data[0], frame_count * sizeof(float));

 *result_num_of_samples = frame_count;
 av_freep(&resampled_data[0]);
 swr_free(&swr_ctx);
 return SUCCESS;
}



When I run tests on time lag between two files (mp3) with different sampling rates, it gives answer that differs on about 15-20 ms with right answer. Can anybody, please, help me find mistakes in the code ?


For example, I have two audios : [audio_1] (https://jmp.sh/s/USFPaGnHXVuKFVYarYpm) and [audio_2] (https://jmp.sh/s/jbmWbPTwkdDujAocmi56) - second audio is just a sample of first. The answer should be
35264 ms
, but my function gives35249 ms
:(

-
Concatenate two mp4 files using FFmpeg with Android
4 juillet 2013, par vijayI need to merge video files in Android using FFmpeg.I used the code from halfninja and passed the following parameters to run method in Videokit.c.
ffmpeg -i "concat:input1.mpg|input2.mpg" -c copy output.mpg
It causes error when these parameters are passed from Android through JNI. Then i replaced
-c copy
with-vcodec copy -acodec copy
.It worked fine.Now i tried to concat two .mp4 files / two .3gp files by using the above method and my output format is mp4.The output file is generated but it is empty(0kb).
When i googled it out, i was asked to convert all mp4 or 3gp files into mpg and then concat it and again convert back to mp4 in the following post :
Concatenate mp4 files in Android using halfninja ffmpeg (Refer Steven Penny's answer).
But i have problems(only first input file is converted and the app exits) when converting and storing the intermediate file(i am calling run method thrice).Also this method stores all the input files in the device sdcard and this should not be done.
-c copy
works fine when passing parameters for ffmpeg executable(generated when ndk-build is made) through terminal but it throws an error "unrecognized option c" when called through JNI from android device.Can anyone let me know why this happens ?When we look at Steven's answer, we have to call the run method multiple times to covert all the input files and one more time to concat all these.Is it possible to it in a single call ?
Is it possible to concat video files with different formats without storing the input files in device(mp4+mp4, mp4+3gp,3gp+3gp are my possible combinations of input) ?
Any help is appreciated.