Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (78)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • 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

Sur d’autres sites (17683)

  • Stream video from mobile camera to ffmpeg with NDK

    19 juillet 2013, par user2598307

    I need to create an application that captures video from a camera phone and send it to ffmpeg. Everything should be done only NDK level without SDK and Java
    - The phone can be Root

    I am trying to open camera on my android device with this function "avformat_open_input()". I give this function a reference to device folder "/dev/msm_camera/" or "/dev/video0".

    I try like this :

         void Java_com_example_camera_MainActivity_testVideo(JNIEnv *env, jclass jc, jstring *filename)
    {
           av_register_all();
           avcodec_register_all();
           avformat_network_init();
           AVFormatContext* context = avformat_alloc_context();
           int video_stream_index,ret,i;
           AVInputFormat *input_format = NULL;
           const char formatName[] = "mpeg"; //for example mpeg
           const jbyte *str;
           str = (*env)->GetStringUTFChars(env, filename, NULL); //filename = "/dev/msm_camera"
           input_format = av_find_input_format(formatName);
           ret = avformat_open_input(&context, str, input_format, NULL);
           if (ret < 0){
              LOGE("Not open");
           }else{
              LOGI("camera was open");
           }
           if(avformat_find_stream_info(context,NULL) < 0){
              LOGE("No stream");
           }
           for(i =0;inb_streams;i++){
              if(context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
                  video_stream_index = i;
           }
           AVPacket packet;
           AVFrame *pFrame;
           av_init_packet(&packet);
           pFrame = avcodec_alloc_frame();

                   //open output file
           AVOutputFormat* fmt = av_guess_format("avi", NULL, NULL);
           AVFormatContext* outputContext = avformat_alloc_context();
           outputContext->oformat = fmt;
           avio_open2(&outputContext->pb, "/sdcard/test.avi", AVIO_FLAG_WRITE,NULL,NULL);
           AVStream* stream=NULL;
           AVFrame * frame;
           frame = avcodec_alloc_frame();
           int cnt = 0, frameDecoded;

                   //start reading packets from stream and write them to file
           av_read_play(context);
           while(av_read_frame(context,&packet)>=0 && cnt <300){ //Here function return -1
             if(packet.stream_index == video_stream_index)
             {//packet is video
               if(stream == NULL){
                  //create stream in file
                        stream = avformat_new_stream(outputContext,context->streams[video_stream_index]->codec->codec);
                        avcodec_copy_context(stream->codec,context->streams[video_stream_index]->codec);
                        stream->sample_aspect_ratio = context->streams[video_stream_index]->codec->sample_aspect_ratio;
                        avformat_write_header(outputContext,NULL);
                }
                packet.stream_index = stream->id;
                av_write_frame(outputContext,&packet);
                cnt++;
              }
              av_free_packet(&packet);
              av_init_packet(&packet);
           }
           av_read_pause(context);
           av_write_trailer(outputContext);
           avio_close(outputContext->pb);
           avformat_free_context(outputContext);        
    }

    As I know, we cannot get access to camera because my program has not root permission. So how I can give my program root permission ? Or how I can go around this problem ?

    I also tried to interact with the device driver using ioctl commands on C\C++, but I did not succeed because I have no experience and examples in Google.

    Thank you !!!

  • FFmpeg : avcodec_open2 returns "Permission denied" (-13)

    24 avril 2019, par maxest

    I wanted to open an encoder, H264, C++, Android. This :

    encoderH264 = avcodec_find_encoder(AV_CODEC_ID_H264);

    works. This one :

    codecContext = avcodec_alloc_context3(encoderH264);

    also works. But I get error "Permission denied" (-13) on that :

    avcodec_open2(codecContext, encoderH264, NULL);

    I’d suppose that my FFmpeg lib does support H264 encoding as avcodec_find_encoder returns valid value (when I used some other FFmpeg lib this function returned null).

    Any ideas ?

  • avio_open() function returns -138

    8 avril 2024, par checkright

    When I use ffmpeg4.4.1 to push rtmp to the desktop, the program returns -138 when running avio_open().I use dshow's screen-capture-recorder on the input side. My purpose is to capture the desktop in real time and use rtmp to push the stream.

    


        avdevice_register_all();
    avformat_network_init();

    AVFormatContext* pFmtCtx_In = nullptr;
    AVFormatContext* pFmtCtx_Out = nullptr;
    AVInputFormat*   pInFmt  = nullptr;
    AVDictionary* options = nullptr;
    int nVideoIndex          = -1;
    int              ret     = 0;

    AVCodecParameters* pCodecParam = nullptr;
    AVCodecContext   * pCodecCtx   = nullptr;
    AVCodec          * pCodec      = nullptr;

    AVFrame* pFrame    = av_frame_alloc();
    AVFrame* pFrameRGB = av_frame_alloc();
    AVPacket* pkt      = nullptr;

    pFrame    = av_frame_alloc();
    pFrameRGB = av_frame_alloc();
    pkt       = nullptr;
    img_convert_ctx = nullptr;

    pFmtCtx_In = avformat_alloc_context();
    if(!pFmtCtx_In)
    {
        qDebug() << "create AVFormatContext failed." ;
        return;
    }

    QString urlString = QString("video=screen-capture-recorder");
    const char* rtmpAddress = "rtmp://192.168.0.136:8554/myapp/test";
    
    if(1){
        pInFmt = const_cast(av_find_input_format("dshow"));
        ret = avformat_open_input(&pFmtCtx_In, urlString.toStdString().c_str(), pInFmt, nullptr);
    }else{
        pInFmt = const_cast(av_find_input_format("gdigrab"));
        av_dict_set(&options, "video_device_index", "1", 0);  
        av_dict_set(&options, "offset_x", "1920", 0);
        av_dict_set(&options, "offset_y", "0", 0);
        av_dict_set(&options, "draw_mouse", "1", 0);
        av_dict_set(&options, "video_size", "1920x1080", 0);
        ret = avformat_open_input(&pFmtCtx_In, "desktop", pInFmt, &options);
    }

    if(!pInFmt)
    {
        qDebug() << "find AVInputFormat failed." ;
        return;
    }

    if(ret < 0)
    {
        qDebug() << "open camera failed."<nb_streams; i++){
        if(pFmtCtx_In->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){
            nVideoIndex = i;
            continue;
        }
    }

    if(nVideoIndex == -1){
        qDebug() << "cannot find video stream." ;
        return;
    }


    pCodecParam = pFmtCtx_In->streams[nVideoIndex]->codecpar;
    pCodec = avcodec_find_decoder(pCodecParam->codec_id);
    if(!pCodec)
    {
        qDebug() << "cannot find codec." ;
        return;
    }

    ret = avformat_alloc_output_context2(&pFmtCtx_Out, NULL, "flv", rtmpAddress);
    //    ret = avformat_alloc_output_context2(&pFmtCtx_Out, NULL, "rtsp", rtmpAddress);
    if (ret < 0) {
        qDebug() << "cannot avformat_alloc_output_context2." ;
        return ;
    }

    for (int i = 0; i < pFmtCtx_In->nb_streams; i++) {
        AVStream *outStream = avformat_new_stream(pFmtCtx_Out, pFmtCtx_In->streams[i]->codec->codec);
        if (!outStream) {
            qDebug() << "cannot outStream." ;

            return ;
        }

        ret = avcodec_parameters_copy(outStream->codecpar, pFmtCtx_In->streams[i]->codecpar);
        if (ret < 0) {
             qDebug() << "cannot avcodec_parameters_copy." ;
            return ;
        }
        outStream->codec->codec_tag = 0;
    }
  
    av_dump_format(pFmtCtx_Out, 0, rtmpAddress, 1);

    ret = avio_open(&pFmtCtx_Out->pb, rtmpAddress, AVIO_FLAG_WRITE);
    if (ret < 0) {
        qDebug() << "cannot avio_open." <code>

    


    An error occurs here.According to the data, the problem occurs at the input end, and the input end can display the desktop normally. How can I make it run successfully ? How do I need to modify the above code ?