Recherche avancée

Médias (1)

Mot : - Tags -/punk

Autres articles (105)

  • L’agrémenter visuellement

    10 avril 2011

    MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
    Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté.

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

Sur d’autres sites (7177)

  • C++/C FFmpeg artifact build up across video frames

    6 mars 2017, par ChiragRaman

    Context :
    I am building a recorder for capturing video and audio in separate threads (using Boost thread groups) using FFmpeg 2.8.6 on Ubuntu 16.04. I followed the demuxing_decoding example here : https://www.ffmpeg.org/doxygen/2.8/demuxing_decoding_8c-example.html

    Video capture specifics :
    I am reading H264 off a Logitech C920 webcam and writing the video to a raw file. The issue I notice with the video is that there seems to be a build-up of artifacts across frames until a particular frame resets. Here is my frame grabbing, and decoding functions :

    // Used for injecting decoding functions for different media types, allowing
    // for a generic decode loop
    typedef std::function PacketDecoder;

    /**
    * Decodes a video packet.
    * If the decoding operation is successful, returns the number of bytes decoded,
    * else returns the result of the decoding process from ffmpeg
    */
    int decode_video_packet(AVPacket *packet,
                           int *got_frame,
                           int cached){
       int ret = 0;
       int decoded = packet->size;

       *got_frame = 0;

       //Decode video frame
       ret = avcodec_decode_video2(video_decode_context,
                                   video_frame, got_frame, packet);
       if (ret < 0) {
           //FFmpeg users should use av_err2str
           char errbuf[128];
           av_strerror(ret, errbuf, sizeof(errbuf));
           std::cerr << "Error decoding video frame " << errbuf << std::endl;
           decoded = ret;
       } else {
           if (*got_frame) {
               video_frame->pts = av_frame_get_best_effort_timestamp(video_frame);

               //Write to log file
               AVRational *time_base = &video_decode_context->time_base;
               log_frame(video_frame, time_base,
                         video_frame->coded_picture_number, video_log_stream);

    #if( DEBUG )
               std::cout << "Video frame " << ( cached ? "(cached)" : "" )
                         << " coded:" <<  video_frame->coded_picture_number
                         << " pts:" << pts << std::endl;
    #endif

               /*Copy decoded frame to destination buffer:
                *This is required since rawvideo expects non aligned data*/
               av_image_copy(video_dest_attr.video_destination_data,
                             video_dest_attr.video_destination_linesize,
                             (const uint8_t **)(video_frame->data),
                             video_frame->linesize,
                             video_decode_context->pix_fmt,
                             video_decode_context->width,
                             video_decode_context->height);

               //Write to rawvideo file
               fwrite(video_dest_attr.video_destination_data[0],
                      1,
                      video_dest_attr.video_destination_bufsize,
                      video_out_file);

               //Unref the refcounted frame
               av_frame_unref(video_frame);
           }
       }

       return decoded;
    }

    /**
    * Grabs frames in a loop and decodes them using the specified decoding function
    */
    int process_frames(AVFormatContext *context,
                      PacketDecoder packet_decoder) {
       int ret = 0;
       int got_frame;
       AVPacket packet;

       //Initialize packet, set data to NULL, let the demuxer fill it
       av_init_packet(&packet);
       packet.data = NULL;
       packet.size = 0;

       // read frames from the file
       for (;;) {
           ret = av_read_frame(context, &packet);
           if (ret < 0) {
               if  (ret == AVERROR(EAGAIN)) {
                   continue;
               } else {
                   break;
               }
           }

           //Convert timing fields to the decoder timebase
           unsigned int stream_index = packet.stream_index;
           av_packet_rescale_ts(&packet,
                                context->streams[stream_index]->time_base,
                                context->streams[stream_index]->codec->time_base);

           AVPacket orig_packet = packet;
           do {
               ret = packet_decoder(&packet, &got_frame, 0);
               if (ret < 0) {
                   break;
               }
               packet.data += ret;
               packet.size -= ret;
           } while (packet.size > 0);
           av_free_packet(&orig_packet);

           if(stop_recording == true) {
               break;
           }
       }

       //Flush cached frames
       std::cout << "Flushing frames" << std::endl;
       packet.data = NULL;
       packet.size = 0;
       do {
           packet_decoder(&packet, &got_frame, 1);
       } while (got_frame);

       av_log(0, AV_LOG_INFO, "Done processing frames\n");
       return ret;
    }

    Questions :

    1. How do I go about debugging the underlying issue ?
    2. Is it possible that running the decoding code in a thread other than the one in which the decoding context was opened is causing the problem ?
    3. Am I doing something wrong in the decoding code ?

    Things I have tried/found :

    1. I found this thread that is about the same problem here : FFMPEG decoding artifacts between keyframes
      (I cannot post samples of my corrupted frames due to privacy issues, but the image linked to in that question depicts the same issue I have)
      However, the answer to the question is posted by the OP without specific details about how the issue was fixed. The OP only mentions that he wasn’t ’preserving the packets correctly’, but nothing about what was wrong or how to fix it. I do not have enough reputation to post a comment seeking clarification.

    2. I was initially passing the packet into the decoding function by value, but switched to passing by pointer on the off chance that the packet freeing was being done incorrectly.

    3. I found another question about debugging decoding issues, but couldn’t find anything conclusive : How is video decoding corruption debugged ?

    I’d appreciate any insight. Thanks a lot !

    [EDIT] In response to Ronald’s answer, I am adding a little more information that wouldn’t fit in a comment :

    1. I am only calling decode_video_packet() from the thread processing video frames ; the other thread processing audio frames calls a similar decode_audio_packet() function. So only one thread calls the function. I should mention that I have set the thread_count in the decoding context to 1, failing which I would get a segfault in malloc.c while flushing the cached frames.

    2. I can see this being a problem if the process_frames and the frame decoder function were run on separate threads, which is not the case. Is there a specific reason why it would matter if the freeing is done within the function, or after it returns ? I believe the freeing function is passed a copy of the original packet because multiple decode calls would be required for audio packet in case the decoder doesnt decode the entire audio packet.

    3. A general problem is that the corruption does not occur all the time. I can debug better if it is deterministic. Otherwise, I can’t even say if a solution works or not.

  • FFmpeg text is not displayed in my streamed video

    18 février 2017, par Ferguson

    on orangepi PC (armbian os) have installed Ffmpeg. I have followed the example in one previous post on how to add text into the stream but I don’t get any text in my video..

    ffserver.conf

    HTTPPort 8090
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 10000
    CustomLog -

    <feed>
    File /tmp/monitoring1.ffm
    FileMaxSize 50M
    ACL allow 127.0.0.1
    ACL allow 192.168.0.0 192.168.255.255
    </feed>

    <stream>
    Feed monitoring1.ffm
    Format mpjpeg
    VideoCodec mjpeg
    VideoFrameRate 22
    VideoBufferSize 80
    VideoSize 720x264
    NoAudio
    </stream>


    # Redirect index.html to the appropriate site

    <redirect>
    URL http://www.ffmpeg.org/
    </redirect>

    I start a ffmpeg as :

    #!/bin/bash
    # My first script
    ffmpeg -i rtsp://mpv.cdn3.bigCDN.com:554/bigCDN/definst/mp4:bigbuckbunnyiphone_400.mp4 -vf drawtext="fontfile=/home/projekt/StreamTest/DejaVuSans.ttf: \
    text='Stack Overflow': fontcolor=white: fontsize=36: box=1: boxcolor=black@0.5: \
    boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" -codec:a copy http://localhost:8090/monitoring1.ffm

    enter image description here

    this is the result but the text is missing

    enter image description here

    thank you

  • In Android how to add text as watermark on already recorded video with ffmpeg ?

    23 juillet 2016, par jullie

    I am trying to set text as a watermark on already recorded video but it is not working. As I tried image.png as a water mark and it works by following this url http://androidwarzone.blogspot.in/2011/12/ffmpeg4android.html

    Command for apply image as watermark on already recorded video :

    String[] complexCommand = {"ffmpeg","-y" ,"-i", videoPathHere,"-strict",
    "experimental", "-vf", "movie="
    + Environment.getExternalStorageDirectory().getAbsolutePath()
    + "/watermarkImg.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]",
    "-s", "160x120","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000",
    "-ac", "2", "-ar", "22050",
    Environment.getExternalStorageDirectory().getAbsolutePath()+"/watermark.mp4"};

    but when I tried to implement text as watermark its not working :

    String[] complexCommand = {"ffmpeg", "-y" , "-i", videoPathHere, "-strict", "experimental",
    "-vf", "drawtext=fontfile=" + file + ":text=TestText", "-s", "160x120", "-r", "30",
    "-b", "15496k", "-vcodec", "mpeg4", "-ab", "48000", "-ac", "2", "-ar", "22050",
    Environment.getExternalStorageDirectory().getAbsolutePath()+"/watermark.mp4"};

    Even I tried this also
    http://video.stackexchange.com/questions/15551/ffmpeg-drawtext-filter-create-transparent-background-with-text

    but it is also not working in my case.

    So, what is going wrong with adding text as watermark ?

    I make changes in commenad from ;text=TestText to :text=TestText then it shows given error.

    07-23 10:58:07.595 : I/Videokit(28832) : libvideokit.so loaded
    07-23 10:58:07.595 : I/Videokit(28832) : args is not NULL
    07-23 10:58:07.595 : I/Videokit(28832) : more then one arg
    07-23 10:58:07.595 : I/Videokit(28832) : function symbol found
    07-23 10:58:07.595 : D/Videokit(28832) : Calling videokit run via loader
    07-23 10:58:07.595 : I/Videokit(28832) : vk ffmpeg sdcardPath : /data/user/0/valamovie.com/files/
    07-23 10:58:07.595 : D/Videokit(28832) : call licenseCheckComplex
    07-23 10:58:07.595 : I/Videokit(28832) : licenseCheck in path : /data/user/0/valamovie.com/files/
    07-23 10:58:07.595 : I/Videokit(28832) : isLicExistsComplex...
    07-23 10:58:07.595 : I/Videokit(28832) : trying to open /data/user/0/valamovie.com/files//ffmpeglicense.lic
    07-23 10:58:07.595 : I/Videokit(28832) : license file found...
    07-23 10:58:07.596 : I/Videokit(28832) : You used 0 of your 15 trial days.
    07-23 10:58:07.596 : D/Videokit(28832) : license check rc : 0
    07-23 10:58:07.596 : D/Videokit(28832) : run() called
    07-23 10:58:07.670 : A/libc(28832) : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 28832 (valamovie.com)
    07-23 10:58:07.771 : A/DEBUG(152) : * *
    07-23 10:58:07.771 : A/DEBUG(152) : Build fingerprint : ’Lava/PixelV1/PixelV1_sprout:6.0/MRA58V/eng.admin.20160419.120644:user/release-keys’
    07-23 10:58:07.771 : A/DEBUG(152) : Revision : ’0’
    07-23 10:58:07.771 : A/DEBUG(152) : ABI : ’arm’
    07-23 10:58:07.771 : A/DEBUG(152) : pid : 28832, tid : 28832, name : valamovie.com >>> valamovie.com <<<
    07-23 10:58:07.772 : A/DEBUG(152) : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
    07-23 10:58:07.789 : A/DEBUG(152) : r0 00000000 r1 00000001 r2 0000001e r3 00000000
    07-23 10:58:07.789 : A/DEBUG(152) : r4 b8ae87c0 r5 b8ae7fb0 r6 00000000 r7 b8b22500
    07-23 10:58:07.789 : A/DEBUG(152) : r8 9ee64cc4 r9 b8a1fad0 sl b8b625d0 fp 00000000
    07-23 10:58:07.789 : A/DEBUG(152) : ip b6d875dc sp bea3e340 lr 9e3969ac pc 9e395bb8 cpsr 600f0010
    07-23 10:58:07.791 : A/DEBUG(152) : backtrace :
    07-23 10:58:07.791 : A/DEBUG(152) : #00 pc 0007cbb8 /data/app/valamovie.com-1/lib/arm/libvideokit.so
    07-23 10:58:08.503 : W/ActivityManager(557) : Force finishing activity valamovie.com/.Ui.addNewProject
    07-23 10:58:08.504 : A/DEBUG(152) : Tombstone written to : /data/tombstones/tombstone_00
    07-23 10:58:08.504 : E/DEBUG(152) : AM write failed : Broken pipe
    07-23 10:58:08.505 : I/BootReceiver(557) : Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
    07-23 10:58:08.527 : W/InputDispatcher(557) : channel ’86e38ae valamovie.com/valamovie.com.Ui.MainActivity (server)’ Consumer closed input channel or an error occurred. events=0x9
    07-23 10:58:08.528 : E/InputDispatcher(557) : channel ’86e38ae valamovie.com/valamovie.com.Ui.MainActivity (server)’ Channel is unrecoverably broken and will be disposed !
    07-23 10:58:08.529 : W/InputDispatcher(557) : channel ’e50713f valamovie.com/valamovie.com.Ui.addNewProject (server)’ Consumer closed input channel or an error occurred. events=0x9
    07-23 10:58:08.529 : E/InputDispatcher(557) : channel ’e50713f valamovie.com/valamovie.com.Ui.addNewProject (server)’ Channel is unrecoverably broken and will be disposed !
    07-23 10:58:08.531 : W/ActivityManager(557) : Exception thrown during pause