
Recherche avancée
Médias (3)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
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 (90)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (9849)
-
how to configure ffmpeg pipline for streaming
30 juin 2021, par Changhoon LeeI want to get real-time streaming data (use mediasuop) and send it to nginx-rtmp-server via ffmpeg, but if I run it through the pipeline, the error occurs after logging as below. I checked that the rtmp server works well through OBS studio program, but when I run with the pipeline I prepared, the error occurs. Do you know where this problem occurs ?


Problems with the pipeline ? Problem with Sdp ? Or something else ?


my pipe line


ffmpeg
-loglevel
debug
-nostdin
-protocol_whitelist
file,pipe,udp,rtp,rtmp
-analyzeduration 30M
-probesize
30M
-f
sdp
-i
pipe:0
-map 0:v:0
-c:v copy -map
0:a:0 -strict -2
-c:a aac

-flags +global_headers

{filePath}.flv

-pix_fmt
yuv420p
-preset
ultrafast
-use_wallclock_as_timestamps
1
-tune zerolatency
-qmin 2
-qmax 51
-muxrate 1300k
-sdp_file {file}.sdp
-r 30
-b:v 1000k
-bufsize 3000k
-minrate 500k
-maxrate 2000k
-qscale 3
-threads 4
-b:a 128k
-framerate 30
-g 50
-crf 30
-ar 44100
-s 400x700
-f
flv

rtmp://{rtmpServerUri}



and my sdp file


v=0
 o=- 0 0 IN IP4 127.0.0.1
 s=FFmpeg
 c=IN IP4 127.0.0.1
 t=0 0
 m=video 23490 RTP/AVP 101 
 a=rtpmap:101 VP8/90000
 a=sendonly
 m=audio 29773 RTP/AVP 100 
 a=rtpmap:100 opus/48000/2
 a=sendonly



and ErrorLog


ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)

' libavutil 56. 70.100 / 56. 70.100\n' +
 ' libavcodec 58.134.100 / 58.134.100\n' +
 ' libavformat 58. 76.100 / 58. 76.100\n' +
 ' libavdevice 58. 13.100 / 58. 13.100\n' +
 ' libavfilter 7.110.100 / 7.110.100\n' +
 ' libavresample 4. 0. 0 / 4. 0. 0\n' +
 ' libswscale 5. 9.100 / 5. 9.100\n' +
 ' libswresample 3. 9.100 / 3. 9.100\n' +
 ' libpostproc 55. 9.100 / 55. 9.100\n' +

"Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'
"Reading option '-nostdin' ... matched as option 'stdin' (enable or disable interaction on standard input) with argument 0"
"Reading option '-protocol_whitelist' ... matched as AVOption 'protocol_whitelist' with argument 'file,pipe,udp,rtp,rtmp'"
"Reading option '-analyzeduration' ... matched as AVOption 'analyzeduration' with argument '30M'"
"Reading option '-probesize' ... matched as AVOption 'probesize' with argument '30M'"
"Reading option '-f' ... matched as option 'f' (force format) with argument 'sdp'"
"Reading option '-i' ... matched as input url with argument 'pipe:0'"
"Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v:0'"
"Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'"
"Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:0'"
"Reading option '-strict' ..."

Routing option strict to both codec and muxer layer

