Recherche avancée

Médias (91)

Autres articles (77)

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

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

Sur d’autres sites (5384)

  • shell - looping command with several variables

    19 janvier 2017, par o_ren

    I’m running an FFmpeg command from a script which takes several arguments and passes them to the command.

    #!/bin/bash

    while getopts "i:b:" flag
    do
     case "$flag" in
       i) input="$OPTARG";;
       b) IFS=, read -a bitrate <<< "$OPTARG";;
     esac
    done

    for rate in "${bitrate[@]}";
     do
       ffmpeg -i $input -video_size 100x100 -b:v $bitrate -y output.mp4
     done

    exit

    I use getopts to take the variables and for loop to run the command.
    To run the script I use script.sh -i input.mov -b 1000,2000,3000 and FFmpeg runs 3 times, each with different $bitrate value.

    What if I want to pass another var - scale, to the command and run it like this :
    script.sh -b 1000,2000,3000 -s 100x100,200x200,300x300 so the first run would use -b 1000 and -s 100x100, second run use -b 2000 and -s 200x200 and so on.
    Is this posooble ? I would like to keep using getopts if possible.

  • ffmpeg run from shell runs properly, but does not when called from within .NET

    14 août 2018, par Bevin

    I’m attempting to use ffmpeg (compiled on Windows with Cygwin) in a C# program, by using the Process class to spawn an ffmpeg instance. However, I’ve hit a rather odd bug that doesn’t make much sense.

    When I run ffmpeg directly from a shell (be it Cygwin’s bash, PowerShell, cmd), ffmpeg can properly decode and reencode files without any issues :

    PS C:\audio> ffmpeg -i .\sound1.wav -acodec libvorbis -f ogg abc.ogg
    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr  8 2013 15:10:40 with gcc 4.5.3 (GCC)
     configuration: --disable-encoder=vorbis --enable-libvorbis
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
    [wav @ 0x800538a0] max_analyze_duration 5000000 reached at 5015510 microseconds
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from '.\sound1.wav':
     Metadata:
       encoder         : Lavf54.63.104
     Duration: 00:00:05.76, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Output #0, ogg, to 'abc.ogg':
     Metadata:
       encoder         : Lavf54.63.104
       Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp
    Stream mapping:
     Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
    Press [q] to stop, [?] for help
    size=      55kB time=00:00:05.74 bitrate=  78.5kbits/s
    video:0kB audio:51kB subtitle:0 global headers:4kB muxing overhead 0.817473%

    The file plays fine, and I can encode to WAV or any other format I like. However, when I call ffmpeg from C# with the following code :

    string tempfile = Path.GetTempFileName();
    FileStream tempfilestr = File.OpenWrite(tempfile);
    input.CopyTo(tempfilestr);

    ProcessStartInfo pstart = new ProcessStartInfo("ffmpeg", string.Format("-i \"{0}\" -v verbose -y -f wav -", tempfile));
    pstart.CreateNoWindow = true;
    pstart.ErrorDialog = false;
    pstart.RedirectStandardOutput = true;
    pstart.RedirectStandardError = true;
    pstart.UseShellExecute = false;


    Process proc = new Process();
    proc.StartInfo = pstart;
    proc.Start();
    StreamReader stdout = proc.StandardOutput;
    StreamReader stderr = proc.StandardError;

    outtempfilestr = File.OpenRead(outtempfile);
    MemoryStream output = new MemoryStream();

    stdout.BaseStream.CopyTo(output);

    try {
       proc.Kill();
    }
    catch(InvalidOperationException) { }
    catch(Win32Exception) { }

    File.Delete(tempfile);

    return output.ToArray();

    This randomly produces errors in the output :

    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr  8 2013 15:10:40 with gcc 4.5.3 (GCC)
     configuration: --disable-encoder=vorbis --enable-libvorbis
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
    [wav @ 0x80053860] parser not found for codec pcm_s16le, packets or times may be invalid.
       Last message repeated 1 times
    [wav @ 0x80053860] max_analyze_duration 5000000 reached at 5015510 microseconds
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from 'C:\Users\Bevin\AppData\Local\Temp\tmp1CCE.tmp':
     Duration: 00:00:05.20, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    [graph 0 input from stream 0:0 @ 0x8011f320] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
    Output #0, wav, to 'pipe:':
     Metadata:
       ISFT            : Lavf54.63.104
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
    Press [q] to stop, [?] for help
    Multiple frames in a packet from stream 0
    [pcm_s16le @ 0x8005c160] Invalid PCM packet, data has size 3 but at least a size of 4 was expected
    Error while decoding stream #0:0: Invalid data found when processing input
    No more output streams to write to, finishing.
    size=     896kB time=00:00:05.20 bitrate=1411.3kbits/s    
    video:0kB audio:896kB subtitle:0 global headers:0kB muxing overhead 0.008719%

    Note that these errors don’t always occur. Sometimes they happen for certain files, sometimes they don’t. I’ve tried various combinations of stream redirects and temp files, none of them work. I’ve also verified the integrity of the temp files, and it all checks out. I’ve even extracted the temp file before it was deleted, and decoded it in shell without a hitch.

    Any ideas ?

    Edit : I’ve tried running ffmpeg from a shell script that’s run through C#. It gives the same issues. Compiling ffmpeg via MinGW gives the same issue as well.

  • ffmpeg run from shell runs properly, but does not when called from within .NET

    2 juillet 2013, par Bevin

    I'm attempting to use ffmpeg (compiled on Windows with Cygwin) in a C# program, by using the Process class to spawn an ffmpeg instance. However, I've hit a rather odd bug that doesn't make much sense.

    When I run ffmpeg directly from a shell (be it Cygwin's bash, PowerShell, cmd), ffmpeg can properly decode and reencode files without any issues :

    PS C:\audio> ffmpeg -i .\sound1.wav -acodec libvorbis -f ogg abc.ogg
    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr  8 2013 15:10:40 with gcc 4.5.3 (GCC)
     configuration: --disable-encoder=vorbis --enable-libvorbis
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
    [wav @ 0x800538a0] max_analyze_duration 5000000 reached at 5015510 microseconds
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from '.\sound1.wav':
     Metadata:
       encoder         : Lavf54.63.104
     Duration: 00:00:05.76, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Output #0, ogg, to 'abc.ogg':
     Metadata:
       encoder         : Lavf54.63.104
       Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp
    Stream mapping:
     Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
    Press [q] to stop, [?] for help
    size=      55kB time=00:00:05.74 bitrate=  78.5kbits/s
    video:0kB audio:51kB subtitle:0 global headers:4kB muxing overhead 0.817473%

    The file plays fine, and I can encode to WAV or any other format I like. However, when I call ffmpeg from C# with the following code :

    string tempfile = Path.GetTempFileName();
    FileStream tempfilestr = File.OpenWrite(tempfile);
    input.CopyTo(tempfilestr);

    ProcessStartInfo pstart = new ProcessStartInfo("ffmpeg", string.Format("-i \"{0}\" -v verbose -y -f wav -", tempfile));
    pstart.CreateNoWindow = true;
    pstart.ErrorDialog = false;
    pstart.RedirectStandardOutput = true;
    pstart.RedirectStandardError = true;
    pstart.UseShellExecute = false;


    Process proc = new Process();
    proc.StartInfo = pstart;
    proc.Start();
    StreamReader stdout = proc.StandardOutput;
    StreamReader stderr = proc.StandardError;

    outtempfilestr = File.OpenRead(outtempfile);
    MemoryStream output = new MemoryStream();

    stdout.BaseStream.CopyTo(output);

    try {
       proc.Kill();
    }
    catch(InvalidOperationException) { }
    catch(Win32Exception) { }

    File.Delete(tempfile);

    return output.ToArray();

    This randomly produces errors in the output :

    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr  8 2013 15:10:40 with gcc 4.5.3 (GCC)
     configuration: --disable-encoder=vorbis --enable-libvorbis
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
    [wav @ 0x80053860] parser not found for codec pcm_s16le, packets or times may be invalid.
       Last message repeated 1 times
    [wav @ 0x80053860] max_analyze_duration 5000000 reached at 5015510 microseconds
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from 'C:\Users\Bevin\AppData\Local\Temp\tmp1CCE.tmp':
     Duration: 00:00:05.20, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    [graph 0 input from stream 0:0 @ 0x8011f320] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
    Output #0, wav, to 'pipe:':
     Metadata:
       ISFT            : Lavf54.63.104
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
    Press [q] to stop, [?] for help
    Multiple frames in a packet from stream 0
    [pcm_s16le @ 0x8005c160] Invalid PCM packet, data has size 3 but at least a size of 4 was expected
    Error while decoding stream #0:0: Invalid data found when processing input
    No more output streams to write to, finishing.
    size=     896kB time=00:00:05.20 bitrate=1411.3kbits/s    
    video:0kB audio:896kB subtitle:0 global headers:0kB muxing overhead 0.008719%

    Note that these errors don't always occur. Sometimes they happen for certain files, sometimes they don't. I've tried various combinations of stream redirects and temp files, none of them work. I've also verified the integrity of the temp files, and it all checks out. I've even extracted the temp file before it was deleted, and decoded it in shell without a hitch.

    Any ideas ?

    Edit : I've tried running ffmpeg from a shell script that's run through C#. It gives the same issues. Compiling ffmpeg via MinGW gives the same issue as well.