
Advanced search
Medias (1)
-
Bug de détection d’ogg
22 March 2013, by
Updated: April 2013
Language: français
Type: Video
Other articles (17)
-
Publier sur MédiaSpip
13 June 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 -
Configuration spécifique pour PHP5
4 February 2011, byPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...) -
La sauvegarde automatique de canaux SPIP
1 April 2010, byDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
On other websites (6130)
-
How to write RTP/H264 stream as a file
2 October 2012, by JunI couldn't find a solution for my previous question so I decided to try it step by step.
The thing that I wanna do now is to store the RTP/H264 stream as a file.
What I found so far is the below:
(firstly my RTP/H264 is FU-A which is the form of)
| RTP HEADER 12bytes long | FU INDICATOR 1byte | FU HEADER 1byte | FU payload |
As I understood RFC 6184 document, I'm starting a NAL with a packet which has '1' at the first bit of FU Header and appending following packets that set '0' at the first bit until the last packet which has '1' at the second bit of FU Header.
I think that's how to get a complete NAL before the FU-A packetization and also what I found is I need to put the 'starting bits' (0x00000001) at the front of each complete NAL.
But no luck so far. The below is part of log
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= adding the next NAL as 716
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= a NAL is summed up as 4866
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 139
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= a NAL is summed up as 7061
========= the new NAL is as 1377
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]41/1000001 [5]E4/11100100 [6]40/1000000 [7]1A/11010 ...
========= a NAL is summed up as 1369
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E6/11100110 [7]60/1100000 ...
========= adding the next NAL as 94
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E6/11100110 [7]60/1100000 ...
========= a NAL is summed up as 1472
========= the new NAL is as 447
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]41/1000001 [5]E8/11101000 [6]80/10000000 [7]16/10110 ...
========= a NAL is summed up as 439
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EA/11101010 [7]A0/10100000 ...
========= adding the next NAL as 1174
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EA/11101010 [7]A0/10100000 ...
========= a NAL is summed up as 2552
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EC/11101100 [7]C0/11000000 ...
========= adding the next NAL as 1364
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EC/11101100 [7]C0/11000000 ...
========= a NAL is summed up as 2742
========= the new NAL is as 1400
...my question is,
-
if I can get the complete NALs from the fragmented packets by FU-A, how can I make it as a file which is able to run by VLC or other player?
-
I'm still confused if I have to keep the FU indicator and FU header or not. Somebody said I need to take them only for the very first packet (starting with '1' at the FU header)
Any advice will be really appreciated.
Thanks.
-
-
Converting 6 audio channels to 2 in ffmpeg
12 June 2013, by k1lljoyIm doing a 2 pass encode on the uploads to my site.
Unfortunately when a user uploads a 6 audio channel .mkv files (5.1 surround), ffmpeg spits out the following error:
Resampling with input channels greater than 2 unsupported.
Im running the latest version of ffmpeg. Doing
-ac 6
instead of the usual- ac 2
proceeds with the encoding, but it just creates a larger file with useless data, as well as creates another step in the already long file processing script, and I'd rather avoid modifying the conversion command.Is there anything I can do to make
-ac 2
actually work? -
How to create video using avcodec from jpeg images of type OpenCV::Mat?
23 July 2015, by theateistI have colored jpeg images of
OpenCV::Mat
type and I create from them video usingavcodec
. The video that I get is upside-down, black & white and each row of each frame is shifted and I got diagonal line. What could be the reason for such output?
Follow this link to watch the video I get using avcodec.
I’m usingacpicture_fill
function to createavFrame
fromcv::Mat
frame!P.S.
Each cv::Mat cvFrame has width=810, height=610, step=2432
I noticed that avFrame (that is filled by acpicture_fill) haslinesize[0]=2430
I tried manually settingavFrame->linesizep0]=2432
and not 2430 but it still didn’t helped.======== CODE =========================================================
AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
AVStream *outStream = avformat_new_stream(outContainer, encoder);
avcodec_get_context_defaults3(outStream->codec, encoder);
outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
outStream->codec->width = 810;
outStream->codec->height = 610;
//...
SwsContext *swsCtx = sws_getContext(outStream->codec->width, outStream->codec->height, PIX_FMT_RGB24,
outStream->codec->width, outStream->codec->height, outStream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL);
for (uint i=0; i < frameNums; i++)
{
// get frame at location I using OpenCV
cv::Mat cvFrame;
myReader.getFrame(cvFrame, i);
cv::Size frameSize = cvFrame.size();
//Each cv::Mat cvFrame has width=810, height=610, step=2432
1. // create AVPicture from cv::Mat frame
2. avpicture_fill((AVPicture*)avFrame, cvFrame.data, PIX_FMT_RGB24, outStream->codec->width, outStream->codec->height);
3avFrame->width = frameSize.width;
4. avFrame->height = frameSize.height;
// rescale to outStream format
sws_scale(swsCtx, avFrame->data, avFrame->linesize, 0, outStream->codec->height, avFrameRescaledFrame->data, avFrameRescaledFrame ->linesize);
encoderRescaledFrame->pts=i;
avFrameRescaledFrame->width = frameSize.width;
avFrameRescaledFrame->height = frameSize.height;
av_init_packet(&avEncodedPacket);
avEncodedPacket.data = NULL;
avEncodedPacket.size = 0;
// encode rescaled frame
if(avcodec_encode_video2(outStream->codec, &avEncodedPacket, avFrameRescaledFrame, &got_frame) < 0) exit(1);
if(got_frame)
{
if (avEncodedPacket.pts != AV_NOPTS_VALUE)
avEncodedPacket.pts = av_rescale_q(avEncodedPacket.pts, outStream->codec->time_base, outStream->time_base);
if (avEncodedPacket.dts != AV_NOPTS_VALUE)
avEncodedPacket.dts = av_rescale_q(avEncodedPacket.dts, outStream->codec->time_base, outStream->time_base);
// outContainer is "mp4"
av_write_frame(outContainer, & avEncodedPacket);
av_free_packet(&encodedPacket);
}
}UPDATED
As @Alex suggested I changed the lines 1-4 with the code below
int width = frameSize.width, height = frameSize.height;
avpicture_alloc((AVPicture*)avFrame, AV_PIX_FMT_RGB24, outStream->codec->width, outStream->codec->height);
for (int h = 0; h < height; h++)
{
memcpy(&(avFrame->data[0][h*avFrame->linesize[0]]), &(cvFrame.data[h*cvFrame.step]), width*3);
}The video (here) I get now is almost perfect. It’s NOT upside-down, NOT black & white, BUT it seems that one of the RGB components is missing. Every brown/red colors became blue (in original images it should be vice-verse).
What could be the problem? Could rescaling(sws_scale
) toAV_PIX_FMT_YUV420P
format causes this?