matched as AVOption 'strict' with argument '-2'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-flags' ... matched as AVOption 'flags' with argument '+global_header'.
Reading option '{filePath}.flv' ... matched as output url." +
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'" 
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'." 
Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'." 
Reading option '-tune' ... matched as AVOption 'tune' with argument 'zerolatency'." 
Reading option '-qmin' ... matched as AVOption 'qmin' with argument '2'." 
Reading option '-qmax' ... matched as AVOption 'qmax' with argument '51'." 
Reading option '-muxrate' ... matched as AVOption 'muxrate' with argument '1300k'." 
Reading option '-sdp_file' ... matched as option 'sdp_file' (specify a file in which to print sdp information) with argument '{filename}.sdp'." 
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '30'"
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '1000k
Reading option '-bufsize' ... matched as AVOption 'bufsize' with argument '3000k'
Reading option '-minrate' ... matched as AVOption 'minrate' with argument '500k'
Reading option '-maxrate' ... matched as AVOption 'maxrate' with argument '2000k'
Reading option '-qscale' ... matched as option 'qscale' (use fixed quality scale (VBR)) with argument '3'
Reading option '-threads' ... matched as AVOption 'threads' with argument '4
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128k'
Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'
Reading option '-g' ... matched as AVOption 'g' with argument '50'
Reading option '-crf' ... matched as AVOption 'crf' with argument '30'
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '44100
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '400x700'
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp:{rtmpserver} ' ... matched as output url
Finished splitting the commandline.\n' +
Parsing a group of options: global .\n' +
Applying option loglevel (set logging level) with argument debug.\n' +
Applying option nostdin (enable or disable interaction on standard input) with argument 0.\n' +
Applying option sdp_file (specify a file in which to print sdp information) with argument {filename}.sdp
Successfully parsed a group of options
Parsing a group of options: input url pipe:0
Applying option f (force format) with argument sdp.
Successfully parsed a group of options
Opening an input file: pipe:0.
[sdp @ 0x12e008e00] Opening 'pipe:0' for reading

[sdp @ 0x12e008e00] video codec set to: vp8\n' +
[sdp @ 0x12e008e00] audio codec set to: opus\n' +
[sdp @ 0x12e008e00] audio samplerate set to: 48000\n' +
[sdp @ 0x12e008e00] audio channels set to: 2\n' +
[udp @ 0x12c610b70] end receive buffer size reported is 393216\n' +
[udp @ 0x12c610c30] end receive buffer size reported is 393216\n' +
[sdp @ 0x12e008e00] setting jitter buffer size to 500\n' +
[udp @ 0x12c611290] end receive buffer size reported is 393216\n' +
[udp @ 0x12c611330] end receive buffer size reported is 393216\n' +
[sdp @ 0x12e008e00] setting jitter buffer size to 500\n' +
[sdp @ 0x12e008e00] Before avformat_find_stream_info() pos: 310 bytes read:310 seeks:0 nb_streams:2\n'

[sdp @ 0x12e008e00] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size\n' +
 "Consider increasing the value for the 'analyzeduration' (30000000) and 'probesize' (30000000) options

'Codec AVOption qmin (minimum video quantizer scale (VBR)) specified for output file #1 (rtmp:{rtmpserver}) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream

[rtmp @ 0x11c604310] No default whitelist set
[rtmp @ 0x11c604310] No default whitelist set

Starting connection attempt to {server} port 1935
[tcp @ 0x10c6054a0] Successfully connected to {server} port 1935
[rtmp @ 0x11c604310] Handshaking...
[rtmp @ 0x11c604310] Proto = rtmp, path = {serverpath}, app = live, fname = {filename}'
[rtmp @ 0x11c604310] Window acknowledgement size = 5000000
[rtmp @ 0x11c604310] Max sent, unacked = 5000000
[rtmp @ 0x11c604310] New incoming chunk size = 4096
[rtmp @ 0x11c604310] Releasing stream
[rtmp @ 0x11c604310] FCPublish stream
[rtmp @ 0x11c604310] Creating stream
[rtmp @ 0x11c604310] Sending publish command for {filename}

Successfully opened the file

Stream mapping

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (opus (native) -> aac (native)
Stream #0:1 -> #1:0 (opus (native) -> mp3 (libmp3lame)
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
pipe:0: Operation timed out
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:3] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
detected 8 logical cores
[graph_0_in_0_1 @ 0x10c605b50] Setting 'time_base' to value '1/48000
[graph_0_in_0_1 @ 0x10c605b50] Setting 'sample_rate' to value '48000'
[graph_0_in_0_1 @ 0x10c605b50] Setting 'sample_fmt' to value 'fltp'
[graph_0_in_0_1 @ 0x10c605b50] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_1 @ 0x10c605b50] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[format_out_0_1 @ 0x10c605ea0] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x10c605ea0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 0x12d204de0] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed

