Recherche avancée

Médias (0)

Mot : - Tags -/masques

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

Autres articles (43)

Sur d’autres sites (7788)

  • how to resume ffmpeg streamer for network disconnection for a period of time but eventually recovery

    30 septembre 2019, par DJI_lover

    I can stream my video well by using ffmpeg’s libav* when network is good,but I can not guarantee that the network will always be good.I hope that when the network is bad, even disconnect for a period of time, the streaming process can resume and continue to stream video when network recover. I have tried, when I was streaming the video, I manually disconnected the network, the streamer stopped quickly. After 20 seconds, I resumed the network, the process resumed to stream as well in a few seconds.But if I disconnect the network for five minutes or longer, when the network is restored, the process blocked.Dose someone knows how to resume the streamer instread of blocking no matter how long the network is disconnected but eventually recovered(not by restarting the program).Could you give me some solution if you know ,thanks .

    I have googled the solution,but can’t find something useful.So I come here to ask for help

    static int encode_and_write_frame(AVCodecContext *codec_ctx, AVFormatContext *fmt_ctx, AVFrame *frame)
    {
       AVPacket pkt = {0};
       av_init_packet(&pkt);
       int ret = avcodec_send_frame(codec_ctx, frame);
       if (ret < 0)
       {
           fprintf(stderr, "Error sending frame to codec context!\n");
           return ret;
       }
       ret = avcodec_receive_packet(codec_ctx, &pkt);
       //pkt.dts = pkt.pts;
       if (ret < 0)
       {
           fprintf(stderr, "Error receiving packet from codec context!\n" );
           return ret;
       }
       av_interleaved_write_frame(fmt_ctx, &pkt);
       av_packet_unref(&pkt);
       return 0;
    }


    void Streamer::stream_frame(const cv::Mat &image)
    {
       if(can_stream()) {
           const int stride[] = {static_cast<int>(image.step[0])};
           sws_scale(scaler.ctx, &amp;image.data, stride, 0, image.rows, picture.frame->data, picture.frame->linesize);
           picture.frame->pts += av_rescale_q(1, out_codec_ctx->time_base, out_stream->time_base);
    //picture.frame->dts = picture.frame->pts;
           encode_and_write_frame(out_codec_ctx, format_ctx, picture.frame);
       }
    }


    while(ok) {
           process_frame(read_frame, proc_frame);
           if(!from_camera) {
               streamer.stream_frame(proc_frame);
           } else {
               streamer.stream_frame(proc_frame, frame_time.count()*streamer.inv_stream_timebase);
           }
           ok = video_capture.read(read_frame);
           time_prev = time_stop;
       }
    </int>
  • With ffmpeg's image to movie feature, is it possible to pass in frames over a period of time versus all at once ?

    2 novembre 2013, par Zack Yoshyaro

    For the purpose of making a time lapse recording of desktop activity, it is possible so "stream" the frame list to ffmpeg over time, rather than all at once in the beginning.

    Currently, it is a two step process.

    1. save individual snapshots to disc

      im = ImageGrab.grab()
      im.save("frame_%s.jpg" % count, 'jpg')

    2. compile those snapshots with ffmpeg via

      ffmpeg -r 1 -pattern_type glob -i '*.jpg' -c:v libx264 out.mp4

    It would be nice if there were a way to merge the two steps so that I'm not flooding my hard drive with thousands of individual snapshots. Is it possible to do this ?

  • How i can fix selected processor does not support Thumb mode `itt gt'

    22 octobre 2017, par w liu

    When I compiled ffmpeg(version 3.3.4) for Android, I successfully compiled out .so, but there was an error while running the project.

    C :\Users\admin\AppData\Local\Temp\ffmpeg-105062.s : Assembler messages :
    C :\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43301 : Error : selected processor does not support Thumb mode

    itt gt'
     C:\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43302: Error: thumb conditional instruction should be in IT block --

    movgt r6,r0’
    C :\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43303 : Error : thumb conditional instruction should be in IT block —

    movgt r0,r1'
     C:\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43305: Error: selected processor does not support Thumb mode

    it le’
    C :\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43306 : Error : thumb conditional instruction should be in IT block —

    movle r0,r2'
     C:\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43308: Error: selected processor does not support Thumb mode

    it gt’
    C :\Users\admin\AppData\Local\Temp\ffmpeg-105062.s:43309 : Error : thumb conditional instruction should be in IT block — `movgt r6,r0’
    clang.exe : error : assembler command failed with exit code 1 (use -v to see invocation)

    NDK=/root/Ndk/android-ndk-r14b
    SYSROOT=$NDK/platforms/android-23/arch-arm/
    TOOLCHAIN=/root/Ndk/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
    function build_one

    ./configure \
    —prefix=$PREFIX
    —enable-shared
    —disable-static
    —disable-doc
    —enable-ffmpeg
    —disable-ffplay
    —disable-ffprobe
    —disable-ffserver
    —disable-doc
    —disable-symver
    —enable-small
    —cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    —target-os=linux
    —arch=armv7-a
    —enable-cross-compile
    —sysroot=$SYSROOT
    —extra-cflags="-march=armv7-a -mfloat-abi=softfp -mfpu=neon -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__"
    $ADDITIONAL_CONFIGURE_FLAG
    make clean
    make
    make install

    CPU=arm
    PREFIX=/root/FFmpegOut/android/$CPU
    build_one