Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (101)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Prérequis à l’installation

    31 janvier 2010, par

    Préambule
    Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
    Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
    Il (...)

Sur d’autres sites (8047)

  • file : Add an option for following a file that is being written

    5 février 2015, par Martin Storsjö
    file : Add an option for following a file that is being written
    

    Using this requires setting the rw_timeout option to make it
    terminate, alternatively using the interrupt callback (if used via
    the API).

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DBH] doc/protocols.texi
    • [DBH] libavformat/file.c
    • [DBH] libavformat/version.h
  • 'C' program to pipeout audio file to FFMPEG and generate Video file

    9 mai 2017, par soflow

    I am attempting to write a short ’C’ program which reads in an Audio file using FFMPEG, processes that file using a ’C’ program, and then outputs a file via FFMEPG, which combines the new, modified audio together with a Video representation using the FFMPEG showwaves filter.

    At present the program attempts to do the following :-

    i) Read in an audio file, using pipein thorugh FFMPEG
    ii) Process the audio file using a portion of the ’C’ program
    iii) Pipeout the modified audio to FFMPEG, and generate a file using the ’showwaves’ filter in FFMEPG to create an MP4 file with audio and video.

    The following code run form the ommand line in FFMPEG generates the Audio/Video MP4 I want to create :-

    ffmpeg -y -f s16le -ar 44100 -ac 1 -i 12345678.wav  -i 12345678.wav  -filter_complex  "[0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]" -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  12345678.mp4

    "

    This code generates a processed audio file, and outputs it to a .wav file as required :-

    #include
    #include
    #include

    void main()
    {
    // Launch two instances of FFmpeg, one to read the original WAV
    // file and another to write the modified WAV file. In each case,
    // data passes between this program and FFmpeg through a pipe.
    FILE *pipein;
    FILE *pipeout;
    pipein  = popen("ffmpeg -i 12345678.wav -f s16le -ac 1 -", "r");
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i - out.wav", "w");

    // Read, modify and write one sample at a time
    int16_t sample;
    int count, n=0;
    while(1)
    {
       count = fread(&amp;sample, 2, 1, pipein); // read one 2-byte sample
       if (count != 1) break;
       ++n;
       sample = sample * sin(n * 5.0 * 2*M_PI / 44100.0);
       fwrite(&amp;sample, 2, 1, pipeout);
    }

    // Close input and output pipes
    pclose(pipein);    
    pclose(pipeout);
    }

    (This code borrowed from ted Burke’s excellent post here)

    I have made an attempt as shown below, but this is not working :-

    #include
    #include
    #include

    void main()
    {
    // Launch two instances of FFmpeg, one to read the original WAV
    // file and another to write the modified WAV file. In each case,
    // data passes between this program and FFmpeg through a pipe.
    FILE *pipein;
    FILE *pipeout;
    pipein  = popen("ffmpeg -i 12345678.wav -f s16le -ac 1 -", "r");
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i 12345678.wav  -i
    12345678.wav  -filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4
    ", "w");


    // Read, modify and write one sample at a time
    int16_t sample;
    int count, n=0;
    while(1)
    {
       count = fread(&amp;sample, 2, 1, pipein); // read one 2-byte sample
       if (count != 1) break;
       ++n;
       sample = sample * sin(n * 5.0 * 2*M_PI / 44100.0);
       fwrite(&amp;sample, 2, 1, pipeout);
    }

    // Close input and output pipes
    pclose(pipein);    
    pclose(pipeout);
    }    

    Ideally someone can suggest an improved version of the pipeout command above - alternately another process to achieve this would be interesting

    * EDIT *

    Thanks to @Mulvya, the revised pipeout line is now :-

    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -filter_complex  "[0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]" -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  12345678.mp4

    ", "w") ;

    On compiling with gcc I get the following error messages :-

    avtovid2.c: In function \u2018main\u2019:

    wavtovid2.c:13:83: error: expected \u2018]\u2019 before \u2018:\u2019
    token
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4

    ^
    wavtovid2.c:13:86: error: expected \u2018)\u2019 before
    \u2018showwaves\u2019
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4

    ^
    wavtovid2.c:13:98: error: invalid suffix "x720" on integer constant
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4

    ^
    wavtovid2.c:13:153: warning: missing terminating " character
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4

    ^
    wavtovid2.c:13:86: error: missing terminating " character
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4

    ^
    wavtovid2.c:14:6: warning: missing terminating " character
    ", "w");
     ^
    wavtovid2.c:14:1: error: missing terminating " character
    ", "w");
    ^
    wavtovid2.c:13:21: warning: passing argument 1 of \u2018popen\u2019 makes
    pointer from integer without a cast
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4
                    ^
    In file included from wavtovid2.c:1:0:
    /usr/include/stdio.h:872:14: note: expected \u2018const char *\u2019 but
    argument is of type \u2018char\u2019
    extern FILE *popen (const char *__command, const char *__modes) __wur;
             ^
    wavtovid2.c:13:15: error: too few arguments to function \u2018popen\u2019
    pipeout = popen("ffmpeg -y -f s16le -ar 44100 -ac 1 -i -  -
    filter_complex  "
    [0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]"
    -map 1:a:0 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -
    codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart  
    12345678.mp4
              ^
    In file included from wavtovid2.c:1:0:
    /usr/include/stdio.h:872:14: note: declared here
    extern FILE *popen (const char *__command, const char *__modes) __wur;
             ^
    wavtovid2.c:32:1: error: expected \u2018;\u2019 before \u2018}\u2019
    token
    }
  • Speech recognition with python-telegram-bot without downloading an audio file

    25 juin 2022, par linz

    I'm developing a telegram bot in which the user sends a voice message, the bot transcribes it and sends back what was said in text.&#xA;For that I am using the python-telegram-bot library and the speech_recognition library with the google engine.&#xA;My problem is, the voice messages sent by the users are .mp3, however in order to transcribe them i need to convert them to .wav. In order to do that I have to download the file sent to the bot.&#xA;Is there a way to avoid that ? I understand this is not an efficient and a safe way to do this since many active users at once will result in race conditions and takes a lot of space.

    &#xA;

    &#xA;def voice_handler(update, context):&#xA;    bot = context.bot&#xA;    file = bot.getFile(update.message.voice.file_id)&#xA;    file.download(&#x27;voice.mp3&#x27;)&#xA;    filename = "voice.wav"&#xA;    &#xA;    # convert mp3 to wav file&#xA;    subprocess.call([&#x27;ffmpeg&#x27;, &#x27;-i&#x27;, &#x27;voice.mp3&#x27;,&#xA;                         &#x27;voice.wav&#x27;, &#x27;-y&#x27;])&#xA;&#xA;    # initialize the recognizer&#xA;    r = sr.Recognizer()&#xA;    &#xA;    # open the file&#xA;    with sr.AudioFile(filename) as source:&#xA;    &#xA;        # listen for the data (load audio to memory)&#xA;        audio_data = r.record(source)&#xA;        # recognize (convert from speech to text)&#xA;        text = r.recognize_google(audio_data, language=&#x27;ar-AR&#x27;)&#xA;        &#xA;        &#xA;def main() -> None:&#xA;    updater.dispatcher.add_handler(MessageHandler(Filters.voice, voice_handler)) &#xA;&#xA;

    &#xA;