
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (60)
-
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 -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
MediaSPIP Init et Diogène : types de publications de MediaSPIP
11 novembre 2010, parÀ l’installation d’un site MediaSPIP, le plugin MediaSPIP Init réalise certaines opérations dont la principale consiste à créer quatre rubriques principales dans le site et de créer cinq templates de formulaire pour Diogène.
Ces quatre rubriques principales (aussi appelées secteurs) sont : Medias ; Sites ; Editos ; Actualités ;
Pour chacune de ces rubriques est créé un template de formulaire spécifique éponyme. Pour la rubrique "Medias" un second template "catégorie" est créé permettant d’ajouter (...)
Sur d’autres sites (5631)
-
streaming a webcam feed over rtsp using ffmpeg & ffserver to an android client
26 juillet 2015, par CoyoteI am trying to stream my webcam over rtsp and open the stream using android.
I managed to get the first part working (rtsp stream) using ffserver and ffmpgeg. Here is my ffserver.conf file :HTTPPort 8000
RTSPPort 8001
HTTPBindAddress 192.168.1.74
RTSPBindAddress 192.168.1.74
MaxClients 100
MaxBandwidth 10000
NoDefaults
<feed>
File /tmp/witty.ffm
FileMaxSize 20M
</feed>
<stream>
Feed witty.ffm
Format rtp
VideoSize 640x480
VideoQMin 1
VideoQMax 20
VideoFrameRate 30
VideoBitRate 500
AVOptionVideo flags +global_header
VideoCodec libx264
AVPresetVideo baseline
NoAudio
</stream>ffserver :
ffserver -f -d ffserver.conf // luch the server
and then I use FFmpeg to open the webcam (Mac OS)
ffmpeg -f avfoundation -i "default" http://192.168.1.74:8000/witty.ffm
I can open the stream from VLC but on android using a videoView i am getting an error (1,-38) and an alert view saying "can’t play this video".
-
Is there any problem in my FFMPEG encoder client code ?
29 janvier 2024, par kyhnzI am trying to write code have function of capture video stream, encode as hevc265 and send to server as UDP :


// There can some unnecessary library imports, rule 1: If it is ok, don't touch it!

#include <iostream>
#include <sys></sys>types.h>
#include 
#include <cstring>
#include <sys></sys>socket.h>
#include <arpa></arpa>inet.h>
#include <netinet></netinet>in.h> 
#include <string>
#include <cstdlib>
#include <cstdio>

extern "C"
{
#include <libavutil></libavutil>frame.h>
#include <libavdevice></libavdevice>avdevice.h>
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
#include <libavutil></libavutil>imgutils.h>
#include <libavcodec></libavcodec>packet.h>
#include <libavcodec></libavcodec>codec_id.h>
#include <libavutil></libavutil>error.h>
#include <libavutil></libavutil>error.h>
#include <libavutil></libavutil>opt.h>
}

#define PORT 9999
#define IP_ADDRESS "127.0.0.1"

using namespace std;

