
Recherche avancée
Autres articles (111)
-
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 -
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 (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)
Sur d’autres sites (11742)
-
Command Line 'hls_segment_size' creates TS files with segment failures
14 octobre 2019, par PhantomI am converting a simple mp4 video to hls but I need the segments to be in approximately a specific size
I researched and found :
-hls_segment_size 17000000
17000000 bytes( 17MB)
This creates TS files with approximate sizes, (does not have to be exact size)
ffmpeg.exe -i "in.mp4" -vcodec copy -acodec aac -hls_list_size 0 -hls_segment_size 17000000 -f hls "out.m3u8"
In the m3u8 file is created ’#EXT-X-BYTERANGE’, which is the way I want it
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:8.400000,
#EXT-X-BYTERANGE:1662108@0
SampleVideo_1280x720_30mb0.ts
#EXTINF:4.560000,
#EXT-X-BYTERANGE:383896@0
SampleVideo_1280x720_30mb1.ts
#EXTINF:3.120000,
#EXT-X-BYTERANGE:408712@383896
SampleVideo_1280x720_30mb1.ts
#EXTINF:5.640000,
#EXT-X-BYTERANGE:1161840@0
SampleVideo_1280x720_30mb2.ts
#EXTINF:1.880000,
#EXT-X-BYTERANGE:230864@0
SampleVideo_1280x720_30mb3.ts
#EXTINF:2.160000,
#EXT-X-BYTERANGE:330880@230864
SampleVideo_1280x720_30mb3.ts
#EXTINF:2.080000,
#EXT-X-BYTERANGE:489928@0
SampleVideo_1280x720_30mb4.ts
#EXTINF:4.400000,
#EXT-X-BYTERANGE:1564348@489928
SampleVideo_1280x720_30mb4.ts
...It seems alright, but it has a little problem. I’m testing on a player in the browser, and when the seconds goes from one segment to the other the video has a lock in sound and video. Something very annoying, not natural in the video.
Not using ’-hls_segment_size’ will have functional TS files, and without BYTERANGE in the m3u8 file
However, the size of the TS file will be according to the seconds defined
I am currently trying to get a ts file that is close to a size set between 15MB and 20MB, and have BYTERANGE in the m3u8 file.
Does anyone have any ideas ?
here’s the problem I’m trying to describe :
http://phantsc.rf.gd/AAA/Bbb.html
exactly in the second 7 of the video a ’locking’ happens, this happens when going from one segment to another
-
Live555 truncates encoded data of FFMpeg
22 novembre 2019, par Harshil MakwanaI am trying to stream H264 based data using Live555 over RTSP.
I am capturing data using V4L2, and then encodes it using FFMPEG and then passing data to Live555’s DeviceSource file, in that I using H264VideoStreamFramer class,
Below is my codec settings to configure AVCodecContext of encoder,
codec = avcodec_find_encoder_by_name(CODEC_NAME);
if (!codec) {
cerr << "Codec " << codec_name << " not found\n";
exit(1);
}
c = avcodec_alloc_context3(codec);
if (!c) {
cerr << "Could not allocate video codec context\n";
exit(1);
}
pkt = av_packet_alloc();
if (!pkt)
exit(1);
/* put sample parameters */
c->bit_rate = 400000;
/* resolution must be a multiple of two */
c->width = PIC_HEIGHT;
c->height = PIC_WIDTH;
/* frames per second */
c->time_base = (AVRational){1, FPS};
c->framerate = (AVRational){FPS, 1};
c->gop_size = 10;
c->max_b_frames = 1;
c->pix_fmt = AV_PIX_FMT_YUV420P;
c->rtp_payload_size = 30000;
if (codec->id == AV_CODEC_ID_H264)
av_opt_set(c->priv_data, "preset", "fast", 0);
av_opt_set_int(c->priv_data, "slice-max-size", 30000, 0);
/* open it */
ret = avcodec_open2(c, codec, NULL);
if (ret < 0) {
cerr << "Could not open codec\n";
exit(1);
}And I am getting encoded data using avcodec_receive_packet() function. which will return AVPacket.
And I am passing AVPacket’s data into DeviceSource file below is code snippet of my Live555 code :
void DeviceSource::deliverFrame() {
if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet
u_int8_t* newFrameDataStart = (u_int8_t*) pkt->data;
unsigned newFrameSize = pkt->size; //%%% TO BE WRITTEN %%%
// Deliver the data here:
if (newFrameSize > fMaxSize) { // Condition becomes true many times
fFrameSize = fMaxSize;
fNumTruncatedBytes = newFrameSize - fMaxSize;
} else {
fFrameSize = newFrameSize;
}
gettimeofday(&fPresentationTime, NULL); // If you have a more accurate time - e.g., from an encoder - then use that instead.
// If the device is *not* a 'live source' (e.g., it comes instead from a file or buffer), then set "fDurationInMicroseconds" here.
memmove(fTo, newFrameDataStart, fFrameSize);
}But here, sometimes my packet’s size is getting more than fMaxSize value and as per LIVE555 logic it will truncate frame data, so that sometimes I am getting bad frames on my VLC,
From Live555 forum, I get to know that encoder should not send packet whose size is more than fMaxSize value, so my question is :
How to restrict encoder to limit size of packet ?
Thanks in Advance,
Harshil
-
Create movie programatically with ffmpeg
16 janvier 2019, par Martin DelilleI would like to create a movie programatically with ffmpeg.
Here is my code :
QString fileName = "test.mov";
static char errorString[AV_ERROR_MAX_STRING_SIZE];
printf("Video encoding\n");
AVOutputFormat *outputFormat = av_guess_format(nullptr, fileName.toStdString().c_str(), nullptr);
if (outputFormat == nullptr) {
qDebug() << "Could not find suitable format for" << fileName;
return false;
}
enum AVCodecID codec_id = AV_CODEC_ID_MJPEG;
qDebug() << "Format Name:" << outputFormat->name;
qDebug() << "Format Video Codec:" << outputFormat->video_codec;
outputFormat->video_codec = codec_id;
/// allocate the output media context, formatContext
AVFormatContext *formatContext = avformat_alloc_context();
formatContext->oformat = outputFormat;
// find the mpeg1 video encoder
AVCodec *codec = avcodec_find_encoder(codec_id);
if (!codec) {
qDebug() << "codec not found";
return false;
}
qDebug() << "Codec name:" << codec->name;
AVStream *videoStream = avformat_new_stream(formatContext, codec);
// put sample parameters
videoStream->codecpar->bit_rate = 400000;
videoStream->codecpar->width = width;
videoStream->codecpar->height = height;
videoStream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
videoStream->codecpar->format = AV_PIX_FMT_YUVJ422P;
videoStream->time_base.num = 1;
videoStream->time_base.den = 25;
AVCodecContext *codecContext = avcodec_alloc_context3(nullptr);
codecContext->codec_id = codec_id;
codecContext->codec_type = AVMEDIA_TYPE_VIDEO;
codecContext->width = width;
codecContext->height = height;
codecContext->time_base.num = 1;
codecContext->time_base.den = 25;
codecContext->pix_fmt = AV_PIX_FMT_YUVJ422P;
if (int error = avcodec_parameters_to_context(codecContext, videoStream->codecpar)) {
qDebug() << "Error parameting the context:" << av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
return false;
}
// open it
if (int error = avcodec_open2(codecContext, codec, nullptr)) {
qDebug() << "Could not open codec:" << av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
return false;
}
// alloc image and output buffer
AVFrame *frame = av_frame_alloc();
frame->format = codecContext->pix_fmt;
frame->width = codecContext->width;
frame->height = codecContext->height;
if (int error = av_image_alloc(frame->data, frame->linesize, frame->width, frame->height, static_cast<enum avpixelformat="avpixelformat">(frame->format), 0)) {
qDebug() << "Error allocating image data:" << av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
return false;
}
// Open the output file, if needed
if (!(outputFormat->flags & AVFMT_NOFILE)) {
if (avio_open(&formatContext->pb, fileName.toStdString().c_str(), AVIO_FLAG_WRITE) < 0) {
qDebug() << "Could not open" << fileName;
return false;
}
}
// some formats want stream headers to be separate
if (formatContext->oformat->flags & AVFMT_GLOBALHEADER) {
codecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}
if (int error = avformat_write_header(formatContext, nullptr)) {
qDebug() << "error writing header:" << av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
return false;
}
</enum>Unfortunately, when I execute it I have the following output :
Format Name: mov
Format Video Codec: 27
Codec name: mjpeg
[mov @ 0x1048c7000] Could not find tag for codec none in stream #0, codec not currently supported in container
error writing header: Invalid argumentWhat am I doing wrong ?