Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (111)

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

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

Sur d’autres sites (9079)

  • Getting 'av_interleaved_write_frame() : Broken pipe' error

    2 juillet 2016, par Poornan

    I am trying this blog post.I am new to python, numpy as well as FFMPEG. I could not figure out what causes this issue.

    http://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/

    here is the code :

    import subprocess as sp
    import numpy

    print ("Hello World!");
    FFMPEG_BIN = "ffmpeg" # on Linux ans Mac OS
    #FFMPEG_BIN = "ffmpeg.exe" # on Windows

    command = [ FFMPEG_BIN,
               '-i', '/Users/eananthaneshan/Movies/myvideo.mp4',
               '-f', 'image2pipe',
               '-pix_fmt', 'yuv444p',
               '-s', '420x360',
               '-r', '24',
               '-vcodec', 'h264', '-']
    pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=-1)

    # read 420*360*3 bytes (= 1 frame)
    raw_image = pipe.stdout.read(420*360*3)
    # transform the byte read into a numpy array
    image =  numpy.fromstring(raw_image, dtype='uint8')
    image = image.reshape((360,420,3)   )
    # throw away the data in the pipe's buffer.
    pipe.stdout.flush()

    This is the output :

    ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
     built with Apple LLVM version 7.0.0 (clang-700.0.72)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
     libavutil      54. 31.100 / 54. 31.100
     libavcodec     56. 60.100 / 56. 60.100
     libavformat    56. 40.101 / 56. 40.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 40.101 /  5. 40.101
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.101 /  1.  2.101
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/eananthaneshan/Movies/myvideo.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 1
       compatible_brands: isom
       creation_time   : 2014-04-07 02:02:31
     Duration: 01:00:10.03, start: 0.000000, bitrate: 1024 kb/s
       Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 111 kb/s (default)
       Metadata:
         creation_time   : 2014-04-07 02:02:31
         handler_name    : GPAC ISO Audio Handler
       Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/unknown), 720x404, 909 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
       Metadata:
         creation_time   : 2014-04-07 01:14:58
         handler_name    : L-SMASH Video Media Handler
         encoder         : AVC Coding
    Output #0, image2pipe, to 'pipe:':
     Metadata:
       major_brand     : isom
       minor_version   : 1
       compatible_brands: isom
       encoder         : Lavf56.40.101
       Stream #0:0(und): Video: rawvideo (444P / 0x50343434), yuv444p, 420x360, q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
       Metadata:
         creation_time   : 2014-04-07 01:14:58
         handler_name    : L-SMASH Video Media Handler
         encoder         : Lavc56.60.100 rawvideo
    Stream mapping:
     Stream #0:1 -> #0:0 (h264 (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    av_interleaved_write_frame(): Broken pipe
    frame=    2 fps=0.0 q=-0.0 Lsize=     886kB time=00:00:00.08 bitrate=87003.8kbits/s    
    video:886kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
    Conversion failed!
  • compile ffmpeg decode only without audio codecs

    28 juillet 2016, par Rob

    I work on a media manager and use ffmpeg.exe to extract screenshots.
    With the latest size of ffmpeg.exe exceeding 35MB, I am attempting to build ffmpeg without the majority of its functions, to allow only saving of a frame of video.

    I had thought disabling many of the filters, Audio Codecs etc would shrink the size of ffmpeg to something more manageable.

    Following this guide
    https://pracucci.com/compile-ffmpeg-on-windows-with-visual-studio-compiler.html
    to allow building of ffmpeg using Visual Studio 2015, I have come to the part of ./configuration and hit a wall.
    With so many options and no idea what all of them mean or do, I am asking if someone in the community can give me laymans instructions.

    I also know that I need to build x264, and possible x265 (HEVC), but am not sure if there is anything other codecs needed.
    In the end, I and am hoping to just have the one file, ffmpeg.exe for use in the media manager project.

    The code I use to get a screenshot is as follows

    Public Shared Function CreateScreenShot(ByVal FullPathAndFilename As String, ByVal SavePath As String, ByVal sec As Integer, Optional ByVal Overwrite As Boolean = False) As Boolean
       If Not File.Exists(SavePath) Or Overwrite Then
           Try
               IO.File.Delete(SavePath)
           Catch
               Return False
           End Try
           If IO.File.Exists(FullPathAndFilename) Then
               Dim myProcess As Process = New Process
               Try
                   Dim seconds As Integer = sec
                   myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
                   myProcess.StartInfo.CreateNoWindow = False
                   myProcess.StartInfo.FileName = Utilities.applicationPath & "\Assets\ffmpeg.exe"
                   Dim proc_arguments As String = "-ss " & seconds.ToString & " -i """ & FullPathAndFilename & """ -vframes:v 1 -an " & """" & SavePath & """"
                   myProcess.StartInfo.Arguments = proc_arguments
                   myProcess.Start()
                   myProcess.WaitForExit()
                   If File.Exists(SavePath) Then Return True
               Catch ex As Exception
                   Throw ex
               Finally
                   myProcess.Close()
               End Try
           End If
       End If
       Return False
    End Function

    I hope this is sufficient information, and appreciated any help or suggestions.

  • Could not open encoder using ffmpeg C APi for MOV format

    22 juin 2016, par lupod

    Context

    I am writing a program for doing some video processing on an input file. I wrote two classes for handling the "reading/writing frames" part that essentially wrap the functions of ffmpeg. These classes may be instantiated by providing an input and output file name, and in their constructor I initialize everything that is needed (or at least I hope so).

    This are the two routines that are called inside the constructors :

    // InputVideoHandler.cpp
    void InputVideoHandler::init(char* name) {
     streamIndex = -1;
     int numStreams;

     if (avformat_open_input(&formatCtx, name, NULL, NULL) != 0)
       throw std::exception("Invalid input file name.");

     if (avformat_find_stream_info(formatCtx, NULL)<0)
       throw std::exception("Could not find stream information.");

     numStreams = formatCtx->nb_streams;

     if (numStreams < 0)
       throw std::exception("No streams in input video file.");

     for (int i = 0; i < numStreams; i++) {
       if (formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         streamIndex = i;
         break;
       }
     }

     if (streamIndex < 0)
       throw std::exception("No video stream in input video file.");

     // find decoder using id
     codec = avcodec_find_decoder(formatCtx->streams[streamIndex]->codec->codec_id);
     if (codec == nullptr)
       throw std::exception("Could not find suitable decoder for input file.");

     // copy context from input stream
     codecCtx = avcodec_alloc_context3(codec);
     if (avcodec_copy_context(codecCtx, formatCtx->streams[streamIndex]->codec) != 0)
       throw std::exception("Could not copy codec context from input stream.");

     if (avcodec_open2(codecCtx, codec, NULL) < 0)
       throw std::exception("Could not open decoder.");

     codecCtx->refcounted_frames = 1;
    }

    // OutputVideoBuilder.cpp
    void OutputVideoBuilder::init(char* name, AVCodecContext* inputCtx) {
     if (avformat_alloc_output_context2(&formatCtx, NULL, NULL, name) < 0)
       throw std::exception("Could not determine file extension from provided name.");

     codec = avcodec_find_encoder(inputCtx->codec_id);
     if (codec == nullptr) {
       throw std::exception("Could not find suitable encoder.");
     }

     codecCtx = avcodec_alloc_context3(codec);
     if (avcodec_copy_context(codecCtx, inputCtx) < 0)
       throw std::exception("Could not copy output codec context from input");

     codecCtx->time_base = inputCtx->time_base;

     if (avcodec_open2(codecCtx, codec, NULL) < 0)
       throw std::exception("Could not open encoder.");

     stream = avformat_new_stream(formatCtx, codec);
     if (stream == nullptr) {
       throw std::exception("Could not allocate stream.");
     }

     stream->id = formatCtx->nb_streams - 1;
     stream->codec = codecCtx;
     stream->time_base = codecCtx->time_base;

     av_dump_format(formatCtx, 0, name, 1);
     if (!(formatCtx->oformat->flags & AVFMT_NOFILE)) {
       if (avio_open(&formatCtx->pb, name, AVIO_FLAG_WRITE) < 0) {
         throw std::exception("Could not open output file.");
       }
     }

     if (avformat_write_header(formatCtx, NULL) < 0) {
       throw std::exception("Error occurred when opening output file.");
     }

    }

    As you see, for the Init function of the output handler I require that an AVCodecContext must be provided. In my code, I pass to the constructor the AVCodecContext that is stored in the input handler and that was previously created.

    Question :

    The two functions work fine when I test my program with some video formats, like .mpg or .avi. When I try to process .mov/.mp4 files, however, my code throws the exception that I labeled "Could not open encoder." in OutputVideoBuilder::Init(). Why is this happening ? I read from the General documentation of ffmpeg that that format should be supported as well by ffmpeg. I am assuming that I am doing something wrong in my code, which I do not completely understand because it was created by trying to adapt the tutorials of the documentation to my specific case. Also for this reason, any comments on things that are useless or things that are missing will be greatly appreciated.