Recherche avancée

Médias (1)

Mot : - Tags -/stallman

Autres articles (65)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque 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 (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (5624)

  • ffmpeg audio decoding providing half the data from original audio in C++

    3 mai 2016, par hockeyislife

    I am trying to write a simple program in C++ that captures audio from a microphone on the computer and encodes it into mp2. Which I was successful in doing, I verified this by saving a mp2 audio file and playing it back in VLC.

    I then decided to see if I could take the encoded audio packets from ffmpeg and convert them back to raw PCM format, and this is where I am having trouble.

    So below is my decoder settings :

    AVCodecID audio_codec_id = AV_CODEC_ID_MP2;
    AVCodec * audio_decodec = avcodec_find_decoder(audio_codec_id);
    if (!audio_decodec)
    {
       return -1;
    }
    audio_decodec_ctx = avcodec_alloc_context3(audio_decodec);
    audio_decodec_ctx->bit_rate = 64000;
    audio_decodec_ctx->channels = 2;
    audio_decodec_ctx->channel_layout = AV_CH_LAYOUT_STEREO;
    audio_decodec_ctx->sample_rate = 44100;
    audio_decodec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;

    int retval;
    if ((retval = avcodec_open2(audio_decodec_ctx, audio_decodec, NULL)) < 0)
    {
       return -1;
    }

    Here is my encoder settings, which I made identical :

    AVCodecID audio_codec_id = AV_CODEC_ID_MP2;
    AVCodec* audio_codec = avcodec_find_encoder(audio_codec_id);
    if (!audio_codec)
    {
       return -1;
    }

    // Initialize codec.
    AVCodecContext* audio_codec_ctx = avcodec_alloc_context3(audio_codec);
    audio_codec_ctx->bit_rate = 64000;
    audio_codec_ctx->channels = 2;
    audio_codec_ctx->channel_layout = AV_CH_LAYOUT_STEREO;
    audio_codec_ctx->sample_rate = 44100;
    audio_codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;

    int audio_retval;
    if ((audio_retval = avcodec_open2(audio_codec_ctx, audio_codec, NULL)) < 0)
    {
       return -1;
    }

    As stated previously, the encoding of the audio signal works perfectly, when I try to take the packets that are encoded and attempt to convert them back I am getting only half the data.

    avcodec_encode_audio2(audio_codec_ctx, &audio_pkt, pOutAudioFrame, &got_output);

    if (got_output)
    {
       fwrite(audio_pkt.data, 1, audio_pkt.size, f); // MP2 file write which, sounds very nice, which leads me to believe encoding is being done correctly
       AVFrame * audio_frame_decode = av_frame_alloc();
       avcodec_get_frame_defaults(audio_frame_decode);
       int frame_finished = 0;

       avcodec_decode_audio4(audio_decodec_ctx, audio_frame_decode, &frame_finished, &audio_pkt );
       if (frame_finished)
       {
           decoded_size += audio_frame_decode->linesize[0];  // only getting 2304 bytes
           av_free_packet(&audio_pkt);
       }
    }  

    The amount of PCM data being taken is 4608 but after decoding the encoder version I am getting only 2304 bytes. Seems like I have something incorrect but I can’t put my finger on it. Any help would be greatly appreciated.

    Thanks in advance.

  • How do I fix the "PES packet size mismatch" error in FFmpeg ?

    8 février 2021, par Ed999

    How to fix the error PES packet size mismatch in FFmpeg -

    



    I'm going to answer my own question, because the phrase PES packet size mismatch comes up regularly in posts relating to ffmpeg, but I've nowhere seen a satisfactory solution to it.

    



    It usually figures in a problem involving .TS transport stream files : either in relation to concatenating such files, or relating to re-muxing them (from .ts to .mp4). Somewhere in the output from ffmpeg, the deadly phrase packet size mismatch will suddenly start repeating.

    



    A solution is to concatenate them as .ts files (i.e. in their original format), then take the output .ts file, split it into a video file (.ts) and an audio file (.ts), then remux them (to either .ts or .mp4) using the "itsoffset" option. Even if stream copy is used, outputting to .mp4 will often give worse picture quality than retaining the .ts format.

    



    The following code does that, outputting either .mp4 video or .ts video (copy the code into a simple .bat batch file, then run that file) -

    



    .

    



    :: Program Location
SET ffmpeg="C:\Program Files\FFmpeg\ffmpeg.exe" -hide_banner  


::  STEP 1 -

::  Create File List
IF EXIST mylist.txt DEL mylist.txt
FOR %%i IN (*.ts) DO ECHO file '%%i'>> mylist.txt

::  Concatenate Files : TS
%ffmpeg%  -f concat  -safe 0  -i mylist.txt  -c copy  -threads 1  out.ts


::  STEP 2 -

::  Extract Video stream
%ffmpeg%  -i out.ts  -vcodec copy  -an  -sn  -threads 1  video.ts

::  Extract Audio stream
%ffmpeg%  -i out.ts  -acodec copy  -vn  -sn  -threads 1  audio.ts


::  STEP 3 -

::  Combine Video and Audio streams (with .MP4 options)
SET mapping=-i video.ts -itsoffset -0  -i audio.ts   -map 0:v -map 1:a
SET options=-flags global_header  -movflags faststart  -threads 1
%ffmpeg%  %mapping%  -c:v copy -c:a copy  %options%  output.mp4

::  Combine Video and Audio streams (with .TS options)
SET mapping=-i video.ts -itsoffset -0  -i audio.ts  -map 0:v -map 1:a
SET options=-threads 1
%ffmpeg%  %mapping%  -c:v copy -c:a copy  %options%  output.ts


    



    .

    



    Addendum :

    



    There seems to be some dispute about my suggested solution, as detailed in the Comments below. It seems to be being said that my solution is ignoring the fact that data is missing in the source files.

    



    I think the least I can do is admit that since ffmpeg is reporting an error in the source files, with its 'packet size mismatch' warning, the objection raised in the Comments might be valid.

    



    However, even if data is missing, my suggested routine will at least give you a file which will play in most media players. In many cases, there will not even be an audible or visual fault at the join point specified in the reported error.

    



    It's difficult to see how the missing data might be restored, but do please chip in with suggestions. There must be scope for improving my script, because so little attention has been paid to this type of fault previously.

    



    Happily, it seems that this type of error will NOT cause the sound to lose synchronisation with the picture. So the audio after the join-point will not go out-of-sync, even if some data is missing at the join.

    


  • FFMPEG and HTTPS

    14 juin 2012, par Joel

    ffmpeg lists http as a protocol when I ask : ffmpeg -protocols

    Does this also mean support for a https url ? Do I need to encode this url somehow for the command line. I get "No such file or directory", but with http urls (at least some) it does work.

    A url (created for a Amazon S3 bucket) similar to this one does not seem to work :
    https://mycompany-video-test.s3.amazonaws.com/client/btr/video/xyz0011-x403-snap-n-go-ex/1/video/baby-laugh-ripping-paper.mp4?AWSAccessKeyId=AVIAZL9J6SIRPAA&Expires=1323709667&Signature=pTvS9F2do2t8%3D

    I suspect the format of the url is problematic, I've also tried enclosing in quotes... Yes, this URL does not currently work as it has expired, but even while its valid, its a problem.

    In short :
    1) Should https work ?
    2) Do I need to format the url somehow ?