
Recherche avancée
Autres articles (86)
-
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (8058)
-
Youtube livestream stops receiving video from time to time (ffmpeg)
15 décembre 2020, par wht_5005I have ip cam, raspberry pi (Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1036-raspi2 armv7l)) with ffmpeg (3.4.8-0ubuntu0.2) on board and I am trying to do 24/7 youtube livestream.
I have set up a service that start ffmpeg on boot. It receives rtsp stream from camera and sends it to youtube. Here is the ffmpeg setup :


ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://cam_address -c:v copy -af "aresample=async=1:first_pts=0" -c:a aac -ac 2 -ar 44100 -fflags +genpts -f flv rtmp://youtube_address -nostdin -nostats



I have noticed that ffmpeg may accidentally stop working from time to time (rather rarely but still) so the service should restart if ffmpeg crashes. Additionally just in case I have set up a cron job that restarts the service every hour, so if it stops working for some reason and that magic that should bring it up fails it should still get up within an hour.


What bothers me, sometimes it stops working but in an unusual way. The service on raspberry pi is running, ffmpeg is running as well, nethogs shows that ffmpeg is both receiving and sending proper amount of data. Stream status on youtube is all right as if everything was just fine but there is no video there (it looks as if it was still loading/buffering but it is not). Restarting the service does not make it work. However if I stop the service, wait a few seconds and start it again the youtube stream starts working as it is supposed to.


Why such things happen and how can I fix it ?


-
YouTube coding parameters [closed]
13 mai 2013, par Tim NI am trying to find the transcoding parameters to apply to a video to avoid recoding after upload.
Currently the best google seems to offer is lots of info on the API, and a 404 when it comes to the actual content itself. -
How to improve the fluency of rtsp streaming through ffmpeg (processing 16 pictures at the same time)
21 décembre 2024, par Ling YunWhen the button is clicked, I create 16 threads in Qt, and then pass the rtsp data address and the label to be rendered to the process, and then the process does this :
run :



void rtspthread::run()
{

 while(!shouldStop){
 openRtspStream(rtspUrl.toUtf8().constData(),index);
 }

 qDebug() << "RTSP stream stopped.";
 emit finished(); 
}




open input stream :


void rtspthread::openRtspStream(const char* rtspUrl,int index)

{

 AVDictionary *options = nullptr;
 AVFrame *pFrameRGB = nullptr;
 uint8_t *pOutBuffer = nullptr;
 struct SwsContext *swsContext;
 AVFormatContext *pFormatCtx = nullptr;
 pFormatCtx = avformat_alloc_context();
 av_dict_set(&options, "rtsp_transport", "tcp", 0);
 av_dict_set(&options, "maxrate", "4000k", 0);
 if (avformat_open_input(&pFormatCtx, rtspUrl, nullptr, &options) != 0) {
 printf("Couldn't open stream file.\n");
 return;
 }

 if (avformat_find_stream_info(pFormatCtx, NULL)<0)
 {
 printf("Couldn't find stream information.\n");
 return;
 }
 int videoStreamIndex = -1;
 for (int i = 0; i < pFormatCtx->nb_streams; i++) {
 if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
 videoStreamIndex = i;
 break;
 }
 }
 if (videoStreamIndex!=-1){
 AVStream* videoStream = pFormatCtx->streams[videoStreamIndex];
 
 AVCodecParameters* codecpar = videoStream->codecpar;
 const AVCodec* videoCodec = avcodec_find_decoder(codecpar->codec_id);

 AVCodecContext* videoCodecContext = avcodec_alloc_context3(videoCodec);

 avcodec_parameters_to_context(videoCodecContext,codecpar);

 avcodec_open2(videoCodecContext,videoCodec,nullptr);

 AVPixelFormat srcPixFmt = videoCodecContext->pix_fmt;
 QLabel* label = this->parentWidget->findChild("videoLabel");
 int targetWidth = label->width();
 int targetHeight = label->height();
 
 pOutBuffer = (uint8_t*)av_malloc(av_image_get_buffer_size(AV_PIX_FMT_RGB32,
 videoCodecContext->width,
 videoCodecContext->height, 1));

 
 pFrameRGB = av_frame_alloc();
 av_image_fill_arrays(pFrameRGB->data, pFrameRGB->linesize, pOutBuffer,
 AV_PIX_FMT_RGB32, videoCodecContext->width, videoCodecContext->height, 1);


 swsContext= sws_getContext(
 videoCodecContext->width,videoCodecContext->height,srcPixFmt,
 targetWidth, targetHeight,AV_PIX_FMT_RGB32,
 SWS_BICUBIC,nullptr,nullptr,nullptr
 );
 
 AVPacket packet;
 AVFrame* frame = av_frame_alloc();
 int frameCounter = 0;
 while (av_read_frame(pFormatCtx, &packet) >= 0) {
 if (shouldStop) {
 break;
 }
 if (packet.stream_index == videoStreamIndex) {
 
 int ret = avcodec_send_packet(videoCodecContext,&packet);
 int rets = avcodec_receive_frame(videoCodecContext, frame);
 if (rets < 0) {
 qDebug() << "Error receiving frame from codec context";
 }
 
 sws_scale(swsContext, frame->data, frame->linesize, 0, videoCodecContext->height,
 pFrameRGB->data, pFrameRGB->linesize);

 
 QImage img(pFrameRGB->data[0], targetWidth, targetHeight,
 pFrameRGB->linesize[0], QImage::Format_RGB32);
 
 qDebug() << index;

 emit frameReady(img.copy(),index);


 QThread::msleep(30); // 控制帧率
 }
 av_packet_unref(&packet);

 }
 av_frame_free(&frame);
 av_frame_free(&pFrameRGB);
 sws_freeContext(swsContext);
 avcodec_free_context(&videoCodecContext);
 avformat_close_input(&pFormatCtx);
 avformat_free_context(pFormatCtx);

 }


}




The video is stuck and has snow screen. I want to lower the resolution and reduce the snow screen. The server cannot change the resolution.