
Recherche avancée
Médias (91)
-
Les Miserables
9 décembre 2019, par
Mis à jour : Décembre 2019
Langue : français
Type : Textuel
-
VideoHandle
8 novembre 2019, par
Mis à jour : Novembre 2019
Langue : français
Type : Video
-
Somos millones 1
21 juillet 2014, par
Mis à jour : Juin 2015
Langue : français
Type : Video
-
Un test - mauritanie
3 avril 2014, par
Mis à jour : Avril 2014
Langue : français
Type : Textuel
-
Pourquoi Obama lit il mes mails ?
4 février 2014, par
Mis à jour : Février 2014
Langue : français
-
IMG 0222
6 octobre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Image
Autres articles (64)
-
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 (...) -
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 (8584)
-
xuggler could not find input codec id (avi, msvideo1)
8 février 2012, par mrzasaI convert video from different formats to flv using xuggle MediaTool. For most of cases it works fine, but when I try an
.avi
file encoded withmsvideo1
,indeo3
orcinepark
, xuggler throwsjava.lang.IllegalArgumentException: could not find input codec id
onreader.readPacket()
.I checked, that my ffmpeg supports msvideo decoding :
> ffmpeg -codecs
(...)
D V D msvideo1 Microsoft Video 1
D V D indeo3 Intel Indeo 3
D V D cinepak CinepakWhat is more, I'm able to convert files encoded with these codecs from the command line (usign ffmpeg).
What might be the reason for such behaviour ?
-
FFMpeg Coding in C : Encoder returns EOF at first interaction. Encoder not opened correctly ? [closed]
26 février, par Davidhoheyas I'm fairly new to FFMpeg Programming and C in general, the code looks like a mess.


I have smashed my head against a wall trying to get this code to work for about a week.


