Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (51)

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

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

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (7210)

  • 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
  • No such file or directory Error with FFMPEG + CarrierWave screenshot method

    10 juillet 2013, par dodgerogers747

    I am using AWS CORS to upload videos to my site, all of which works as planned.

    I have the following model method which runs as an after_create callback (for speed) to take a screenshot from the video file on AWS. I plan to move this out into a delayed job but I don't think this will solve this particular issue. Please advise if mistaken.

    I use FFMPEG to take a screenshot from the AWS self.file location, I then send the file to CarrierWave by saving the file to self.screenshot where it is uploaded to AWS.

    Approx. 50% of the time it errors out with Errno::ENOENT - No such file or directory for the location of the screenshot image.

    How can I rectify my code to remove this error and how come it only occurs around 50% of the time ? If anyone needs more code just shout.

    video.rb

    after_create :take_screenshot

    mount_uploader :screenshot, ImageUploader

     def take_screenshot
       location = "#{Rails.root}/public/uploads/tmp/screenshots/#{unique}_#{File.basename(file)}.jpg"
       system `ffmpeg #{log_level} -i #{self.file} -ss 00:00:0#{time_frame} -vframes 1 #{location}`
       logger.debug "Trying to take screenshot from #{self.file}"
       #pass the actual file to CarrierWave to handle the image upload
       self.screenshot = File.open(location)
       self.save
       logger.debug "Deleting tmp file: #{location}: #{File.delete(location)}" if self.screenshot.present?
     end

    def unique
       (0..6).map{(65+rand(26)).chr}.join
     end

    def log_level
       "-loglevel panic"
     end

     def time_frame
       rand(0..3)
     end

    Stack trace :

    Started POST "/videos" for 127.0.0.1 at 2013-07-10 03:58:49 +0800
    Processing by VideosController#create as JS
     Parameters: {"utf8"=>"✓", "authenticity_token"=>"6M1Ia+Ag2E3HVKH2PO/p7jewxSpMPdWeVHGA933Bzjw=", "video"=>{"file"=>"http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v"}}
     User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 9 LIMIT 1
      (0.1ms)  BEGIN
     SQL (0.2ms)  INSERT INTO `videos` (`created_at`, `file`, `question_id`, `screenshot`, `updated_at`, `user_id`) VALUES (&#39;2013-07-09 19:58:49&#39;, &#39;http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v&#39;, NULL, NULL, &#39;2013-07-09 19:58:49&#39;, 9)
    Trying to take screenshot from http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v
      (0.8ms)  ROLLBACK
    Completed 500 Internal Server Error in 3550ms

    Errno::ENOENT - No such file or directory - /Users/me/rails/project/public/uploads/tmp/screenshots/WCACLIC_Good_7iron.m4v.jpg:
     app/models/video.rb:24:in `initialize&#39;
     app/models/video.rb:24:in `open&#39;
     app/models/video.rb:24:in `take_screenshot&#39;
  • '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
    }