Recherche avancée

Médias (91)

Autres articles (65)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (12733)

  • Read/write to stream with JavaCV

    4 juillet 2013, par Zielony

    I'm trying to make use of JavaCV for android. I would like to create a video stream composed of screenshots. I found out that I can write a file using FFmpegFrameRecorder, but I can't write to a stream, array, buffer, or anything else, other than a file.

    Next thing is that I found a piece of code featuring custom FrameRecorder using 'avio_alloc_context' and read/write/seek callbacks. Unfortunately it's only a snippet and it's in C++. 'avio_alloc_context' method on android takes Read_packet, Read_packet and Seek callbacks, so I cannot pass a Write_packet callback. Moreover, right after 'avio_alloc_context' call, I get 'finalize' called on all objects passed to 'avio_alloc_context'.

    final VideoOutputStream videoOutputStream = new VideoOutputStream(stream);

    Read_packet read_packet = new Read_packet() {
       @Override
       public int call(Pointer arg0, BytePointer arg1, int arg2) {
           VideoOutputStream videoStream = (VideoOutputStream) arg0;
           try {
               videoStream.write(arg1.getStringBytes());
           } catch (IOException e) {
               e.printStackTrace();
           }
           return arg2;
       }
    };

    AVIOContext pb = avio_alloc_context(new MBytePointer(av_malloc(video_outbuf_size)), video_outbuf_size, 1,videoOutputStream, null, read_packet, null);

    oc.pb(pb);

    Using the above code nothing crashes nor reports errors. I just keep getting empty files.

    My question is - does anyone of you guys managed to get it working ? Do you know a correct way to initialize custom reading/writing in FrameRecorder/Grabber in JavaCV ?

  • Noobs approach to automate x264 cmd

    16 novembre 2012, par nightcrawler

    so here is my script to loop through specific video extensions » add a manual profile » generate necessary *.bat & finally a final 'loader' batch file to execute previous *.bat files sequentially & necessary logging (this gives quiet a deal of freedom if you so want)

    ::==
    :: gets lines into vars c1 v2 v...
    @echo off
    :: user input required
    cd /d "d:\Trainers\out\"
    setLocal EnableDelayedExpansion
    dir /B /O:N | findstr ".wmv$ " >filename.txt
    echo. >log.txt
    :: user input required
    for /f "tokens=* delims= " %%a in ('type filename.txt ^|findstr ".wmv$"') do (
    set /a n+=1
    echo. >file!n!.bat
    set in=%in%%%a
    :: user input required
    set out=!in:.wmv=.mp4!
    :: user input required
    set v=x264 --crf 23  --level 3.1 --tune film -o "d:\Trainers\out\!in!" "d:\Trainers\out\!out!"
    echo. !v!>file!n!.bat
    )
    dir /B /O:N | findstr ".bat$ " >x264_home.txt
    for /f "tokens=* delims= " %%a in (x264_home.txt) do (
    set /a n+=1
    :: mtee is an external library Google it
    set "z=call %%a | mtee /d/c/t/+ log.txt"
    echo. !z! >> x264_home.bat
    )
    echo. @echo off > newFile.bat
    type x264_home.bat >> newFile.bat
    type newFile.bat > x264_home.bat
    del newFile.bat,x264_home.txt,filename.txt
    echo. pause >> x264_home.bat
    echo. @echo All Operation done... >> x264_home.bat
    :: user input required
    move "d:\Trainers\out\*.bat" "d:\Program Files\x264_auto\test\"
    :: user input required
    move "d:\Trainers\out\log.txt" "d:\Program Files\x264_auto\test\"
    ::==

    Now the above code which is fairly easy to understand (bcz its written by a noob) run perfectly & create necessary files. For instance one of the file1.bat looks like this :

    x264 --crf 23  --level 3.1 --tune film --preset veryslow --deblock -2:-1 --zones 24233,25324,q=20 --acodec aac --abitrate 80 -o "d:\Trainers\out\1.wmv" "d:\Trainers\out\1.mp4"

    ...& the loader .bat file looks like

    @echo off
    call file1.bat | mtee /d/c/t/+ log.txt
    call file2.bat | mtee /d/c/t/+ log.txt
    call file3.bat | mtee /d/c/t/+ log.txt
    @echo All Operation done...

    You see this is a quiet flexible approach in that you can use special filestr » set another loop » set another profile. Furthermore every batch file can be latter edited especiialy when you heavily use --zone x264 feature
    I am successful because there is no error in any output ...but its the x264.exe (provider/compiler x264GUI) throws error which it otherwise don't ?

    d:\Program Files\x264_auto\test>x264 --crf 23  --level 3.1 --tune film --preset
    veryslow --deblock -2:-1 --zones 24233,25324,q=20 --acodec aac --abitrate 80 -o
    "d:\Trainers\out\1.wmv" "d:\Trainers\out\1.mp4"
    ffms [error]: could not create index
    lavf [error]: could not open input file
    raw [error]: raw input requires a resolution.
    x264 [error]: could not open input file `d:\Trainers\out\1.mp4' via any method!

    its the x264 thats the culprit perhaps a senior guide is required here

  • Parsing xml with perl and libXML

    2 mai 2014, par user3589690

    I have an XML file which I would like to parse and use to create an arguments set for ffmpeg encoding.

    This is what a dump of the xml looks like :

    $VAR1 = {
             'profile' => [
                          {
                            'enodingParam' => {
                                              'videoFrameRate' => {
                                                                  'arg' => '-r',
                                                                  'content' => '25'
                                                                },

                                              'audioCodec' => {
                                                              'arg' => '-acodec',
                                                              'content' => 'libfaac'
                                                            },
                                              'videoCodec' => {
                                                              'arg' => '-vcodec',
                                                              'content' => 'libx264'
                                                            },
                                              'videoSize' => {
                                                             'arg' => '-s',
                                                             'content' => '640x360'
                                                           },
                                              'audioBitrate' => {
                                                                'arg' => '-ab',
                                                                'content' => '96k'
                                                              },

                                              'videoGOP' => {
                                                            'arg' => '-g',
                                                            'content' => '90'
                                                          },
                                              'audioRate' => {
                                                             'arg' => '-ar',
                                                             'content' => '22050'
                                                           },
                                              'audioChannels' => {
                                                                 'arg' => '-ac',
                                                                 'content' => '2'
                                                               },
                                              'videoPreset' => {
                                                               'arg' => '-vpre',
                                                               'content' => 'slow'
                                                             },
                                              'videoBitrate' => {
                                                                'arg' => '-b',
                                                                'content' => '1200k'
                                                              }
                                            },
                            'metadat' => {
                                        'fileContainer' => '.mp4',
                                        'profileName' => 'testpfrof1'
                                      }
                          },
                          {
                            'enodingParam' => {
                                              'videoFrameRate' => {
                                                                  'arg' => '-r',
                                                                  'content' => '25'
                                                                },

                                              'audioCodec' => {
                                                              'arg' => '-acodec',
                                                              'content' => 'libfaac'
                                                            },
                                              'videoCodec' => {
                                                              'arg' => '-vcodec',
                                                              'content' => 'libx264'
                                                            },
                                              'videoSize' => {
                                                             'arg' => '-s',
                                                             'content' => '320x180'
                                                           },
                                              'audioBitrate' => {
                                                                'arg' => '-ab',
                                                                'content' => '96k'
                                                              },

                                                             },
                                              'videoGOP' => {
                                                            'arg' => '-g',
                                                            'content' => '90'
                                                          },
                                              'audioRate' => {
                                                             'arg' => '-ar',
                                                             'content' => '22050'
                                                           },
                                              'audioChannels' => {
                                                                 'arg' => '-ac',
                                                                 'content' => '2'
                                                               },
                                              'videoPreset' => {
                                                               'arg' => '-vpre',
                                                               'content' => 'slow'
                                                             },
                                              'videoBitrate' => {
                                                                'arg' => '-b',
                                                                'content' => '400k'
                                                              }
                                            },
                            'metadat' => {
                                        'fileContainer' => '.mp4',
                                        'profileName' => 'testProfile2'
                                      }
                          }
                        ]
           };

    I would like to use a foreach loop for the encodingparam node/tagname and end up with a string which looks something like this :

    -acodec libfaac -vcodec libx264 -s 640x360 -ab 96k

    I am kind of stuck . This is what I have put together so far :

    #!/usr/bin/perl

    use warnings;
    use strict;
    use Data::Dumper;
    use XML::LibXML;
    my $filename = "xml/profile.xml";
    my $parser = XML::LibXML->new;
    my $doc    = $parser->parse_file($filename)
                   or die "can't parse profile file: $@";
    my $root = $doc->documentElement();
    my @nodeList = $doc->getElementsByTagName('enodingParam');

    here is the xml file

    <?xml version="1.0"?>
    <profiles>
           <profile>
                           <metadt>
                                   <profilename>testp1</profilename>
                                   <filecontainer>.mp4</filecontainer>
                           </metadt>
                           <enodingparam>
                                   <videocodec arg="-vcodec">libx264</videocodec>
                                   <videopreset arg="-vpre">slow</videopreset>
                                   <videobitrate arg="-b">1200k</videobitrate>
                                   <videowidth arg="-w">640</videowidth>
                                   <videoheight arg="-h">360</videoheight>
                                   <videosize arg="-s">640x360</videosize>
                                   <videoframerate arg="-r">25</videoframerate>
                                   <videogop arg="-g">90</videogop>
                                   <audiobitrate arg="-ab">ab 96k</audiobitrate>
                                   <audiocodec arg="-acodec">-acodec libfaac</audiocodec>
                                   <audiochannels arg="-ac">2</audiochannels>
                                   <audiorate arg="-ar">"22050"</audiorate>
                           </enodingparam>
           </profile>
           <profile>
                           <metadt>
                                   <profilename>testProfile22</profilename>
                                   <filecontainer>.mp4</filecontainer>
                           </metadt>
                           <enodingparam>
                                   <videocodec arg="-vcodec">libx264</videocodec>
                                   <videopreset arg="-vpre">slow</videopreset>
                                   <videobitrate arg="-b">1200k</videobitrate>
                                   <videowidth arg="-w">640</videowidth>
                                   <videoheight arg="-h">360</videoheight>
                                   <videosize arg="-s">640x360</videosize>
                                   <videoframerate arg="-r">25</videoframerate>
                                   <videogop arg="-g">90</videogop>
                                   <audiobitrate arg="-ab">96k</audiobitrate>
                                   <audiocodec arg="-acodec">libfaac</audiocodec>
                                   <audiochannels arg="-ac">2</audiochannels>
                                   <audiorate arg="-ar">22050</audiorate>
                           </enodingparam>
           </profile>

    </profiles>

    Modified the pl script to

    use warnings;
    use strict;
    use Data::Dumper;
    use XML::LibXML;
    my $filename = "xml/book.xml";
    my $parser = XML::LibXML->new;
    my @ffmpegargs;
    my $fileName="filename";
    my $doc    = $parser->parse_file($filename)
                   or die "can't parse profile file: $@";
    my $root = $doc->documentElement();
    my @paramList = $doc->getElementsByTagName('enodingParam');

    for my $ele (@paramList)
    {
       # You then need to iterate over all the children of that node...

       for my $param ($ele->nonBlankChildNodes())
       {

           my $inparams = " " . $param->getAttribute('arg') . " " . $param->textContent ;
           push ( @ffmpegargs, $inparams);

       }
       my $ffmpeg = join(" ", @ffmpegargs);
       print "ffmpeg" . $ffmpeg, "\n";
    }

    It is printing out correctly. Now how do i add the following to the string
    $filename , profileName, containerName (from the metadat node) to the same string so that my final output looks like :

    ffmpeg -vcodec libx264  -vpre slow  -b 1200k  -w 640  -h 360  -s 640x360 filename_profileName_containerName

    ok tried zooming ue to profile. Not sure how to traverse the child nodes. Tried this. But its nor printing the right values

    use warnings;
    use strict;
    use Data::Dumper;
    use XML::LibXML;
    my $filename = "xml/book.xml";
    my $parser = XML::LibXML->new;
    my @ffmpegargs;
    my $fileName="filename";
    my $doc    = $parser->parse_file($filename)
                   or die "can't parse profile file: $@";
    my $root = $doc->documentElement();
    my @paramList = $doc->getElementsByTagName('profile');

    for my $ele (@paramList)
    {
       # You then need to iterate over all the children of that node...

       for my $param ($ele->findnodes('/encodingParam/*'))
       {

           my $inparams = " " . $param->getAttribute('arg') . " " . $param->textContent ;
           push ( @ffmpegargs, $inparams);

       }
       my $ffmpeg = join(" ", @ffmpegargs);
       print "ffmpeg" . $ffmpeg, "\n";
    }