
Recherche avancée
Autres articles (94)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (5199)
-
Why android video player that based on ffmpeg can't sync video' time and audio's time ?
6 juillet 2021, par ZSpirytusBackground


Recently, I use ffmpeg to write my first Android video player. But video channel's time is faster than audio channel's time about 2 3 times.


Question


Why android video player audio and video is out of sync ? Video is about faster than audio 2 3 times. Thanks for your reading and answers.


Code


In short, I use PacketDispatcher to read AVPacket from http hlv source :


void PacketDispatcher::RealDispatch() {
 while (GetStatus() != DISPATCHER_STOP) {
 ...

 AVPacket *av_packet = av_packet_alloc();
 int ret = av_read_frame(av_format_context, av_packet);

 // PacketDispatcher is who read the AVPacket from http hlv source 
 // and dispatch to decoder by its stream index.
 decoder_map[av_packet->stream_index]->Push(av_packet);
 }
}



And then, Decoder written by Producer-Consumer Pattern, Decoder maintain a queue that store all the AVPacket received from PacketDispatcher. The code like this :


// write to the queue
void BaseDecoder::Push(AVPacket *av_packet) {
 ...
 av_packet_queue.push(av_packet);
 ...
}

// real decode logic
void BaseDecoder::RealDecode() {
 ...
 while (true) {
 // read frame from codec
 AVFrame *av_frame = av_frame_alloc();
 ret = avcodec_receive_frame(av_codec_ctx, av_frame);

 void *decode_result = DecodeFrame(av_frame);
 // send to render
 m_render->Render(decode_result);
 }
}



And then, I do rendering logic in Render. Render also written by Producer-Consumer Pattern, it maintain a queue that store AVFrame received from Decoder, the code like this :


// write AVFrame
void BaseRender::Render(void *frame_data) {
 ...
 frame_queue.push(frame_data);
 ...
}

// render to surface or Open SL
void BaseRender::RealRender() {
 if (m_render_synchronizer && m_render_synchronizer->Sync(frame_data)) {
 continue;
 }
}



Finally, the synchronizer will decide to sleep time or drop video frame according to the frame pts, frame pts is :


frame_data->pts = av_frame->best_effort_timestamp * av_q2d(GetTimeBase());



Also, video extra delay is :


frame_data->video_extra_delay = av_frame->repeat_pict * 1.0 / fps * 2.0;



RenderSynchronizer code like this :


bool RenderSynchronizer::Sync(void *frame_data) {
 auto base_frame_data = static_cast<baseframedata>(frame_data);
 if (base_frame_data->media_type == AVMEDIA_TYPE_AUDIO) {
 audio_pts = pcm_data->pts;
 return false;
 } else if (base_frame_data->media_type == AVMEDIA_TYPE_VIDEO) {
 video_pts = rgba_data->pts;
 return ReceiveVideoFrame(static_cast<rgbadata>(frame_data));
 }
 return false;
}

bool RenderSynchronizer::ReceiveVideoFrame(RGBAData *rgba_data) {
 if (audio_pts <= 0 || video_pts <= 0) {
 return false;
 }

 double diff = video_pts - audio_pts;
 if (diff > 0) {
 if (diff > 1) {
 av_usleep((unsigned int) (rgba_data->extra_delay * 1000000.0));
 } else {
 av_usleep((unsigned int) ((diff + rgba_data->extra_delay) * 1000000.0));
 }
 return false;
 } else if (diff < 0) {
 LOGD(TAG, "drop video frame");
 return true;
 } else {
 return false;
 }
}
</rgbadata></baseframedata>


-
Revision b04d766800 : Use small transform size in non-rd real-time mode In non-rd real-time mode, cho
30 mai 2014, par Yunqing WangChanged Paths :
Modify /vp9/encoder/vp9_encodeframe.c
Modify /vp9/encoder/vp9_speed_features.c
Modify /vp9/encoder/vp9_speed_features.h
Use small transform size in non-rd real-time modeIn non-rd real-time mode, choosing smaller transform size in
encoding gives better video quality and good speed gain than
choosing larger transform size. This patch set tx size search
method to ALLOW_8X8, which is better than using 4x4 or other
larger sizes.Borg tests on rtc set at speed 6 showed significant gain on quality.
PSNR gain : 11.034% and SSIM gain : 15.466%.The speed gain is 5% - 12% for <720p clips, and 2% - 7% for
720p clips.Change-Id : If4dc74ed2df359346b059f47fb73b4a0193ec548
-
how to play edited videos in mvp
19 avril 2021, par Eswar Thow to play edited videos(before exporting them) like how we can play in ffplay like here an example in ffplay so can we also play them using MVP if yes please convert this command thank you


ffplay -i 1.mp4 -ss 00:00:30.100 -t 00:00:10 -af volume=2.0,atempo=2.0-vf transpose=0,transpose=0,setpts=1/0.5*PTS,fps=30) 



and using a playlist how can we play multiple edited files like


ffplay -i 1.mp4 -ss 00:00:30.100 -t 00:00:10 -af volume=2.0,atempo=2.0-vf transpose=0,transpose=0,setpts=1/0.5*PTS,fps=30) && ffplay -i 2.mp4 -ss 00:00:30.100 -t 00:00:10 -af volume=2.0,atempo=2.0-vf transpose=0,transpose=0,setpts=1/0.5*PTS,fps=30)



thank you