int decode_encode_pipeline(AVFormatContext *Input_Format_Context, AVFormatContext *Output_Format_Context, int *streams_list){

 const AVCodec *DECodec, *ENCodec;
 AVCodecContext *DECodecContext = NULL, *ENCodecContext = NULL;
 AVCodecParameters *CodecParameters = NULL;
 AVDictionary *opts = NULL;
 AVPacket *Packet;
 AVFrame *Frame;
 int check;

 Packet = av_packet_alloc();
 if(!Packet){
 
 printf("\nFehler bei Allocating Packet");
 
 return 0;
 
 }

 Frame = av_frame_alloc();
 if(!Frame){
 
 printf("\nFehler bei Allocating Frame");
 
 return 0;
 
 }

 CodecParameters = Input_Format_Context->streams[Packet->stream_index]->codecpar;
 if(!CodecParameters){

 printf("\nCodecParameters konnte nicht erstellt oder zugewiesen werden.");

 }

 DECodec = avcodec_find_decoder(CodecParameters->codec_id);
 if(!DECodec){
 
 printf("\nCodec nicht gefunden");
 
 return 0;
 
 }

 DECodecContext = avcodec_alloc_context3(DECodec);
 if (!DECodecContext){
 
 printf("\nFehler bei Allocating CodecContext");
 
 return 0;
 
 }

 ENCodec = avcodec_find_encoder(CodecParameters->codec_id);
 if(!DECodec){
 
 printf("\nCodec nicht gefunden");
 
 return 0;
 
 }

 ENCodecContext = avcodec_alloc_context3(ENCodec);
 if (!ENCodecContext){
 
 printf("\nFehler bei Allocating CodecContext");
 
 return 0;
 
 }

 check = avformat_write_header(Output_Format_Context, &opts);
 if(check < 0){

 printf("\nFehler beim Öffnen des Output Files.");
 
 return 1;

 }

 avcodec_parameters_to_context(DECodecContext, CodecParameters);
 avcodec_parameters_to_context(ENCodecContext, CodecParameters);

 ENCodecContext->width = DECodecContext->width;
 ENCodecContext->height = DECodecContext->height;
 ENCodecContext->bit_rate = DECodecContext->bit_rate;
 ENCodecContext->time_base = (AVRational){1, 30};
 ENCodecContext->framerate = DECodecContext->framerate;
 ENCodecContext->gop_size = DECodecContext->gop_size;
 ENCodecContext->max_b_frames = DECodecContext->max_b_frames;
 ENCodecContext->pix_fmt = DECodecContext->pix_fmt;
 if(ENCodec->id == AV_CODEC_ID_H264){

 av_opt_set(ENCodecContext->priv_data, "preset", "slow", 0);

 }

 check = avcodec_open2(DECodecContext, DECodec, NULL);
 if(check < 0){
 
 printf("\nFehler bei Öffnen von DECodec");
 
 return 1;
 
 }

 check = avcodec_open2(ENCodecContext, ENCodec, NULL);
 if(check < 0){
 
 printf("\nFehler bei Öffnen von ENCodec");
 
 return 1;
 
 }

 while(1){
 
 check = av_read_frame(Input_Format_Context, Packet);
 if(check < 0){
 
 break;
 
 }

 AVStream *in_stream, *out_stream;

 in_stream = Input_Format_Context->streams[Packet->stream_index];
 out_stream = Output_Format_Context->streams[Packet->stream_index];

 if(in_stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && Packet->stream_index == streams_list[Packet->stream_index]){

 check = avcodec_send_packet(DECodecContext, Packet);
 if(check < 0){

 printf("\nFehler bei Encoding");

 return 1;

 }

 AVPacket *EncodedPacket;
 EncodedPacket = av_packet_alloc();
 if(!EncodedPacket){
 
 printf("\nFehler bei Allocating Packet");
 
 return 1;
 
 }

 /*While Loop Decoding*/
 while(check >= 0){
 
 check = avcodec_receive_frame(DECodecContext, Frame);
 if(check == AVERROR(EAGAIN)){
 
 continue;
 
 }else if(check == AVERROR_EOF){
 
 break;
 
 }else if(check < 0){
 
 printf("\nFehler bei Decoding");
 
 return 1;
 
 }

 /*Convert Colorspace*/
 struct SwsContext *SwsContexttoRGB = sws_getContext(Frame->width, Frame->height, Frame->format, Frame->width, Frame->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL);
 struct SwsContext *SwsContexttoOriginal = sws_getContext(Frame->width, Frame->height, AV_PIX_FMT_RGB24, Frame->width, Frame->height, Frame->format, SWS_BILINEAR, NULL, NULL, NULL);
 if(!SwsContexttoRGB || !SwsContexttoOriginal){

 printf("\nSwsContext konnte nicht befüllt werden.");

 return 1;

 } 

 if(Frame->linesize < 0){

 printf("\nFehler: linesize ist negativ und nicht kompatibel\n");

 return 1;

 }

 AVFrame *RGBFrame;
 RGBFrame = av_frame_alloc();
 if(!RGBFrame){

 printf("\nFehler bei der Reservierung für den RGBFrame");

 return 1;

 }
 /*
 int number_bytes = av_image_get_buffer_size(AV_PIX_FMT_RGB24, Frame->width, Frame->height, 1);
 if(number_bytes < 0){

 printf("\nFehler bei der Berechnung der benoetigten Bytes fuer Konvertierung");

 return 1;

 }
 
 uint8_t *rgb_buffer = (uint8_t *)av_malloc(number_bytes*sizeof(uint8_t));
 if(rgb_buffer == NULL){

 printf("\nFehler bei der Reservierung für den RGBBuffer");

 return 1;

 }

 check = av_image_fill_arrays(RGBFrame->data, RGBFrame->linesize, rgb_buffer, AV_PIX_FMT_RGB24, Frame->width, Frame->height, 1);
 if(check < 0){

 printf("\nFehler bei der Zuweisung der RGB Daten");

 return 1;

 }*/

 //sws_scale(SwsContexttoRGB, (const uint8_t * const *)Frame->data, Frame->linesize, 0, Frame->height, RGBFrame->data, RGBFrame->linesize);
 sws_scale_frame(SwsContexttoRGB, Frame, RGBFrame);
 printf("\nIch habe die Daten zu RGB konvertiert.");

 //sws_scale(SwsContexttoOriginal, (const uint8_t * const *)RGBFrame->data, RGBFrame->linesize, 0, Frame->height, Frame->data, Frame->linesize);
 sws_scale_frame(SwsContexttoOriginal, RGBFrame, Frame);
 printf("\nIch habe die Daten zurück ins Original konvertiert.");

 Frame->format = ENCodecContext->pix_fmt;
 Frame->width = ENCodecContext->width;
 Frame->height = ENCodecContext->height;
 
 check = av_frame_get_buffer(Frame, 0);
 if(check < 0){
 
 printf("\nFehler bei Allocating Frame Buffer");
 
 return 1;
 
 }

 /* Encoding */
 check = av_frame_make_writable(Frame);
 if(check < 0){

 printf("\nFehler bei Make Frame Writable");

 return 1;

 }

 encode(ENCodecContext, Frame, EncodedPacket, Output_Format_Context);

 sws_freeContext(SwsContexttoRGB);
 sws_freeContext(SwsContexttoOriginal);
 av_frame_free(&RGBFrame);
 //av_free(rgb_buffer);

 }

 /* Flushing Encoder */
 encode(ENCodecContext, NULL, EncodedPacket, Output_Format_Context);

 //avcodec_flush_buffers(DECodecContext);
 //avcodec_flush_buffers(ENCodecContext);

 av_packet_free(&EncodedPacket);

 }else{

 av_interleaved_write_frame(Output_Format_Context, Packet);

 }

 }

 av_write_trailer(Output_Format_Context); 

 /* Memory Free */
 avcodec_free_context(&DECodecContext);
 avcodec_free_context(&ENCodecContext);
 avcodec_parameters_free(&CodecParameters);
 av_frame_free(&Frame);
 av_packet_free(&Packet);

 return 0;

}