int main(){
 const int width = 1080;
 const int height = 720;
 const int fps = 18; 
 const auto resulation = "1080x720";
 const auto device = "/dev/video0";
 const auto format = "v4l2";
 const AVCodecID codec_id = AV_CODEC_ID_H265;

 avdevice_register_all();
 avformat_network_init();
 AVFormatContext *formatContext = nullptr;

 AVDictionary *format_opts = nullptr;
 av_dict_set(&format_opts, "framerate", "18", 0);;
 av_dict_set(&format_opts, "video_size", resulation, 0);
 
 const AVInputFormat *inputFormat = av_find_input_format(format);
 if (!inputFormat)
 {
 cerr << "Unknown input format: " << format << endl;
 return 1;
 }
 cout << "Input format: "<< format << endl;

 const AVCodec *codec = avcodec_find_encoder(codec_id);
 if (!codec) {
 cerr << "Codec can't find "<< codec_id << endl;
 return 1;
 }
 cout << "Found codec: "<< codec_id << endl;

 AVCodecContext *avctx = avcodec_alloc_context3(codec);
 if (!avctx) {
 cerr << "Error: Could not create encoder!" << endl;
 return 1;
 }
 cout << "Create encoder. " << endl;


 avctx->bit_rate = 1000000;
 avctx->width = width; 
 avctx->height = height; 
 avctx->pix_fmt = AV_PIX_FMT_YUV420P; 
 avctx->time_base = (AVRational){1, fps};
 avctx->framerate = (AVRational){fps, 1};
 avctx->gop_size = fps*2;
 avctx->refs = 3;

 av_opt_set(avctx->priv_data, "preset", "medium", 0);
 av_opt_set(avctx->priv_data, "crf", "18", 0);
 av_opt_set(avctx->priv_data, "tune", "zerolatency", 0);

 if (avcodec_open2(avctx, codec, nullptr) < 0) {
 cerr << "Error: Couldn't open codec" << endl;
 return 1;
 }
 cout << "Open codec succesfully." << endl;

 int open_input = avformat_open_input(&formatContext, device,
 const_cast<avinputformat>(inputFormat), &format_opts);
 if (open_input != 0)
 {
 cerr << "Device cant open " << device << endl;
 return 1;
 }
 cout << "Device active: " << device <width = avctx->width;
 frame->height = avctx->height;
 frame->format = avctx->pix_fmt;

 if(av_frame_get_buffer(frame, 0) != 0){
 cerr << "Error: video frame " << endl;
 return 1;
 }cout << "Video frame has been created." << endl;

 if(av_frame_make_writable(frame) != 0){
 cerr << "Error: frame is not writable" << endl;
 return 1;
 }

 AVPacket *packet= av_packet_alloc();
 if (!packet) {
 cerr << "error: has not been created packet" << endl;
 }

 av_dump_format(formatContext, 0, device, 0);
 av_dict_free(&format_opts);
 
 int socket_client = socket(AF_INET, SOCK_DGRAM, 0);
 if (socket_client == -1) {
 cerr << "Error: socket!" << endl;
 exit(EXIT_FAILURE);
 }
 cout << "Socket has been created" << endl;

 struct sockaddr_in serverAddr = {0};
 serverAddr.sin_family = AF_INET;
 serverAddr.sin_port = htons(PORT);
 serverAddr.sin_addr.s_addr = inet_addr(IP_ADDRESS);

 while (true) {
 if (av_read_frame(formatContext, packet) != 0) {
 cerr << "Error" << endl;
 av_packet_unref(packet);
 continue;
 }

 frame->data[7] = packet->data; 
 frame->linesize[7] = packet->size;

 if (avcodec_send_frame(avctx, frame) != 0){
 cerr << "Error: Frame sending is missing ---> "<< &av_strerror << endl;
 av_packet_unref(packet);
 continue;
 }

 if (avcodec_receive_packet(avctx, packet) != 0){
 cerr << "Error: Packet giving is missing! ---> " << &av_strerror << endl;
 av_packet_unref(packet);
 continue;
 }

 ssize_t snd = sendto(socket_client, packet->data, packet->size,
 MSG_CONFIRM, (struct sockaddr *)&serverAddr,
 sizeof(serverAddr));

 if(snd == -1){
 cerr << "Error: Data sending failed !" << endl;
 av_packet_unref(packet);
 continue;
 }else {
 cout << "Data sending succesfully" << endl;
 }

 av_packet_unref(packet);
 av_frame_unref(frame);
 }

 av_frame_free(&frame);
 av_packet_free(&packet);
 close(socket_client);
 avformat_free_context(formatContext);
 avformat_close_input(&formatContext);
 avformat_network_deinit();

 return 0;
}
</avinputformat></cstdio></cstdlib></string></cstring></iostream>


There is such an output, I do not understand the reason yet :


[video4linux2,v4l2 @ 0x643732e80b40] The V4L2 driver changed the video from 1080x720 to 1280x720
[video4linux2,v4l2 @ 0x643732e80b40] The V4L2 driver changed the video from 1280x720 to 640x480
[video4linux2,v4l2 @ 0x643732e80b40] The driver changed the time per frame from 1/18 to 1/30



Is there any problem in my encoder client code ?


In addition, i can't send datas to server.


-
FFPMEG : stream local video to UDP address, make client aware about video length and current frame time offset (make stream seekable ?)
17 décembre 2014, par klimJust started to use FFMPEG. This is a really great library which is capable of video life transcoding and streaming.
I use following commands to transcode and stream local video file to UDP address :
ffmpeg -y -re -i inputvideo.mpeg2 -vsync 1 -vcodec mpeg4 -b 1600k -r 15 -crf 20 -acodec aac -ar 44100 -strict -2 -f mpegts udp ://192.168.1.30:1234It works smooth. I can open this udp address in VLC player and play life stream.
Does anybody know how to make client aware about video duration and current time stamp ?
Ideally would be nice to make stream seekable, as far as I understand it is not possible, but at least I would like to tell VLC client the total duration of the video and current frame time stamp, so it could show the progress.
Thanks.