//// error ////

[flv @ 0x10c80aa00] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1

[AVIOContext @ 0x10c6040a0] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x10c6040a0] Statistics: 0 seeks, 0 writeouts
[rtmp @ 0x11c604310] UnPublishing stream
[rtmp @ 0x11c604310] Deleting stream
[aac @ 0x10c80ce00] Qavg: nan\n']
[AVIOContext @ 0x12d005120] Statistics: 310 bytes read, 0 seeks
Conversion failed!



I'd appreciate it if you could tell me why not...


-
About the ffmpeg execution after the automatic shutdown command, and some batch commands [closed]
5 juillet 2021, par Randy WilsonWhen I am executing the following command, I need to shut down automatically after executing the command because it takes a long time, because I am a rookie, how can I add it ? How can I add this to make the code shutdown automatically after execution ?


echo off
 for %%a in ("*.mp3") do "C:\ffmpeg\bin\ffmpeg" -loop 1 -i "C:\ffmpeg\bin\input.jpg" -i "%%a" -c:v libx264 -preset veryslow -tune stillimage -crf 18 -pix_fmt yuv420p -c:a aac -shortest -strict experimental -b:a 192k -shortest "C:\mp4\%%~na.mp4"
 pause



-
Segfault while trying to fill the yuv image for rtsp streaming
21 septembre 2016, par tankyxI am capturing the video stream from a window, and I want to restream it to my rtsp proxy server. However, it seems I can’t write the frame properly, but I can show the said frame in a SDL window. Here is my code :
int StreamHandler::storeStreamData()
{
// Allocate video frame
pFrame = av_frame_alloc();
// Allocate an AVFrame structure
pFrameRGB = av_frame_alloc();
if (pFrameRGB == NULL)
throw myExceptions("Error : Can't alloc the frame.");
// Determine required buffer size and allocate buffer
numBytes = avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx->width,
pCodecCtx->height);
buffer = (uint8_t *)av_malloc(numBytes * sizeof(uint8_t));
// Assign appropriate parts of buffer to image planes in pFrameRGB
avpicture_fill((AVPicture *)pFrameRGB, buffer, AV_PIX_FMT_YUV420P,
pCodecCtx->width, pCodecCtx->height);
//InitSdlDrawBack();
// initialize SWS context for software scaling
sws_ctx = sws_getContext(pCodecCtx->width,
pCodecCtx->height,
pCodecCtx->pix_fmt,
pCodecCtx->width,
pCodecCtx->height,
pCodecCtx->pix_fmt,
SWS_LANCZOS,
NULL,
NULL,
NULL
);
SetPixelArray();
FfmpegEncoder enc("rtsp://127.0.0.1:1935/live/myStream");
i = 0;
while (av_read_frame(pFormatCtx, &packet) >= 0) {
if (packet.stream_index == videoindex) {
// Decode video frame
avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
if (frameFinished) {
i++;
//DrawFrame();
sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,
pFrame->linesize, 0, pCodecCtx->height,
pFrameRGB->data, pFrameRGB->linesize);
enc.encodeFrame(pFrameRGB, i);
}
}
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
// Free the RGB image
av_free(buffer);
av_frame_free(&pFrameRGB);
// Free the YUV frame
av_frame_free(&pFrame);
// Close the codecs
avcodec_close(pCodecCtx);
avcodec_close(pCodecCtxOrig);
// Close the video file
avformat_close_input(&pFormatCtx);
return 0;
}
void StreamHandler::SetPixelArray()
{
yPlaneSz = pCodecCtx->width * pCodecCtx->height;
uvPlaneSz = pCodecCtx->width * pCodecCtx->height / 4;
yPlane = (Uint8*)malloc(yPlaneSz);
uPlane = (Uint8*)malloc(uvPlaneSz);
vPlane = (Uint8*)malloc(uvPlaneSz);
if (!yPlane || !uPlane || !vPlane)
throw myExceptions("Error : Can't create pixel array.");
uvPitch = pCodecCtx->width / 2;
}Here I fill the YUV image and write the packet.
void FfmpegEncoder::encodeFrame(AVFrame * frame, int frameCount)
{
AVPacket pkt = { 0 };
int got_pkt;
av_init_packet(&pkt);
frame->pts = frameCount;
FillYuvImage(frame, frameCount, this->pCodecCtx->width, this->pCodecCtx->height);
if (avcodec_encode_video2(this->pCodecCtx, &pkt, frame, &got_pkt) < 0)
throw myExceptions("Error: failed to encode the frame. FfmpegEncoder.cpp l:61\n");
//if the frame is well encoded
if (got_pkt) {
pkt.stream_index = this->st->index;
pkt.pts = av_rescale_q_rnd(pkt.pts, this->pCodecCtx->time_base, this->st->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
if (av_write_frame(this->outFormatCtx, &pkt) < 0)
throw myExceptions("Error: failed to write video frame. FfmpegEncoder.cpp l:68\n");
}
}
void FfmpegEncoder::FillYuvImage(AVFrame * pict, int frame_index, int width, int height)
{
int x, y, i;
i = frame_index;
for (y = 0; y < height; y++)
{
for (x = 0; x < width / 2; x++)
pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;
}
for (y = 0; y < height; y++)
{
for (x = 0; x < width / 2; x++)
{
pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2;
pict->data[2][y * pict->linesize[2] + x] = 64 + y + i * 5; //segault here
}
}
}The "FillYuvImage" method is copied from a FFMPEG example, but It does not work for me. If I don’t call it, the "av_write_frame" function won’t work (segfault too).
EDIT : Here is my output context and codec initialization.
FfmpegEncoder::FfmpegEncoder(char *url)
{
AVRational tmp_time_base;
AVDictionary* options = NULL;
this->pCodec = avcodec_find_encoder(AV_CODEC_ID_H264);
if (this->pCodec == NULL)
throw myExceptions("Error: Can't initialize the encoder. FfmpegEncoder.cpp l:9\n");
this->pCodecCtx = avcodec_alloc_context3(this->pCodec);
//Alloc output context
if (avformat_alloc_output_context2(&outFormatCtx, NULL, "rtsp", url) < 0)
throw myExceptions("Error: Can't alloc stream output. FfmpegEncoder.cpp l:17\n");
this->st = avformat_new_stream(this->outFormatCtx, this->pCodec);
if (this->st == NULL)
throw myExceptions("Error: Can't create stream . FfmpegEncoder.cpp l:22\n");
av_dict_set(&options, "vprofile", "main", 0);
av_dict_set(&options, "tune", "zerolatency", 0);
tmp_time_base.num = 1;
tmp_time_base.den = 60;
//TODO : parse these values
this->pCodecCtx->bit_rate = 3000000;
this->pCodecCtx->width = 1280;
this->pCodecCtx->height = 720;
//This set the fps. 60fps at this point.
this->pCodecCtx->time_base = tmp_time_base;
//Add a intra frame every 12 frames
this->pCodecCtx->gop_size = 12;
this->pCodecCtx->pix_fmt = AV_PIX_FMT_YUV420P;
//Open Codec, using the context + x264 options
if (avcodec_open2(this->pCodecCtx, this->pCodec, &options) < 0)
throw myExceptions("Error: Can't open the codec. FfmpegEncoder.cpp l:43\n");
if (avcodec_copy_context(this->st->codec, this->pCodecCtx) != 0) {
throw myExceptions("Error : Can't copy codec context. FfmpegEncoder.cpp : l.46");
}
av_dump_format(this->outFormatCtx, 0, url, 1);
if (avformat_write_header(this->outFormatCtx, NULL) != 0)
throw myExceptions("Error: failed to connect to RTSP server. FfmpegEncoder.cpp l:48\n");
}