The function encode looks as follows :


static void encode(AVCodecContext *ENCodecContext, AVFrame *Frame, AVPacket *EncodedPacket, AVFormatContext *Output_Format_Context){

 int check;



 check = avcodec_send_frame(ENCodecContext, Frame);
 if(check == AVERROR(EAGAIN)){
 printf("\nEAGAIN");
 } 
 if(check == AVERROR_EOF){
 printf("\nEOF");
 }
 if(check == AVERROR(EINVAL)){
 printf("\nEINVAL");
 }
 if(check == AVERROR(ENOMEM)){
 printf("\nENOMEM");
 }
 if(check < 0){

 printf("\nFehler bei Encoding Send Frame. Check = %d", check);

 return;

 }

 while(check >= 0){

 check = avcodec_receive_packet(ENCodecContext, EncodedPacket);
 if(check == AVERROR(EAGAIN) || check == AVERROR_EOF){

 return;

 }else if(check < 0){

 printf("\nFehler bei Encoding");

 return;

 }

 if (av_interleaved_write_frame(Output_Format_Context, EncodedPacket) < 0) {

 printf("\nFehler beim Muxen des Paketes.");
 break;

 }

 av_packet_unref(EncodedPacket);

 }

 return;

}



The program should decode a video into the individual frames convert them to RGB24, so I can work with the raw data of the frame, then convert it back to the original format and encode the frames.


The encoder doesn't play nice, as I get an EOF error at avcodec_send_frame().
But I couldn't figure it out why the encoder behaves like this.
And yes I have read the docs and example files, but either I'm massivly missing a crucial detail or I'm just ****.


Any and all help will be and is massivly appreciated.


PS. : The used libraries are libavutil, libavformat, libavcodec, libswscale. All installed with the "-dev" suffix through linux commandline. Should all be the version 7.0 libraries.


Thanks in advance.
With best regards.


- 

- Read the docs
- Shifting the encoding step out of the decoding while loop






