Recherche avancée

Médias (1)

Mot : - Tags -/remix

Autres articles (77)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

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

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

Sur d’autres sites (5918)

  • Choppy sound when using ffmpeg

    24 novembre 2011, par Kurt

    I suffered some choppy audio when i try to capture audio from a live stream.
    Another essential problem which could explain the problem is that the Wav file created is twice longer than the capture time.

    The audio is perfect when i play the avs input file with ffplay, so the avs is ok, the problem is after whether in the capture or in the Wav writing.

    To capture :

    av_read_frame(pFormatCtx, &packet)

    if(packet.stream_index == mAudioStream)
    {
       int buff_size = sizeof(mAudioBuffer);
       std::cout << "Buff_size " << buff_size << std::endl;
       len = avcodec_decode_audio3(pAudioCodecCtx,(int16_t*)mAudioBuffer, &buff_size,&packet);
       if(len < 0){
           qDebug("Extractor - Audio isEnd = -1;");
           mAudioBufferSize = 0;
           isEnd = ERROR_;
           return isEnd;
       }

       // Set packet result type
       mFrameType = AUDIO_PKT;
       mAudioBufferSize = buff_size;
       //store audio synchronization informations:
       if(packet.pts != AV_NOPTS_VALUE) {
            mAudioPts_ = av_q2d(pFormatCtx->streams[mAudioStream]->time_base);
            mAudioPts_ *= packet.pts;
       }
    }

           // store a copy of current audio frame in _frame
           _frame.audioFrame = new decoded_frame_t::audio_frame_t();
           _frame.audioFrame->sampleRate = mediaInfos.audioSampleRate;
           _frame.audioFrame->sampleSize = mediaInfos.audioSampleSize;
           _frame.audioFrame->nbChannels = mediaInfos.audioNbChannels;
           _frame.audioFrame->nbSamples = mAudioBufferSize / ((mediaInfos.audioSampleSize/8) * mediaInfos.audioNbChannels);
           _frame.audioFrame->buf.resize(mAudioBufferSize);
           memcpy(&_frame.audioFrame->buf[0],mAudioBuffer,mAudioBufferSize);

    Then i store in a Wav File using libsndfile :

    SNDFILE*            fd;
    SF_INFO             sfInf;

    sfInf.frames = 0;
    sfInf.channels = p_capt->ui_nbChannels;
    sfInf.samplerate = p_capt->ui_sampleRate;
    sfInf.format = SF_FORMAT_WAV | SF_FORMAT_PCM_U8;
    sfInf.sections = 0;
    sfInf.seekable = 0;

    if (sf_format_check(&sfInf) == FALSE)
       std::cout << "Format parameter are uncorrect ! Exit saving !" << std::endl;
    else
    {
       fd = sf_open(fileName.toStdString().c_str(), SFM_WRITE, &sfInf);
       if (fd == NULL)
       {
           std::cout << "Unable to open the file " << fileName.toStdString() << std::endl;
           return GRAB_ST_NOK;
       }

       //little trick because v_buf is a uint8_t vector
       sf_count_t l = sf_write_short(fd, (const short *)(&(p_capt->v_buf[0])), p_capt->v_buf.size()/2);

       if (l != p_capt->v_buf.size()/2)
       {
          std::cout << "sf_write didn't write the right amoung of bits " << l << " != " << p_capt->v_buf.size()/2 << std::endl;
          ret = GRAB_ST_NOK;
       }
       else
       {
           sf_write_sync(fd);
           sf_close(fd);
           ret = GRAB_ST_OK;
       }
    }

    I hope it's understandable. Waiting for remarks.

    Kurt

  • Using ffmpeg to chunk a long audio file

    3 novembre 2020, par Boris Adaev

    I have the following code here to split a long audio file (15 hours long) into shorter chunks (each a little over an hour long, except the last 16th one, which is whatever remains).

    


    import subprocess
import os, math

