
Recherche avancée
Autres articles (32)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (3543)
-
FFMPEG - Can't create a video from series of images with RGB24 pixel format
21 juillet 2016, par DevNullGoal
I’m writing a small proof-of-concept application to take some raw image data I acquire from a digital camera (a series of RGB24 images), and combine them together into a simple, no-audio, video file.
Work So Far
The initialization code is as follows :
AVCodec* pCodec = NULL;
AVCodecContext* pCodecContext = NULL;
AVFrame* pFrame = NULL;
/* Register all available codecs. */
avcodec_register_all();
/* Determine if desired video encoder is installed. */
pCodec = avcodec_find_encoder(CODEC_ID_MJPEG);
if (!pCodec) {
printf("Codec not installed!\n");
}
pCodecContext = avcodec_alloc_context3(pCodec);
pFrame = avcodec_alloc_frame();
Very cut-and-dry. However, when I try to register the codec, it fails with my custom error message, and one dropped in a nice color-coded format directly from the FFMPEG libraries :
[mjpeg @ 0x650d00] Specified pixel format rgb24 is invalid or not supported
Codec not available.
I can confirm that that pixel format is valid easily enough :
Pixel formats:
I.... = Supported Input format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
....B = Bitstream format
2>&1 ffmpeg -pix_fmts | grep -i -e rgb24 -e flags
FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL
IO... rgb24 3 24
I can also confirm that the video codec I’m trying to use is valid for encoding.
Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
2>&1 ffmpeg -codecs | grep -i mjpeg
DEVIL. mjpeg Motion JPEGQuestion
Why is this pixel format not supported ? It seems like such a common one when working with other utilities like MATLAB, OpenCV, FreeImage, etc. Is there any set of options or functions in FFMPEG/AVcodec that can resolve this issue ? I’d like to avoid having to to manually convert my image to a different color-space if possible, so I’m not burning up CPU cycles by first converting the RGB24 image to a new format, THEN encoding a video frame with it.
Thank you.
-
h264 : fix decoding multiple fields per packet with slice threads
12 juin 2016, par Anton Khirnovh264 : fix decoding multiple fields per packet with slice threads
Since we only know whether a NAL unit corresponds to a new field after
parsing the slice header, this requires reorganizing the calls to slice
parsing, per-slice/field/frame init and actual decoding.In the previous code, the function for slice header decoding also
immediately started a new field/frame as necessary, so any slices
already queued for decoding would no longer be decodable.After this patch, we first parse the slice header, and if we determine
that a new field needs to be started we decode all the queued slices. -
Could not open encoder using ffmpeg C APi for MOV format
22 juin 2016, par lupodContext
I am writing a program for doing some video processing on an input file. I wrote two classes for handling the "reading/writing frames" part that essentially wrap the functions of ffmpeg. These classes may be instantiated by providing an input and output file name, and in their constructor I initialize everything that is needed (or at least I hope so).
This are the two routines that are called inside the constructors :
// InputVideoHandler.cpp
void InputVideoHandler::init(char* name) {
streamIndex = -1;
int numStreams;
if (avformat_open_input(&formatCtx, name, NULL, NULL) != 0)
throw std::exception("Invalid input file name.");
if (avformat_find_stream_info(formatCtx, NULL)<0)
throw std::exception("Could not find stream information.");
numStreams = formatCtx->nb_streams;
if (numStreams < 0)
throw std::exception("No streams in input video file.");
for (int i = 0; i < numStreams; i++) {
if (formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
streamIndex = i;
break;
}
}
if (streamIndex < 0)
throw std::exception("No video stream in input video file.");
// find decoder using id
codec = avcodec_find_decoder(formatCtx->streams[streamIndex]->codec->codec_id);
if (codec == nullptr)
throw std::exception("Could not find suitable decoder for input file.");
// copy context from input stream
codecCtx = avcodec_alloc_context3(codec);
if (avcodec_copy_context(codecCtx, formatCtx->streams[streamIndex]->codec) != 0)
throw std::exception("Could not copy codec context from input stream.");
if (avcodec_open2(codecCtx, codec, NULL) < 0)
throw std::exception("Could not open decoder.");
codecCtx->refcounted_frames = 1;
}
// OutputVideoBuilder.cpp
void OutputVideoBuilder::init(char* name, AVCodecContext* inputCtx) {
if (avformat_alloc_output_context2(&formatCtx, NULL, NULL, name) < 0)
throw std::exception("Could not determine file extension from provided name.");
codec = avcodec_find_encoder(inputCtx->codec_id);
if (codec == nullptr) {
throw std::exception("Could not find suitable encoder.");
}
codecCtx = avcodec_alloc_context3(codec);
if (avcodec_copy_context(codecCtx, inputCtx) < 0)
throw std::exception("Could not copy output codec context from input");
codecCtx->time_base = inputCtx->time_base;
if (avcodec_open2(codecCtx, codec, NULL) < 0)
throw std::exception("Could not open encoder.");
stream = avformat_new_stream(formatCtx, codec);
if (stream == nullptr) {
throw std::exception("Could not allocate stream.");
}
stream->id = formatCtx->nb_streams - 1;
stream->codec = codecCtx;
stream->time_base = codecCtx->time_base;
av_dump_format(formatCtx, 0, name, 1);
if (!(formatCtx->oformat->flags & AVFMT_NOFILE)) {
if (avio_open(&formatCtx->pb, name, AVIO_FLAG_WRITE) < 0) {
throw std::exception("Could not open output file.");
}
}
if (avformat_write_header(formatCtx, NULL) < 0) {
throw std::exception("Error occurred when opening output file.");
}
}As you see, for the Init function of the output handler I require that an AVCodecContext must be provided. In my code, I pass to the constructor the AVCodecContext that is stored in the input handler and that was previously created.
Question :
The two functions work fine when I test my program with some video formats, like .mpg or .avi. When I try to process .mov/.mp4 files, however, my code throws the exception that I labeled "Could not open encoder." in OutputVideoBuilder::Init(). Why is this happening ? I read from the General documentation of ffmpeg that that format should be supported as well by ffmpeg. I am assuming that I am doing something wrong in my code, which I do not completely understand because it was created by trying to adapt the tutorials of the documentation to my specific case. Also for this reason, any comments on things that are useless or things that are missing will be greatly appreciated.