
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (103)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
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 -
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...)
Sur d’autres sites (11187)
-
avformat/mpegtsenc : Preserve disposition in the absence of language
3 avril 2021, par Andreas Rheinhardt -
OpenCV reading from live camera creates a short video that moves quickly
17 novembre 2022, par user19019404I am reading in a live vide stream from a CCTV camera. The camera is set to 5 fps, another is set to 25fps and another to 30fps. Irrespective of the FPS that the camera is set, I can record 5 minutes but end up with a 30 second recorded clip where everyone is running around the scene.


My code is the 'typical' read in video and write video code that you would find online such as (code below simplified for readability) :


import cv2

video = cv2.VideoCapture(live RTSP address of camera)

if (video.isOpened() == False):
 print("Error reading video file")
else:
 frame_width = video.get(cv2.CAP_PROP_FRAME_WIDTH)
 frame_height = video.get(cv2.CAP_PROP_FRAME_HEIGHT)
 frame_fps = video.get(cv2.CAP_PROP_FPS)
 size = (frame_width, frame_height)
 result = cv2.VideoWriter('filename.avi',cv2.VideoWriter_fourcc(*'MJPG'),frame_fps , size)

 while(True):
 ret, frame = video.read()
 if ret == True:
 result.write(frame)
 cv2.imshow('Frame', frame)
 if cv2.waitKey(1) & 0xFF == ord('s'):
 break
 else:
 break
 video.release()
 result.release()
 cv2.destroyAllWindows()
print("The video was successfully saved with new fps")



I have tried playing with the FPS by reading in the FPS from the live camera and using the same FPS in the video write, but all that results is a video that is a fraction of the real time and with people zooming around the scene. So watching a 5 minute smooth video results in a 20 second recorded video with everyone zooming around.


Is this something that I need to fix in the writing of the video or do I need a second pass with ffmpeg to readjust the video ?


Much appreciated


Update, corrected the code above and :
When printing the frames read and the frame written the numbers are the same, showing that each frame that is read is being written (so I am not losing frames along the way thereby writing half the amount of frames).


-
My C++ software uses ffmpeg in streaming mode, but I want to decode the data as quickly as possible, how do I do that ?
14 septembre 2022, par Alexis WilkeWhen I run ffmpeg in my command line to convert an m4a file to mp3, it says ×45 to ×55 for the speed at which is decodes the input data. In this case, the 45 minute audio file gets converter in 2 minutes.


When I run the same process through my C++ code, I stream the data. This is because my code accepts data coming from the network so often it will a little faster to do streaming (unfortunately, not with m4a data since the header is placed at the end of the file...)


However, there seems to be something in ffmpeg that makes it think that if I want to stream the data it needs to be done in realtime. In other words, the frames come through at a speed of ×1 instead of the possible average of ×50.


Is there a flag/setup that I need to turn ON or OFF so the streaming process goes ×50 or so ?



I allocate the context like so :


size_t const avio_buffer_size(4096);
unsigned char * avio_buffer(reinterpret_cast<unsigned char="char">(av_malloc(avio_buffer_size)));
AVIOContext * context(avio_alloc_context(
 avio_buffer
 , avio_buffer_size
 , 0 // write flag
 , this // opaque
 , decoder_read_static
 , nullptr // write func.
 , decoder_seek_static));
</unsigned>


To do the streaming, I use custom I/O in the context :


AVFormatContext * format_context(avformat_alloc_context());
format_context->pb = context;
format_context->flags |= AVFMT_FLAG_CUSTOM_IO;
avformat_open_input(
 &format_context
 , "input" // filename (unused)
 , nullptr // input format
 , nullptr); // options



Next I get the audio stream index :


avformat_find_stream_info(format_context, nullptr);
AVCodec * decoder_codec(nullptr);
int const index(av_find_best_stream(
 format_context
 , AVMEDIA_TYPE_AUDIO
 , -1 // wanted stream number
 , -1 // related stream
 , &decoder_codec
 , 0)); // flags



That has the side effect of telling us which decoder to use :


AVCodecContext * decoder_context = avcodec_alloc_context3(decoder_codec);
avcodec_parameters_to_context(
 decoder_context
 , format_context->streams[index]->codecpar);
avcodec_open2(
 decoder_context
 , decoder_codec
 , nullptr); // options



And finally, I loop through the frames :


AVFrame *frame(av_frame_alloc());
AVPacket av_packet;
av_init_packet(&av_packet);
for(;;)
{
 av_read_frame(format_context, &av_packet);
 if(end-detected)
 {
 break;
 }
 if(av_packet.stream_index != index) continue;
 avcodec_send_packet(decoder_context, &av_packet);
 for(;;)
 {
 avcodec_receive_frame(decoder_context, frame);
 if(end-detected)
 {
 break;
 }
 ...copy data from frame...
 av_frame_unref(frame);
 }
 av_packet_unref(&av_packet);
}



Note : I don't show all the error handling, use of RAII, etc. in an attempt to show the code in its simplest form.