Recherche avancée

Médias (91)

Autres articles (39)

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

  • FFMPEG / MJPEG Encoding / How to add DQT table in packet data ?

    20 mai 2020, par GoodSimon

    I write my own transcoder in C++ to convert any image to jpeg based on the examples in ffmpeg sources. I use the MJPEG codec to create a jpeg image. By sending AVFrame to the MJPEG encoder I get AVPacket. Then I just take the data from the packet->data structure with the size avpacket->size and save it to a file with the jpg extension.
The problem is that the finished JPEG image has only one DQT (Define Quantization Table). As far as I understand, there should be two tables in the file.

    



    What do I need to do to have 2 quantization tables in avpacket->data ?

    


  • FFmpeg - Audio encoding produces extra noise over audio

    17 mai 2020, par user3208915

    I am trying to use FFmpeg to take a video (MP4 in this case) and copy it as another MP4. This is so that I can get the hang of decoding/encoding a video and go on to doing other things in that process. My code basically takes a video file, decodes the video and audio streams, and encodes the video and audio streams to an output video file.

    



    As of now, my code only works for the video stream of the input file. The video part of the output file is exactly the same as the video part of the input file. However, the audio part is not. The audio part of the output contains the original audio, but with noise over it. Think of it as someone screaming into their mic or when audio gets too loud for a speaker to handle.

    



    The way I'm handling the decoding/encoding process for the video and audio streams is the same, except with a difference in AVCodecContext settings (video —> frame_rate, width, height, etc. ; audio —> sample_rate, channels, etc.).

    



    This is currently the code that I'm working with :

    



    The Video struct :

    



    typedef struct Video {
    AVFormatContext* inputContext;
    AVFormatContext* outputContext;
    AVCodec* videoCodec;
    AVCodec* audioCodec;
    AVStream* inputStream;
    AVStream* outputStream;
    AVCodecContext* videoCodecContext_I; // Input
    AVCodecContext* audioCodecContext_I; // Input
    AVCodecContext* videoCodecContext_O; // Output
    AVCodecContext* audioCodecContext_O; // Output
    int videoStream; // Video stream index
    int audioStream; // Audio stream index
} Video;


    



    The main code that handles the encoding/decoding (I've only included the audio side since the video side is the same) :

    



    int openVideo(Video* video, char* filename, char* outputFile) {
    video->inputContext = avformat_alloc_context();
    if (!video->inputContext) {
        printf("[ERROR] Failed to allocate input format context\n");
        return -1;
    }
    if (avformat_open_input(&(video->inputContext), filename, NULL, NULL) < 0) {
        printf("[ERROR] Could not open the input file\n");
        return -1;
    }

    if (avformat_find_stream_info(video->inputContext, NULL) < 0) {
        printf("[ERROR] Failed to retrieve input stream info\n");
        return -1;
    }
    avformat_alloc_output_context2(&(video->outputContext), NULL, NULL, outputFile);
    if (!video->outputContext) {
        printf("[ERROR] Failed to create output context\n");
        return -1;
    }
    printf("[OPEN] Video %s opened\n", filename);
    return 0;
}

int prepareStreamInfo(AVCodecContext** codecContext, AVCodec** codec, AVStream* stream) {
    *codec = avcodec_find_decoder(stream->codecpar->codec_id);
    if (!*codec) {
        printf("[ERROR] Failed to find input codec\n");
        return -1;
    }
    *codecContext = avcodec_alloc_context3(*codec);
    if (!codecContext) {
        printf("[ERROR] Failed to allocate memory for input codec context\n");
        return -1;
    }
    if (avcodec_parameters_to_context(*codecContext, stream->codecpar) < 0) {
        printf("[ERROR] Failed to fill input codec context\n");
        return -1;
    }
    if (avcodec_open2(*codecContext, *codec, NULL) < 0) {
        printf("[ERROR] Failed to open input codec\n");
        return -1;
    }
    return 0;
}

int findStreams(Video* video, char* filename, char* outputFile) {
    if (openVideo(video, filename, outputFile) < 0) {
        printf("[ERROR] Video %s failed to open\n", filename);
        return -1;
    }
    for (int i = 0; i < video->inputContext->nb_streams; i++) {
        video->inputStream = video->inputContext->streams[i];
        if (video->inputContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
            video->videoStream = i;
            if (prepareStreamInfo(&(video->videoCodecContext_I), &(video->videoCodec), video->inputStream) < 0) {
                printf("[ERROR] Could not prepare video stream information\n");
                return -1;video->outputStream->time_base = video->audioCodecContext_O->time_base;
            }
        } else if (video->inputContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
            video->audioStream = i;
            if (prepareStreamInfo(&(video->audioCodecContext_I), &(video->audioCodec), video->inputStream) < 0) {
                printf("[ERROR] Could not prepare audio stream information\n");
                return -1;
            }
        }
        video->outputStream = avformat_new_stream(video->outputContext, NULL);
        if (!video->outputStream) {
            printf("[ERROR] Failed allocating output stream\n");
            return -1;
        }
        if (avcodec_parameters_copy(video->outputStream->codecpar, video->inputStream->codecpar) < 0) {
            printf("[ERROR] Failed to copy codec parameters\n");
            return -1;
        }
    }
    if (video->videoStream == -1) {
        printf("[ERROR] Video stream for %s not found\n", filename);
        return -1;
    }
    if (video->audioStream == -1) {
        printf("[ERROR] Audio stream for %s not found\n", filename);
        return -1;
    }
    if (!(video->outputContext->oformat->flags & AVFMT_NOFILE)) {
    if (avio_open(&(video->outputContext->pb), outputFile, AVIO_FLAG_WRITE) < 0) {
      printf("Could not open output file %s", outputFile);
      return -1;
    }
  }
    return 0;
}

int prepareAudioOutStream(Video* video) {
    video->audioCodec = avcodec_find_encoder_by_name("mp2");
    if (!video->audioCodec) {
        printf("[ERROR] Failed to find audio output codec\n");
        return -1;
    }
    video->audioCodecContext_O = avcodec_alloc_context3(video->audioCodec);
    if (!video->audioCodecContext_O) {
        printf("[ERROR] Failed to allocate memory for audio output codec context\n");
        return -1;
    }
    // Quite possibly the issue
    video->audioCodecContext_O->channels = video->audioCodecContext_I->channels;
    video->audioCodecContext_O->channel_layout = av_get_default_channel_layout(video->audioCodecContext_O->channels);
    video->audioCodecContext_O->sample_rate = video->audioCodecContext_I->sample_rate;
    video->audioCodecContext_O->sample_fmt = video->audioCodec->sample_fmts[0];
    video->audioCodecContext_O->bit_rate = video->audioCodecContext_I->bit_rate;
    video->audioCodecContext_O->time_base = video->audioCodecContext_I->time_base;
    video->audioCodecContext_O->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
    if (avcodec_open2(video->audioCodecContext_O, video->audioCodec, NULL) < 0) {
        printf("[ERROR] Failed to open audio output codec\n");
        return -1;
    }
    if (avcodec_parameters_from_context(getAudioStream(video)->codecpar, video->audioCodecContext_O) < 0) {
        printf("[ERROR] Failed to fill audio stream\n");
        return -1;
    }
    return 0;
}

int decodeAudio(Video* video, AVPacket* packet, AVFrame* frame) {
    int response = avcodec_send_packet(video->audioCodecContext_I, packet);
    if (response < 0) {
        printf("[ERROR] Failed to send audio packet to decoder\n");
        return response;
    }
    while (response >= 0) {
        response = avcodec_receive_frame(video->audioCodecContext_I, frame);
        if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
            break;
        } else if (response < 0) {
            printf("[ERROR] Failed to receive audio frame from decoder\n");
            return response;
        }
        if (response >= 0) {
            // Do stuff and encode
            if (encodeAudio(video, frame) < 0) {
                printf("[ERROR] Failed to encode new audio\n");
                return -1;
            }
        }
        av_frame_unref(frame);
    }
    return 0;
}