def get_length(input_video):
    result = subprocess.run(['ffprobe', '-v', 'error', '-show_entries', 'format=duration',
                             '-of', 'default=noprint_wrappers=1:nokey=1', input_video],
                             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    return float(result.stdout)

def chunk(fname, title, split_by=3600):
    head_dir = title + ' (split)'
    if head_dir not in os.listdir():
        os.mkdir(head_dir)

    dur_seconds = get_length(fname)
    iters = math.ceil(dur_seconds / split_by)

    left_off = 0

    print(dur_seconds)

    for i in range(1, iters+1):
        last_iter = i == iters
        if not last_iter:
            go_till = left_off + 3630
        else:
            go_till = int(dur_seconds)

        print(f'from {left_off} to {go_till} for {i:02d}.mp3')
        subprocess.call(['ffmpeg', '-i', fname, '-ss', str(left_off), '-to', str(go_till),
                         '-c', 'copy', f'{head_dir}/{i:02d}.mp3'])
        left_off += 3600

fname = 'Brian C. Muraresku - The Immortality Key The Secret History of the Religion with No Name.mp3'
title = 'The Immortality Key'

chunk(fname, title)


    


    The code makes perfect sense, and when I run it with the subprocess.call line commented out, what it prints also makes sense.

    


    54681.353625
from 0 to 3630 for 01.mp3
from 3600 to 7230 for 02.mp3
from 7200 to 10830 for 03.mp3
from 10800 to 14430 for 04.mp3
from 14400 to 18030 for 05.mp3
from 18000 to 21630 for 06.mp3
from 21600 to 25230 for 07.mp3
from 25200 to 28830 for 08.mp3
from 28800 to 32430 for 09.mp3
from 32400 to 36030 for 10.mp3
from 36000 to 39630 for 11.mp3
from 39600 to 43230 for 12.mp3
from 43200 to 46830 for 13.mp3
from 46800 to 50430 for 14.mp3
from 50400 to 54030 for 15.mp3
from 54000 to 54681 for 16.mp3


    


    But with the subprocess.call line, it creates these audios (01.mp3, 02.mp3, 03.mp3, etc.), but the timestamps are wrong. When the code is done running, they all start from the same place for some odd reason.

    


    UPDATE : I also tried placing the -i part after the -ss part, as well as the following

    


    subprocess.call(['ffmpeg', '-ss', str(left_off), '-i', fname, '-t', '3630',
                 '-c', 'copy',  f'{head_dir}/{i:02d}.mp3'])


    


    But still the same problem. 15 identical audios, of which only the 15th is the way it's supposed to be, and then the last 16th ten minute remainder. When I run them separately, it goes as follows :

    


    01.mp3 is right,

    


    02.mp3 is right but 01.mp3 is now wrong, because it's identical to 02.mp3

    


    03.mp3 is right, but the previous two are identical to it

    


    04.mp3 is right, but the previous three are identical to it

    


    ... and so on

    


  • Build ffmpeg binary for android

    26 juillet 2014, par Abdul Qadir

    I’ve gone through various tutorials on the Internet. I need to execute simple ffmpeg commands in my android application. I found the guardianproject’s android library perfect for it but I needed to enable libmp3lame in the configuration file and re-build the binary so i can work with mp3 files. But I couldn’t re-built it successfully. I got following errors :

    config.mk:25: builds/unix/unix-def.mk: No such file or directory
    config.mk:26: builds/unix/unix-cc.mk: No such file or directory
    make: *** No rule to make target builds/unix/unix-cc.mk.  Stop.
    Makefile:2: config.mak: No such file or directory
    Makefile:47: /common.mak: No such file or directory
    Makefile:88: /libavutil/Makefile: No such file or directory
    Makefile:88: /library.mak: No such file or directory
    Makefile:168: /doc/Makefile: No such file or directory
    Makefile:169: /tests/Makefile: No such file or directory
    make: *** No rule to make target /tests/Makefile.  Stop.
    Makefile:2: config.mak: No such file or directory
    Makefile:47: /common.mak: No such file or directory
    Makefile:88: /libavutil/Makefile: No such file or directory
    Makefile:88: /library.mak: No such file or directory
    Makefile:168: /doc/Makefile: No such file or directory
    Makefile:169: /tests/Makefile: No such file or directory
    make: *** No rule to make target /tests/Makefile.  Stop.
    ./configure_sox.sh: line 12: autoreconf: command not found
    ./configure_sox.sh: line 15: ./configure: No such file or directory
    make: *** No targets specified and no makefile found.  Stop.
    make: *** No rule to make target 'install-strip'.  Stop.

    I also tried this tutorial to build a binary but failed. The errors I encounter are following :

    /home/aq/Downloads/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld: ,noexecstack: unknown -z option
    /home/aq/Downloads/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld: use the --help option for usage information

    I was successful in building various .so files through this tutorial though :

    But i don’t know how to use those .so files. I guess these are the libraries. Is there any way I can execute ffmpeg commands through these .so files ? Any help would be appreciated !!