Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (35)

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

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

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (5550)

  • Filtering string for hidden character when read from file in bash [duplicate]

    19 mai 2021, par BharathYes

    I am writing a bash script to trim video file into small pieces and finally merge them into a single video file using ffmpeg based on specified time.

    


    #!/bin/bash

filename="$1"
linecount=`wc -l "${filename}.txt"`
echo -n "" > to-merge.list

# file split by time
count=0
IFS=''
while read -r fromTime ; read -r toTime; do
    echo "$fromTime and $toTime done"
    ffmpeg -i "${filename}.mp4" -ss $fromTime -to $toTime -c copy "${filename}_pt_${count}.mp4"
    echo "file '${filename}_pt_${count}.mp4'" >> to-merge.list
    count=$((count+1))
done < "${filename}.txt"

# file merge
`ffmpeg -f concat -safe 0 -i to-merge.list -c copy "${filename}-trimmed.mp4"`


    


    The input file contains time (odd lines are taken as start time and even as the end time). A file I use is :

    


    00:00:00
00:39:34
00:39:38
01:23:14
01:23:16
02:03:45
02:03:48
02:43:43


    



    


    problem faced

    


    The echo in while loop prints this : done02:03:45

    


    The overwriting makes me think the time stored in the variables must contain a special character at the end that makes it invalid in ffmpeg.
ffmpeg throws this error : Invalid duration specification for ss: 01:23:16

    


    Is there a way to cleanup the time variable ?

    


    I have tried to find what is causing this issue or how to get rid of it but drawing a blank.

    



    


    what I have tried so far

    


    use grep -Eo '[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}' to find time. While this works on the shell I am unable to use it in the script.

    


    Tried splitting time by : into hour, min and sec and saving them into an array to then merge them back but this makes it unnecessarily complicated and error prone.

    


    PS :
Is while read to be preferred for reading multiple lines like here or should tools like sed be used for best practice ? Such as sed '2,4 !d' /tmp/test.txt ?

    


  • Adding album cover art to FLAC audio files using `ffmpeg`

    27 décembre 2022, par user5395338

    I have ripped files from an audio CD I just bought. I ripped using the Music app on my Macbook Pro, Catalina 10.15.6 - output format was .wav as there was no option for FLAC. My plan was to change format using ffmpeg :

    


    % ffmpeg -v
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers


    


    Except for the "album cover artwork" addition, the .wav-to-.flac conversion implemented in the short bash script below seems to have worked as expected :

    


    #!/bin/bash
for file in *.wav
do
echo $file 
ffmpeg -loglevel quiet -i "$file" -ar 48000 -c:a flac -disposition:v AnotherLand.png -vsync 0 -c:v png "${file/%.wav/.flac}"
done


    


    A script very similar to this one worked some time ago on a series of FLAC-to-FLAC conversions I had to do to reduce the bit depth. However, in that case, the original FLAC files already had the artwork embedded. Since this script produced usable audio files, I decided that I would try adding the artwork with a second ffmpeg command.

    


    I did some research, which informed me that there have been issues with ffmpeg (1, 2, 3, 4) on adding album artwork to FLAC files.

    


    I have tried several commands given in the references above, but still have not found a way to add album artwork to my FLAC files. The following command was a highly upvoted answer, which I felt would work, but didn't :

    


    % ffmpeg -i "01 Grave Walker.flac" -i ./AnotherLand.png -map 0:0 -map 1:0 -codec copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" output.flac

...


Input #0, flac, from '01 Grave Walker.flac':
  Metadata:
    encoder         : Lavf58.76.100
  Duration: 00:06:59.93, start: 0.000000, bitrate: 746 kb/s
  Stream #0:0: Audio: flac, 48000 Hz, stereo, s16
Input #1, png_pipe, from './AnotherLand.png':
  Duration: N/A, bitrate: N/A
  Stream #1:0: Video: png, rgba(pc), 522x522, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'output.flac' already exists. Overwrite? [y/N] y
[flac @ 0x7fb4d701e800] Video stream #1 is not an attached picture. Ignoring
Output #0, flac, to 'output.flac':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Audio: flac, 48000 Hz, stereo, s16
  Stream #0:1: Video: png, rgba(pc), 522x522, q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      title           : Album cover
      comment         : Cover (front)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)