-
ffmpeg is reading SDP from RTSP stream but unable to save a screenshot. is it network or utility issue ?
8 juillet 2017, par Paul SerikovMy task is to get a screenshot from IP camera rtsp stream via
ffmpeg
.
I got following error when I’m trying to do that on DigitalOcean droplet :root@docker-512mb-fra1-01:~# ffmpeg -hide_banner -loglevel debug -i rtsp://10.132.193.9//ch0.h264 -f image2 latest.jpg
Splitting the commandline.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'rtsp://10.132.193.9//ch0.h264'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'image2'.
Reading option 'latest.jpg' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option hide_banner (do not show program banner) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://10.132.193.9//ch0.h264.
Successfully parsed a group of options.
Opening an input file: rtsp://10.132.193.9//ch0.h264.
[rtsp @ 0x1298440] SDP:
v=0
o=- 1499314217993040 1 IN IP4 192.168.1.128
s=H.264 Program Stream, streamed by the LIVE555 Media Server
i=ch0.h264
t=0 0
a=DevVer:pusher2
a=GroupName:IPCAM
a=NickName:CIF
a=CfgSection:PROG_CHN0
a=tool:LIVE555 Streaming Media v2011.08.13
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:H.264 Program Stream, streamed by the LIVE555 Media Server
a=x-qt-text-inf:ch0.h264
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:4000
a=rtpmap:96 H264/90000
a=control:trackID=1
a=fmtp:96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z2QAH6wrUCgC3IA=,aO48MA==
a=framesize:96 1280-720
a=cliprect:0,0,1280,720
m=audio 0 RTP/AVP 97
a=rtpmap:97 mpeg4-generic/8000/2
a=fmtp:97 streamtype=5;profile-level-id=1;cpresent=0;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1590
a=control:trackID=2
Failed to parse interval end specification ''
[rtsp @ 0x1298440] video codec set to: h264
[rtsp @ 0x1298440] RTP Packetization Mode: 1
[rtsp @ 0x1298440] RTP Profile IDC: 64 Profile IOP: 0 Level: 1f
[rtsp @ 0x1298440] Extradata set to 0x1298a20 (size: 23)
[rtsp @ 0x1298440] audio codec set to: aac
[rtsp @ 0x1298440] audio samplerate set to: 8000
[rtsp @ 0x1298440] audio channels set to: 2
[udp @ 0x129e7e0] end receive buffer size reported is 131072
[udp @ 0x129e680] end receive buffer size reported is 131072
[udp @ 0x12bf380] end receive buffer size reported is 131072
[udp @ 0x12bf1c0] end receive buffer size reported is 131072
[rtsp @ 0x1298440] hello state=0
[rtsp @ 0x1298440] UDP timeout, retrying with TCP
[rtsp @ 0x1298440] hello state=0
[rtsp @ 0x1298440] Could not find codec parameters for stream 0 (Video: h264, 1 reference frame, none(left), 1280x720, 1/180000): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://10.132.193.9//ch0.h264':
Metadata:
title : H.264 Program Stream, streamed by the LIVE555 Media Server
comment : ch0.h264
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0, 0, 1/90000: Video: h264, 1 reference frame, none(left), 1280x720, 1/180000, 90k tbr, 90k tbn, 180k tbc
Stream #0:1, 0, 1/8000: Audio: aac, 8000 Hz, stereo, fltp
Successfully opened the file.
Parsing a group of options: output url latest.jpg.
Applying option f (force format) with argument image2.
Successfully parsed a group of options.
Opening an output file: latest.jpg.
Successfully opened the file.
detected 1 logical cores
[graph 0 input from stream 0:0 @ 0x1298280] Setting 'video_size' to value '1280x720'
[graph 0 input from stream 0:0 @ 0x1298280] Setting 'pix_fmt' to value '-1'
[buffer @ 0x12f9680] Unable to parse option value "-1" as pixel format
[graph 0 input from stream 0:0 @ 0x1298280] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:0 @ 0x1298280] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x1298280] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x1298280] Setting 'frame_rate' to value '180000/2'
[buffer @ 0x12f9680] Unable to parse option value "-1" as pixel format
[buffer @ 0x12f9680] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0x1298280] Error applying options to the filter.
Error opening filters!
Exiting normally, received signal 2.As you see, ffmpeg is able to read SDP metadata, but for some reason is unable to save a screenshot
Also same command works fine on my laptop with same VPN configuration !
Just in case, IP camera doesn’t have a public IP address and accessible via VPN.
What could be wrong and how to debug ?
I tried to increase
-analyzeduration
and-probesize
options from default 5s to 30s, but it doesn’t work.