Recherche avancée

Médias (1)

Mot : - Tags -/stallman

Autres articles (42)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Modifier la date de publication

    21 juin 2013, par

    Comment changer la date de publication d’un média ?
    Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
    Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
    Dans la rubrique "Champs à ajouter, cocher "Date de publication "
    Cliquer en bas de la page sur Enregistrer

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

Sur d’autres sites (5459)

  • audio discontinuity in ffmpeg joined youtube video

    1er novembre 2016, par MrPeach

    I downloaded 4 parts of a video of youtube, and I wanted to join them.

    My first (conservative) attempt :

    echo file 'Part 1.mp4' > m
    echo file 'Part 2.mp4' >> m
    echo file 'Part 3.mp4' >> m
    echo file 'Part 4.mp4' >> m
    ffmpeg -f concat -i m -c copy 1a.mp4

    Result : A/V sync good, at transition video garbled, audio discontinuity

    Second (extreme) attempt :

    echo file '1.avi' > m
    echo file '2.avi' >> m
    echo file '3.avi' >> m
    echo file '4.avi' >> m

    ffmpeg -y -i "Part 1.mp4" -f avi -acodec pcm_s16le -ac 2 -ar 44100 -vcodec rawvideo -pix_fmt yuv420p 1.avi
    ffmpeg -y -i "Part 2.mp4" -f avi -acodec pcm_s16le -ac 2 -ar 44100 -vcodec rawvideo -pix_fmt yuv420p 2.avi
    ffmpeg -y -i "Part 3.mp4" -f avi -acodec pcm_s16le -ac 2 -ar 44100 -vcodec rawvideo -pix_fmt yuv420p 3.avi
    ffmpeg -y -i "Part 4.mp4" -f avi -acodec pcm_s16le -ac 2 -ar 44100 -vcodec rawvideo -pix_fmt yuv420p 4.avi

    ffmpeg -f concat -i m -c:a libvo_aacenc -c:v h264 1b.mp4

    Result : A/V sync issues in first section, at transition slight jump in video, audio discontinuity

    I have no idea how to fix this. Thoughts ?

    Update :

    Both the audio and video exhibit issues - skipping and duplication of a short section at some joins.

    My ultimate solution was to check the a&v section joins for duplication and trim that off if it exists, and for the audio cut out any silence sections as best as the waveform allowed. Lastly, modify the audio tempo to match the length of the video.

    It’s a terrible hack, but it’s what I’m stuck with. If anyone ever comes up with a better approach, I’d love to hear of it.

  • Anomalie #4736 : nouveau date picker et la modalbox ou les crayons dans le public

    17 avril 2021, par RastaPopoulos ♥

    Je suis d’accord pour dire qu’il faut le moins de hack etc ok.

    Pour autant je ne suis pas d’accord effectivement avec l’argumentation "ça a été fait que pour l’admin de SPIP".

    De mon point de vue, à peu près tout ce qui est fonctionnel ne fait pas du tout partie de "l’admin de SPIP". D’ailleurs un jour (quand on redécoupera pour Composer par ex) il faudrait déplacer ces éléments dans un autre dossier afin de mieux comprendre (et ça nous forcera à bien faire attention à ce que ces éléments marchent ailleurs)

    D’un côté le core fournit des briques fonctionnelles (API, formulaires insérables partout, etc), et de l’autre on a une interface d’admin par défaut, qui est une manière (couvrant 95% des besoins) de présenter l’administration du site. Mais toutes les briques fonctionnelles doivent être utilisables ailleurs que dans l’admin. Notamment tous les formulaires CVT sont insérables ailleurs et doivent fonctionner. Et donc si un form d’un objet à un champ pour choisir une date, que ce soit de la dist ou editer_evenement d’Agenda ou autre, ça doit marcher qu’on soit dans l’admin ou qu’on l’utilise ailleurs.

    Que quelques rares fonctionnalités ne soient prévues que pour l’admin ok, par ex les forms de SVP, la gestion des plugins, c’est logique. Mais "avoir un champ date" c’est tellement courant, que ça ne devrait pas être cloisonné à l’admin.

  • FFMPEG : multiplexing streams with different duration

    16 avril 2018, par Michael IV

    I am multiplexing video and audio streams. Video stream comes from generated image data. The audio stream comes from aac file. Some audio files are longer than total video time I set so my strategy to stop audio stream muxer when its time becomes larger than the total video time(the last one I control by number encoded video frames).

    I won’t put here the whole setup code, but it is similar to muxing.c example from the latest FFMPEG repo. The only difference is that I use audio stream from file,as I said, not from synthetically generated encoded frame. I am pretty sure the issue is in my wrong sync during muxer loop.Here is what I do :

    void AudioSetup(const char* audioInFileName)
    {
       AVOutputFormat* outputF = mOutputFormatContext->oformat;
       auto audioCodecId = outputF->audio_codec;

       if (audioCodecId == AV_CODEC_ID_NONE) {
           return false;
       }

       audio_codec = avcodec_find_encoder(audioCodecId);

       avformat_open_input(&mInputAudioFormatContext,
       audioInFileName, 0, 0);
       avformat_find_stream_info(mInputAudioFormatContext, 0);

       av_dump_format(mInputAudioFormatContext, 0, audioInFileName, 0);


       for (size_t i = 0; i < mInputAudioFormatContext->nb_streams; i++) {
           if (mInputAudioFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
               inAudioStream = mInputAudioFormatContext->streams[i];

               AVCodecParameters *in_codecpar = inAudioStream->codecpar;
               mAudioOutStream.st = avformat_new_stream(mOutputFormatContext, NULL);
               mAudioOutStream.st->id = mOutputFormatContext->nb_streams - 1;
               AVCodecContext* c = avcodec_alloc_context3(audio_codec);
               mAudioOutStream.enc = c;
               c->sample_fmt = audio_codec->sample_fmts[0];
               avcodec_parameters_to_context(c, inAudioStream->codecpar);
               //copyparams from input to autput audio stream:
               avcodec_parameters_copy(mAudioOutStream.st->codecpar, inAudioStream->codecpar);

               mAudioOutStream.st->time_base.num = 1;
               mAudioOutStream.st->time_base.den = c->sample_rate;

               c->time_base = mAudioOutStream.st->time_base;

               if (mOutputFormatContext->oformat->flags & AVFMT_GLOBALHEADER) {
                   c->flags |= CODEC_FLAG_GLOBAL_HEADER;
               }
               break;
           }
       }
    }

    void Encode()
    {
       int cc = av_compare_ts(mVideoOutStream.next_pts, mVideoOutStream.enc->time_base,
       mAudioOutStream.next_pts, mAudioOutStream.enc->time_base);

       if (mAudioOutStream.st == NULL || cc <= 0) {
           uint8_t* data = GetYUVFrame();//returns ready video YUV frame to work with
           int ret = 0;
           AVPacket pkt = { 0 };
           av_init_packet(&pkt);
           pkt.size = packet->dataSize;
           pkt.data = data;
           const int64_t duration = av_rescale_q(1, mVideoOutStream.enc->time_base, mVideoOutStream.st->time_base);

           pkt.duration = duration;
           pkt.pts = mVideoOutStream.next_pts;
           pkt.dts = mVideoOutStream.next_pts;
           mVideoOutStream.next_pts += duration;

           pkt.stream_index = mVideoOutStream.st->index;
           ret = av_interleaved_write_frame(mOutputFormatContext, &pkt);
       } else
       if(audio_time <  video_time) {
           //5 -  duration of video in seconds
           AVRational r = {  60, 1 };

           auto cmp= av_compare_ts(mAudioOutStream.next_pts, mAudioOutStream.enc->time_base, 5, r);
           if (cmp >= 0) {
               mAudioOutStream.next_pts = (int64_t)std::numeric_limits::max();
               return true; //don't mux audio anymore
           }

           AVPacket a_pkt = { 0 };
           av_init_packet(&a_pkt);

           int ret = 0;
           ret = av_read_frame(mInputAudioFormatContext, &a_pkt);
           //if audio file is shorter than stop muxing when at the end of the file
           if (ret == AVERROR_EOF) {
               mAudioOutStream.next_pts = (int64_t)std::numeric_limits::max();
               return true;
           }
           a_pkt.stream_index = mAudioOutStream.st->index;

           av_packet_rescale_ts(&a_pkt, inAudioStream->time_base, mAudioOutStream.st->time_base);
           mAudioOutStream.next_pts += a_pkt.pts;

           ret = av_interleaved_write_frame(mOutputFormatContext, &a_pkt);
       }
    }

    Now, the video part is flawless. But if the audio track is longer than video duration, I am getting total video length longer by around 5% - 20%, and it is clear that audio is contributing to that as video frames are finished exactly where there’re supposed to be.

    The closest ’hack’ I came with is this part :

    AVRational r = {  60 ,1 };
    auto cmp= av_compare_ts(mAudioOutStream.next_pts, mAudioOutStream.enc->time_base, 5, r);
    if (cmp >= 0) {
       mAudioOutStream.next_pts = (int64_t)std::numeric_limits::max();
       return true;
    }

    Here I was trying to compare next_pts of the audio stream with the total time set for video file,which is 5 seconds. By setting r = {60,1} I am converting those seconds by the time_base of the audio stream. At least that’s what I believe I am doing. With this hack, I am getting very small deviation from the correct movie length when using standard AAC files,that’s sample rate of 44100,stereo. But if I test with more problematic samples,like AAC sample rate 16000,mono - then the video file adds almost a whole second to its size.
    I will appreciate if someone can point out what I am doing wrong here.

    Important note : I don’t set duration on for any of the contexts. I control the termination of the muxing session, which is based on video frames count.The audio input stream has duration, of course, but it doesn’t help me as video duration is what defines the movie length.

    UPDATE :

    This is second bounty attempt.

    UPDATE 2 :

    Actually,my audio timestamp of den,num was wrong,while 1,1 is indeed the way to go,as explained by the answer. What was preventing it from working was a bug in this line (my bad) :

        mAudioOutStream.next_pts += a_pkt.pts;

    Which must be :

        mAudioOutStream.next_pts = a_pkt.pts;

    The bug resulted in exponential increment of pts,which caused very early reach to the end of stream (in terms of pts) and therefore caused the audio stream to be terminated much earlier than it supposed to be.