Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (33)

  • Qualité du média après traitement

    21 juin 2013, par

    Le bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
    Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (7353)

  • ffmpeg got black and white video when encoding flv

    17 décembre 2012, par samyou

    i searched the site and got a post :
    getting black and white image after encoding
    but i got no answer.

    don't know how but it is all black and white.

    hear is the init code :

    JNIEXPORT jboolean JNICALL Java_sam_flvmuxer_SamRTMPNative_nativeInitMuxerAndStart(
       JNIEnv *env, jclass jcls, jstring outfile, jint inwidth, jint inheight,
       jint fps) {
    audioOutBuffer = malloc(AUDIO_OUT_BUFFER_SIZE);
    videoOutBuffer = malloc(VIDEO_OUT_BUFFER_SIZE);
    VIDEO_WIDTH = inwidth;
    VIDEO_HEIGHT = inheight;
    av_log_set_callback(samffmpeglogback);
    av_register_all();
    char *filepath = (*env)->GetStringUTFChars(env, outfile, 0);
    JNILOG("file path is %s",filepath);
    avformat_alloc_output_context2(&avFormatContext, NULL, NULL, filepath);
    if (!avFormatContext) {
       JNILOG("avformat_alloc_output_context2 with filepath failed");
       return JNI_FALSE;
    }
    AVOutputFormat *fmt = avFormatContext->oformat;
    //fmt->video_codec = VIDEO_CODEC_ID;
    ////init video
    avVideoStream = avformat_new_stream(avFormatContext, NULL );
    if (!avVideoStream) {
       (*env)->ReleaseStringUTFChars(env, outfile, filepath);
       return 0;
    }

    AVCodec *videocodec = avcodec_find_encoder(VIDEO_CODEC_ID);
    if (!videocodec) {
       JNILOG("avcodec_find_encoder error");
       return JNI_FALSE;
    }
    avcodec_get_context_defaults3(avVideoStream->codec, videocodec);

    AVCodecContext *avVideoCodecContext = avVideoStream->codec;
    avVideoCodecContext->codec_type = AVMEDIA_TYPE_VIDEO;
    avVideoCodecContext->codec_id = VIDEO_CODEC_ID;
    avVideoCodecContext->width = inwidth;
    avVideoCodecContext->height = inheight;
    avVideoCodecContext->time_base.den = fps;
    avVideoCodecContext->time_base.num = 1;
    avVideoCodecContext->gop_size = 10;
    avVideoCodecContext->pix_fmt = PIX_FMT_YUV420P;
    JNILOG("bitrate befort set = %d",avVideoCodecContext->bit_rate);
    avVideoCodecContext->bit_rate = 600000;


    if (fmt->flags & AVFMT_GLOBALHEADER)
       avVideoCodecContext->flags |= CODEC_FLAG_GLOBAL_HEADER;

    av_dump_format(avFormatContext,0,filepath,1);
    if(avcodec_open2(avVideoCodecContext,videocodec,NULL)<0)
    {
       JNILOG("video avcodec_open2 failed");
       (*env)->ReleaseStringUTFChars(env, outfile, filepath);
       return JNI_FALSE;
    }



    ///////
    /* open the output file, if needed */
    if (!(fmt->flags & AVFMT_NOFILE)) {
       if ((avio_open(&avFormatContext->pb, filepath, AVIO_FLAG_WRITE)) < 0) {
           JNILOG("Could not open file!");
           (*env)->ReleaseStringUTFChars(env, outfile, filepath);
           return 0;
       }
    }
    if (avformat_write_header(avFormatContext, NULL ) < 0) {
       JNILOG("Could not avformat_write_header!");
       (*env)->ReleaseStringUTFChars(env, outfile, filepath);
       return 0;
    }
    (*env)->ReleaseStringUTFChars(env, outfile, filepath);
    YUVFrame = avcodec_alloc_frame();
    JNILOG("ffmpeg every thing inited");
    return JNI_TRUE;
    }

    and encode code looks like below :

    avpicture_fill((AVPicture *)YUVFrame,framedata,PIX_FMT_YUV420P,VIDEO_WIDTH,VIDEO_HEIGHT);
       ///打印data 分量!!!!
       AVPacket pkt;
       av_init_packet(&pkt);
       pkt.data = videoOutBuffer;
       pkt.size = VIDEO_OUT_BUFFER_SIZE;
       int gotpkt = 0;
       avcodec_encode_video2(avVideoStream->codec,&pkt,YUVFrame,&gotpkt);
       if (gotpkt > 0) {
           JNILOG("encoded size=%d,gotpktflag=%d",pkt.size,gotpkt);
           pkt.stream_index = avVideoStream->index;
           pkt.flags |= AV_PKT_FLAG_KEY;
           pkt.pts = timestamp;
           while (pkt.pts <= lastVideoPts) {
               pkt.pts++;
           }
           lastVideoPts = pkt.pts;
           if (av_interleaved_write_frame(avFormatContext, &pkt) < 0) {
               JNILOG("av_interleaved_write_frame failed");
           }
       }

    someone please help me with this problem^^

  • How to Replace Duplicate Frames in a Video with Black Frames using ffmpeg ?

    21 mars 2021, par Yam Shargil

    I'm trying to trim all "no action, no movement" frames out of my screen recording. Some of my screen recordings are really long (like 100 hours long).

    


    I found this :
How to Simply Remove Duplicate Frames from a Video using ffmpeg

    


    ffmpeg -i in.mp4 -vf
"select='if(gt(scene,0.01),st(1,t),lte(t-ld(1),1))',setpts=N/FRAME_RATE/TB"
trimmed.mp4


    


    I don't want to lose any important frames, so for testing the threshold purposes, I want to replace (not remove) all the "no action" frames with black frames.

    


    That's my best shot so far, not my proudest work :

    


    ffmpeg -i in.mp4 -vf "select='if(gt(scene,0.01),st(1,t),lte(t-ld(1),1))',drawbox=color=black:t=fill" out.mp4


    


  • Using ffmpeg to overlay black line or add border to two side by side videos

    14 février 2020, par user3135427

    I am using the following to generate a video that is side by side.

    ffmpeg -i left.mp4 -i right.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=w" -y final.mp4

    It looks like this.

    http://www.mo-de.net/d/partnerAcrobatics.mp4

    I would like to place a vertical black line on top right in the middle or add a black border to the video on the left. If I add a border to the left video I would like to maintain the original sum dimension of the original videos. This solution would require subtracting the border width from the left videos width. I will take either solution.

    Thanks