
Recherche avancée
Médias (91)
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
-
USGS Real-time Earthquakes
8 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (61)
-
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...) -
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 (...)
Sur d’autres sites (3956)
-
How can I save the h264 encoded video as a sequence of AVPacket-s to the file using libav c++ ?
8 juillet 2023, par danvik13I'm trying to save video, which is generated and encoded on fly using libav (ffmpeg) functional. When I receive next non-empty AVPacket with encoded frame, I call writer.saveNextPacket() method.
Of cause, before saving, I properly init both codec and filewriter and close them in the very ending.
Here is some code :


#include "utils/FileWriter.h"

#define DEBUG 1

void tp::utils::FileWriter::open(const char* path, tp::encoders::IEncoder* encoder) {
 int hr;

 debI("guessing");
 format = av_guess_format(nullptr, path, nullptr);
 if (!format){
 debI("av_guess_format");
 }

 debI("allocating output");
 hr = avformat_alloc_output_context2(&formatContext, format, nullptr, nullptr);
 if (hr < 0){
 debI("avformat_alloc_output_context2", hr);
 }

 debI("allocating stream");
 stream = avformat_new_stream(formatContext, nullptr);
 if (!stream){
 debI("avformat_new_stream");
 }
 debI("setting parameters");
 AVCodecParameters* parameters = avcodec_parameters_alloc();
 hr = avcodec_parameters_from_context(parameters, encoder->getCodecContext());
 if (hr < 0){
 debI("avcodec_parameters_from_context", hr);
 }

 stream->codecpar = parameters;

 debI("opening");
 hr = avio_open(&formatContext->pb, path, AVIO_FLAG_WRITE);
 if (hr < 0){
 debI("avio_open", hr);
 }

 debI("writing headers");
 hr = avformat_write_header(formatContext, nullptr);
 if (hr < 0){
 debI("avformat_write_header", hr);
 }
 debI("writer is set");
}

#define DEBUG 0

void tp::utils::FileWriter::saveNextPacket(AVPacket* packet) {
 int hr;

 hr = av_interleaved_write_frame(formatContext, packet);
 if (hr < 0){
 logF("av_write_frame", hr);
 }
}

void tp::utils::FileWriter::close() {
 int hr;

 hr = av_write_trailer(formatContext);
 if (hr < 0){
 logF("av_write_trailer", hr);
 }

 hr = avio_close(formatContext->pb);
 if (hr < 0){
 logF("avio_close", hr);
 }

 avformat_free_context(formatContext);
}




Here is the setup part of the encoder :


codec = avcodec_find_encoder(AV_CODEC_ID_H264);
 if (!codec){
 logF("avcodec_find_encoder", hr);
 }
 codecContext = avcodec_alloc_context3(codec);
 if (!codecContext){
 logF("avcodec_alloc_context3");
 }
 codecContext->width = parameters.width;
 codecContext->height = parameters.height;
 codecContext->bit_rate = parameters.bitRate;
 codecContext->time_base = (AVRational){1, parameters.fps};
 codecContext->gop_size = 0;
 codecContext->max_b_frames = 0;
 codecContext->pix_fmt = AV_PIX_FMT_YUV420P;
 if (parameters.preset == EncoderParameters::Preset::Fast){
 av_opt_set(codecContext->priv_data, "preset", "ultrafast", 0);
 }else if (parameters.preset == EncoderParameters::Preset::Slow){
 av_opt_set(codecContext->priv_data, "preset", "slow", 0);
 }

 hr = avcodec_open2(codecContext, codec, nullptr);
 if (hr < 0){
 logF("avcodec_open2", hr);
 }



The problem : I open "output.mp4" file and assume that the class properly saves the header of the file. However, the file weights 262 bytes (there is no useful data such as frames) and it is corrupted for running video on any video players
ps : I've enabled libav logging, which seems to be ok, despite some messages :


- 

- [file @ 0000017a74c6c540] Setting default whitelist 'file,crypto,data'
I have some concers about the appropriateness of the whitelist as no crypto is expected
- [AVIOContext @ 0000017a6a249100] Statistics : 266 bytes written, 2 seeks, 3 writeouts
The actual size of the file is 262. Does it mean that there are some info leaking during saving and even the header is already broken ?






I've tried to adjust various codec settings. Even turning off any speed presets. Actually, the encoder was tested in the pair with various libav decoders and image rendering and I'm pretty sure about encoder part.
Moreover, I've written the FileWriter code three times as there are some dissimilar guides. Only the current code does not throw any warnings or errors.
Give me a hint, which part of code may be wrong or provide me with some samples of using latest ffmpeg and answer my questions, please.


-
ffmpeg : What is the best practice to keep a live connection/socket with a camera, and save time on ffprobe
15 mai 2022, par Jeff StrongmanToday... I used the following command : with
subprocess.PIPE
andsubprocess.Popen
in python 3 :

ffmpeg -i udp://{address_of_camera} \
 -vf select='if(eq(pict_type,I),st(1,t),gt(t,ld(1)))' setpts=N/FRAME_RATE/TB \
 -f rawvideo -an -vframes {NUM_WANTED_FRAMES} pipe:`



This command helps me to capture
NUM_WANTED_FRAMES
frames from a live camera at a given moment.

However... it takes me about 4 seconds to read the frames, and about 2.5 seconds to open a socket between my computer and the camera's computer.


Is there a way, to have a socket/connection always open between my computer and the camera's computer, to save the 2.5 seconds ?


I read something about
fifo_size
andoverrun_fatal
. I thought that maybe I can setfifo_size
to be equal toNUM_WANTED_FRAMES
, andoverrun_fatal
to True ? Will this solve my problem ? Or is there a different and simpler/better solution ?

Should I try to record always (no
-vframes
flag) store the frames in a queue(With max size), and upon a wish to slice the video, read from my queue buffer ? Will it work well with the keyframe ?

Also... What to do when ffmpeg fails ? restart the ffmpeg command ?


-
Revision 7af927e324 : Merge "vp9_ethread : calculate and save the tok starting address for tiles"
1er décembre 2014, par Yunqing WangMerge "vp9_ethread : calculate and save the tok starting address for tiles"