int encodeAudio(Video* video, AVFrame* frame) {
    AVPacket* packet = av_packet_alloc();
    if (!packet) {
        printf("[ERROR] Could not allocate memory for audio output packet\n");
        return -1;
    }
    int response = avcodec_send_frame(video->audioCodecContext_O, frame);
    if (response < 0) {
        printf("[ERROR] Failed to send audio frame for encoding\n");
        return response;
    }
    while (response >= 0) {
        response = avcodec_receive_packet(video->audioCodecContext_O, packet);
        if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
            break;
        } else if (response < 0) {
            printf("[ERROR] Failed to receive audio packet from encoder\n");
            return response;
        }
        packet->stream_index = video->audioStream;
        video->inputStream = getAudioStream(video);
        video->outputStream = video->outputContext->streams[packet->stream_index];
        packet->pts = av_rescale_q_rnd(packet->pts, video->inputStream->time_base, video->outputStream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
        packet->dts = av_rescale_q_rnd(packet->dts, video->inputStream->time_base, video->outputStream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
        packet->duration = av_rescale_q(packet->duration, video->inputStream->time_base, video->outputStream->time_base);
        packet->pos = -1;
        //av_packet_rescale_ts(packet, video->inputStream->time_base, video->outputStream->time_base);

        response = av_interleaved_write_frame(video->outputContext, packet);
        if (response < 0) {
            printf("[ERROR] Failed to write audio packet\n");
            break;
        }
    }
    av_packet_unref(packet);
    av_packet_free(&packet);
    return 0;
}

int readFrames(Video* video, AVPacket* packet, AVFrame* frame) {
    if (!packet) {
        printf("[ERROR] Packet not allocated to be read\n");
        return -1;
    }
    if (!frame) {
        printf("[ERROR] Frame not allocated to be read\n");
        return -1;
    }
    if (prepareVideoOutStream(video) < 0) {
        printf("[ERROR] Failed to prepare output video stream\n");
        return -1;
    }
    if (prepareAudioOutStream(video) < 0) {
        printf("[ERROR] Failed to prepare output audio stream\n");
        return -1;
    }
    int frameNum = 0;
    while (av_read_frame(video->inputContext, packet) >= 0) {
        printf("[READ] Reading frame %i\n", frameNum);
        if (packet->stream_index == video->videoStream) {
            if (decodeVideo(video, packet, frame) < 0) {
                printf("[ERROR] Failed to decode and encode video\n");
                return -1;
            }
        } else if (packet->stream_index == video->audioStream) {
            if (decodeAudio(video, packet, frame) < 0) {
                printf("[ERROR] Failed to decode and encode audio\n");
                return -1;
            }
        }
        av_packet_unref(packet);
        frameNum++;
    }
    // Flush encoder
    encodeVideo(video, NULL);
    encodeAudio(video, NULL);
    av_write_trailer(video->outputContext);
    return 0;
}


    



    My main method that runs all the functions :

    



    int main(int argc, char* argv[]) {
    Video* video = (Video*)malloc(sizeof(Video));
    initVideo(video);
    if (findStreams(video, argv[1], argv[2]) < 0) {
        printf("[ERROR] Could not find streams\n");
        return -1;
    }

    AVDictionary* dic = NULL;
    if (avformat_write_header(video->outputContext, &dic) < 0) {
        printf("[ERROR] Error while writing header to output file\n");
        return -1;
    }
    AVFrame* frame = av_frame_alloc();
    AVPacket* packet = av_packet_alloc();
    if (readFrames(video, packet, frame) < 0) {
        printf("[ERROR] Failed to read and write new video\n");
        return -1;
    }
    freeVideo(video); // Frees all codecs and contexts and the video
    return 0;
}


    



    I tried to lay out my code so that it can be read from top to bottom without needing to scroll up.

    



    I realize that when copying a video, I can just pass the AVPacket to write to the output file, but I wanted to be able to work with the AVFrame in the future, so I wrote it this way. I have a feeling that the issue with the way my audio is behaving is because of the audio output AVCodecContext from the prepareAudioOutStream() function.

    



    Reading the FFmpeg documentation has proved to be of little help with this issue as well as other online sources. I must be missing something (or have something unneeded) so anything that would point me in the right direction would be helpful.

    



    Thank you.

    


  • cmake installation of x265 for ffmpeg on Cygwin - executable location different from other codecs

    12 mai 2020, par bballdave025

    TL ;DR (with expected vs. real)

    



    For a Cygwin build of ffmpeg, I'm installing x265, and it seems to me that the executable ends up in the wrong place. I'll show some basic directory structure, then I'll show the tree outputs for expected and real, both before and after the cmake installation. For directories where I think this is important, I'll show the outputs before and after the cmake installation.

    



    My question has two parts. I used the following cmake and make commands,

    



    # pwd => $HOME/programs/ffmpeg/ffmpeg_sources/x265/build/linux
PATH="$HOME/programs/ffmpeg/bin:$PATH" \
  cmake -G "Unix Makefiles" \
        -DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg/ffmpeg_build" \
        -DENABLE_SHARED=OFF \
        -DCMAKE_EXE_LINKER_FLAGS="-static" 
            ../../source
PATH="$HOME/programs/ffmpeg/bin:$PATH" make -j $(nproc)
make install


    



    The result is below, with my real vs. expected, and there is a more detailed, more explicit, and hopefully more clear file with the info at pastebin.com/86wHrtxR. Now, for my two-part question :

    



      

    1. How can I change my cmake command so that my x265.exe file ends up in $HOME/programs/ffmpeg/bin with the proper linking, rather than $HOME/programs/ffmpeg/ffmpeg_build/bin ?

    2. 


    3. Would the build/linker/whatever figure things out for the ffmpeg build ?

    4. 


    



    I want to know the answer to question number 1 regardless of the answer to question number 2. I haven't used cmake with the -DVAR=var flags before, and I'd like to take this opportunity to learn.

    



    For the result :

    



    Things surrounded by double curly brackets are {{ expected }}.

    



    Things surrounded by double angle brackets are << real >>, i.e. they exist after the installation is done.

    



    If real matches expected, and the file/directory is new, I've surrounded it by double parentheses, i.e. double round brackets. (( match ))

    



    If something is not new (and thus has the same before and after) I haven't marked it.

    



       me@MACHINE ~/programs/ffmpeg&#xA;   $ tree --charset=ascii bin&#xA;   bin&#xA;   |-- lame.exe&#xA;   |-- mp3rtp.exe&#xA;   |-- mp3x.exe&#xA;   `-- x264.exe&#xA;{{ `-- x265.exe                     }} ## Expected, not Exists&#xA;&#xA;   me@MACHINE ~/programs/ffmpeg&#xA;   $ tree --charset=ascii \&#xA;                   ffmpeg_build&#xA;   ffmpeg_build&#xA;&lt;&lt; |-- bin                          >> ## Not expected, Exists&#xA;&lt;&lt; |   `-- x265.exe                 >> ## Not expected, Exists&#xA;   |-- include&#xA;   |   |-- fdk-aac&#xA;   |   |   |-- aacdecoder_lib.h&#xA;   |   |   |-- aacenc_lib.h&#xA;   |   |   `-- ... <more files="files">&#xA;   |   |-- lame&#xA;   |   |   `-- lame.h&#xA;   |   |-- x264.h&#xA;   |   `-- x264_config.h&#xA;(( |   |-- x265.h                   )) ## Expected and Exists&#xA;(( |   `-- x265_config.h            )) ## Expected and Exists&#xA;   |-- lib&#xA;   |   |-- libfdk-aac.a&#xA;   |   |-- libfdk-aac.la&#xA;   |   |-- libmp3lame.a&#xA;   |   |-- libmp3lame.la&#xA;(( |   |-- libx265.a                )) ## Expected and Exists&#xA;   |   `-- pkgconfig&#xA;   |       |-- fdk-aac.pc&#xA;   |       `-- x264.pc&#xA;(( |       `-- x265.pc              )) ## Expected and Exists&#xA;   `-- share&#xA;       |-- doc&#xA;       |   ... <only lame="lame">&#xA;       `-- man&#xA;           ... <only lame="lame">&#xA;</only></only></more>

    &#xA;&#xA;

    Other, possibly useful information about the build directory structure.

    &#xA;&#xA;

    me@MACHINE ~/programs/ffmpeg&#xA;$ tree --charset=ascii -L 1 .&#xA;.&#xA;|-- bin&#xA;|-- ffmpeg_build&#xA;`-- ffmpeg_sources&#xA;&#xA;3 directories, 0 files&#xA;

    &#xA;&#xA;

    For this next, ffmpeg_sources dir, I'm showing the after (which is both expected and real/exists) surrounded by double parentheses, i.e. double round brackets, (( <after> ))</after>.

    &#xA;&#xA;

       me@MACHINE ~/programs/ffmpeg&#xA;   $ tree --charset=ascii -L 1 ffmpeg_sources&#xA;   ffmpeg_sources&#xA;   |-- fdk-aac.zip&#xA;   |-- lame-svn&#xA;   |-- mstorsjo-fdk-aac-e7d8591&#xA;   |-- x264-snapshot-20191217-2245&#xA;   |-- x264-snapshot-20191217-2245.tar.bz2&#xA;   `-- x264-snapshot-20191218-README.txt&#xA;(( `-- x265                         ))&#xA;&#xA;   3 directories, 3 files&#xA;(( 4 directories, 3 files ))&#xA;

    &#xA;&#xA;


    &#xA;&#xA;

    NOW, FOR SOME MORE DETAIL

    &#xA;&#xA;


    &#xA;&#xA;

    What I'm Doing

    &#xA;&#xA;

    I am working on a Cygwin build (vs. a Windows/mingw build) of ffmpeg. I am following an older guide by koohiimaster (archived). That guide says,

    &#xA;&#xA;

    &#xA;

    [W]e are not cross-compiling for windows ; we are compiling for Cygwin.

    &#xA;

    &#xA;&#xA;

    This 2014 guide doesn't have all of the codecs I want - I want as complete a build as possible - so I've also been referring to this ffmpeg-for-Ubuntu guide (archived), which I hope is kept up-to-date. It's referred to by koohiimaster.

    &#xA;&#xA;

    Also, as a way of checking that I'm getting all the codecs I want, I've been looking at this FFmpeg for Windows guide from SuperUser

    &#xA;&#xA;

    I'll give the basics of my steps below. More details, as well as all the output is at pastebin.com/suL1nU6Z.

    &#xA;&#xA;

    A look at directory structure for the build

    &#xA;&#xA;

    me@MACHINE ~/programs/ffmpeg&#xA;$ cd $HOME/programs/ffmpeg&#xA;&#xA;me@MACHINE ~/programs/ffmpeg&#xA;$ tree --charset=ascii -d -L 1&#xA;.&#xA;|-- bin&#xA;|-- ffmpeg_build&#xA;`-- ffmpeg_sources&#xA;&#xA;3 directories&#xA;

    &#xA;&#xA;

    Getting the source. Note that I had to apt-cyg install mercurial, though (with my Cygwin setup GUI/EXE in my Cygwin root directory, i.e. C:\cygwin64\setup-x86_64.exe), I could also have done /setup-x86_64.exe install -q -P mercurial.

    &#xA;&#xA;

    cd ffmpeg_sources&#xA;hg clone https://bitbucket.org/multicoreware/x265&#xA;

    &#xA;&#xA;

    Running the cmake and make commands

    &#xA;&#xA;

    cd x265/build/linux&#xA;PATH="$HOME/programs/ffmpeg/bin:$PATH" \&#xA;  cmake -G "Unix Makefiles" \&#xA;        -DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg/ffmpeg_build" \&#xA;        -DENABLE_SHARED=OFF \&#xA;        -DCMAKE_EXE_LINKER_FLAGS="-static" \&#xA;            ../../source&#xA;PATH="$HOME/programs/ffmpeg/bin:$PATH" make -j $(nproc)&#xA;make install&#xA;

    &#xA;&#xA;

    It was the last part (actually the very last line) of the make install output that worried me. Here is the whole output - it's not very long.

    &#xA;&#xA;

    make[1]: Entering directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;make[2]: Entering directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;make[2]: Leaving directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;[ 20%] Built target encoder&#xA;make[2]: Entering directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;make[2]: Leaving directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;[ 83%] Built target common&#xA;make[2]: Entering directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;make[2]: Leaving directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;[ 84%] Built target x265-static&#xA;make[2]: Entering directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;make[2]: Leaving directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;[100%] Built target cli&#xA;make[1]: Leaving directory &#x27;/home/me/programs/ffmpeg/ffmpeg_sources/x265/build/linux&#x27;&#xA;Install the project...&#xA;-- Install configuration: "Release"&#xA;-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/lib/libx265.a&#xA;-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/include/x265.h&#xA;-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/include/x265_config.h&#xA;-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/lib/pkgconfig/x265.pc&#xA;-- Installing: /home/me/programs/ffmpeg/ffmpeg_build/bin/x265.exe&#xA;

    &#xA;&#xA;

    As discussed in the TL ;DR section, I expected to see x265.exe at

    &#xA;&#xA;

    home/me/programs/ffmpeg/bin/x265.exe

    &#xA;&#xA;

    rather than the path given on the last line of output,

    &#xA;&#xA;

    /home/me/programs/ffmpeg/ffmpeg_build/bin/x265.exe

    &#xA;&#xA;

    This worries me especially because the first part of the ffmpeg install command that my instructions inform me to run is

    &#xA;&#xA;

    PATH="$HOME/programs/ffmpeg/bin:$PATH" \&#xA;PKG_CONFIG_PATH="$HOME/programs/ffmpeg/ffmpeg_build/lib/pkgconfig" \&#xA;  ./configure \&#xA;    --prefix="$HOME/programs/ffmpeg/ffmpeg_build" \&#xA;    --extra-cflags="-I$HOME/programs/ffmpeg/ffmpeg_build/include" \&#xA;    --extra-ldflags="-L$HOME/programs/ffmpeg/ffmpeg_build/lib" \&#xA;    --bindir="$HOME/programs/ffmpeg/bin" \&#xA;

    &#xA;&#xA;

    ... and on it goes ...

    &#xA;&#xA;

    It would seem to me that the .configure script for ffmpeg won't find the x265 executable, since it's not in the bindir.

    &#xA;&#xA;

    I'll repeat my two-part question from before :

    &#xA;&#xA;

      &#xA;
    1. How can I change my cmake command so that my x265.exe file ends up in $HOME/programs/ffmpeg/bin with the proper linking, rather than $HOME/programs/ffmpeg/ffmpeg_build/bin ?
    2. &#xA;

    &#xA;&#xA;

    What I'm looking for here is something akin to the --bindir flag from make's ./confiure.

    &#xA;&#xA;

      &#xA;
    1. Would the build/linker/whatever figure things out for the ffmpeg build ?
    2. &#xA;

    &#xA;&#xA;

    I want to know the answer to question number 1 regardless of the answer to question number 2. I haven't used cmake with the -DVAR=var flags before, and I'd like to take this opportunity to learn.

    &#xA;&#xA;


    &#xA;&#xA;

    Where I've Looked & What I've Tried

    &#xA;&#xA;

    I first started with the man page and the --help for cmake. That was scary. I was hoping that I'd find something useful around the CMAKE_INSTALL_PREFIX stuff, but I wasn't sure what to make of it.

    &#xA;&#xA;

    I tried greping through cmake --help-full (with 50 lines before and after whatever I was searching for), but got tripped up by the complexity. I've only used basic cmake stuff, before, and I got more than a little lost.

    &#xA;&#xA;

    Even with the --help, I don't know if I need to look at the help-manual, the help-command, the help-module, the help-policy, the help-variable, or something else.

    &#xA;&#xA;

    It seemed to me, in reading, that a "binary directory" is the top of the "build", whereas I thought it would be the dir named bin ... I couldn't tell what things were meant to be used by the person creating the package rather than by me, who am trying to make/build the package from the command line.

    &#xA;&#xA;

    I looked through what seemed to be a cmake wiki's Useful Variables page (archived), as well as at this thread at cmake.org (archived), which, along with this SO source and this and this and this and this SO sources, seemed to suggest using the CMAKE_RUNTIME_OUTPUT_DIRECTORY variable (since the EXECUTABLE_OUTPUT-DIRECTORY variable has been superseded by it). By the way, I couldn't tell which things should be used by the creator of the package vs. the consumer of the package - the consumer being me. I tried with

    &#xA;&#xA;

    PATH="$HOME/programs/ffmpeg/bin:$PATH" \&#xA;  cmake -G "Unix Makefiles" \&#xA;        -DCMAKE_INSTALL_PREFIX="$HOME/programs/ffmpeg/ffmpeg_build" \&#xA;        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY="$HOME/programs/ffmpeg/bin" \&#xA;        -DENABLE_SHARED=OFF \&#xA;        -DCMAKE_EXE_LINKER_FLAGS="-static" &#xA;            ../../source&#xA;PATH="$HOME/&#xA;

    &#xA;&#xA;

    and have thought about fifty-or-so other -DVAR variables, but with any I have tried, I still get the same result. I still get the executable in what seems to be the wrong place.

    &#xA;&#xA;


    &#xA;&#xA;

    System Details

    &#xA;&#xA;

    $ date &amp;&amp; date &#x2B;&#x27;%s&#x27;&#xA;Tue, May  5, 2020 11:14:40 AM&#xA;1588698880&#xA;$ uname -a&#xA;CYGWIN_NT-10.0 MACHINE 3.1.4(0.340/5/3) 2020-02-19 08:49 x86_64 Cygwin&#xA;$ cmake --version&#xA;cmake version 3.14.5&#xA;&#xA;CMake suite maintained and supported by Kitware (kitware.com/cmake).&#xA;$ bash --version | head -n 1&#xA;GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)&#xA;$ gcc --version | head -n 1&#xA;gcc (GCC) 9.3.0&#xA;$ g&#x2B;&#x2B; --version | head -n 1&#xA;g&#x2B;&#x2B; (GCC) 9.3.0&#xA;$ make --version | head -n 2&#xA;GNU Make 4.3&#xA;Built for x86_64-pc-cygwin&#xA;

    &#xA;