...



    


    I don't understand the error message : Video stream #1 is not an attached picture. It seems to imply that that the artwork is "attached" (embedded ???) in the input file, but as I've specified the artwork is a separate file, this makes no sense to me.

    


  • How to solve Accord.Video.FFMPEG memory leak problem

    26 mai 2021, par mfwoo

    I am developing a digital billboard application that allow customer to click on the touch screen to go back and forth.

    


    Screen 0 -> touch -> Screen 1 -> touch -> Screen 2 -> time out -> Screen 0

    


    If no interaction happens Screen 0 will loop indefinitely. Every Screen is running its own MP4 file.

    


    However, for every running cycle of Screen 1, it gobbled up memory and in no time the application crash.

    


    Is it because of VideoFileSource's video object is not being dispose properly or because of some threading problem in video_NewFrame ?

    


    Because I get this error occasionally - "Invoke or BeginInvoke cannot be called on a control until the windows handle is created"

    


    I am using VS2017 .NET Framework 4.5 with Accord.Video.FFMPEG by Accord.NET version 3.8

    


    Screen 0 MP4 size - 5.5MB
Screen 1 MP4 size - 5.6MB
Screen 2 MP4 size - 7.0MB

    


    Here is my code :-
...

    


    Bitmap image;
VideoFileSource video;
int screenIdx = 0;
bool enableClicking = true;
bool isTimeOut = false;
string VideoPath = @"d:\KioskApp\Bkgrnd\"

public frmMain()
    {
        InitializeComponent(); 
        StartFirstScreen();
        tmrScreen01.Interval = 10000;
        tmrScreen02.Interval = 10000;
    }
    
     private void StartFirstScreen()
    {
        try
        {
            string fileName = VideoPath + Screen00();
            video = new VideoFileSource(fileName);
            video.PlayingFinished += new Accord.Video.PlayingFinishedEventHandler(video_Finished);
            video.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
            video.Start();
            screenIdx = 1;
        }
        catch (Exception ex)
        {
            string strErrMsg = strMsg + " - " + ex.Message;
            MessageBox.Show(strErrMsg);
        }
    }
    
    private void video_NewFrame(object sender, Accord.Video.NewFrameEventArgs eventArgs)
    {
        try
        {
            Invoke(new Action(() =>
            {
                System.Drawing.Image OldImage;
                OldImage = pictureBox1.Image;
                pictureBox1.Image = AForge.Imaging.Image.Clone(eventArgs.Frame);
                if (OldImage != null)
                    OldImage.Dispose();
            }));    
        }
        catch (Exception ex)
        {
            var strErrMsg = "video_NewFrame - " + ex.Message;
            MessageBox.Show(strErrMsg);
        }
    }
    
     private void video_Finished(object sender, Accord.Video.ReasonToFinishPlaying reason)
    {
        try
        {
            if (screenIdx == 1)
            {
                video.PlayingFinished -= video_Finished;
                video.NewFrame -= video_NewFrame;
                video = null;                    
                StartFirstScreen();
                return;
            }
            enableClicking = true;

        }
        catch (Exception ex)
        {
            var strErrMsg = "video_Finished - " + ex.Message;
            MessageBox.Show(strErrMsg);

        }
    }
    
    void startLastScreen()
    {
        string fileName = string.Empty;
        video.SignalToStop();
        fileName = VideoPath + Screen02();
        screenIdx = 0;
        if (object.ReferenceEquals(null, video))
        {
            video = new VideoFileSource(fileName);
        }
        else
        {
            video = null;
            video = new VideoFileSource(fileName);
        }

        video.PlayingFinished += new Accord.Video.PlayingFinishedEventHandler(video_Finished);
        video.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
        video.Start();
        enableClicking = false;
    }
    
    private void pictureBox1_Click(object sender, EventArgs e)
    {
        if (!enableClicking && screenIdx != 1) return;

        tmrScreen01.Stop();
        tmrScreen02.Stop();
        
        //  Check clickable area before allow to proceed to the next screen     
        string fileName = string.Empty;
        video.SignalToStop();
        video.Stop();

        if (screenIdx == 0)
        {
            fileName = VideoPath + Screen00();
            screenIdx = 1;
        }
        else if (screenIdx == 1)
        {
            fileName = VideoPath + Screen01();
            screenIdx = 2;
            
        }
        else if (screenIdx == 2)
        {
            fileName = VideoPath + Screen02();
            screenIdx = 0;
           
        }

        if (object.ReferenceEquals(null, video))
        {
            video = new VideoFileSource(fileName);
        }
        else
        {
            video = null;
            video = new VideoFileSource(fileName);
        }
        video.PlayingFinished += new Accord.Video.PlayingFinishedEventHandler(video_Finished);
        video.NewFrame += new Accord.Video.NewFrameEventHandler(video_NewFrame);
        enableClicking = false;
        isTimeOut = false;
        video.Start();
    }


    


    ...