Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (102)

  • 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 ;

  • 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

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (10904)

  • gcc : Undefined Reference Error

    16 mars 2014, par jamie_y

    I would like to use a function 'ff_load_image' defined in ffmpeg/libavfilter/lavfutils.h.

    program.c

    #include "../ffmpeg/libavfilter/lavfutils.h"

    int main ()
    {
     uint8_t* data;

     int linesize, width, height, log_ctx;

     int i = ff_load_image(&data, &linesize, &width, &height, AV_PIX_FMT_RGB24, "blue.jpg", &log_ctx);
    }

    Running

    gcc -I$HOME/ffmpeg/include program.c -L$HOME/ffmpeg/lib -lavfilter -lavcodec -lavutil

    gives undefined reference errors.

    program.c: In function \u2018main\u2019:
    program.c:9: warning: passing argument 1 of \u2018ff_load_image\u2019 from incompatible pointer type
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected \u2018uint8_t **\u2019 but argument is of type \u2018uint8_t *\u2019
    program.c:9: warning: passing argument 2 of \u2018ff_load_image\u2019 makes pointer from integer without a cast
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected \u2018int *\u2019 but argument is of type \u2018int\u2019
    program.c:9: warning: passing argument 3 of \u2018ff_load_image\u2019 makes pointer from integer without a cast
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected \u2018int *\u2019 but argument is of type \u2018int\u2019
    program.c:9: warning: passing argument 4 of \u2018ff_load_image\u2019 makes pointer from integer without a cast
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected \u2018int *\u2019 but argument is of type \u2018int\u2019
    program.c:9: warning: passing argument 5 of \u2018ff_load_image\u2019 makes pointer from integer without a cast
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected \u2018enum AVPixelFormat *\u2019 but argument is of type \u2018int\u2019
    program.c:9: warning: passing argument 7 of \u2018ff_load_image\u2019 makes pointer from integer without a cast
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected \u2018void *\u2019 but argument is of type \u2018int\u2019
    /home/jamiey/ffmpeg/lib/libavfilter.a(lavfutils.o): In function `ff_load_image':
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:38: undefined reference to `av_register_all'
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:40: undefined reference to `av_find_input_format'
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:41: undefined reference to `avformat_open_input'
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:66: undefined reference to `av_read_frame'
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:92: undefined reference to `avformat_close_input'
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:92: undefined reference to `avformat_close_input'
    /home/jamiey/ffmpeg/libavfilter/lavfutils.c:92: undefined reference to `avformat_close_input'
    /home/jamiey/ffmpeg/lib/libavcodec.a(frame_thread_encoder.o): In function `ff_frame_thread_encoder_free':
    /home/jamiey/ffmpeg/libavcodec/frame_thread_encoder.c:225: undefined reference to `pthread_join'
    /home/jamiey/ffmpeg/lib/libavcodec.a(frame_thread_encoder.o): In function `ff_frame_thread_encoder_init':
    /home/jamiey/ffmpeg/libavcodec/frame_thread_encoder.c:200: undefined reference to `pthread_create'
    /home/jamiey/ffmpeg/lib/libavcodec.a(pthread_frame.o): In function `ff_frame_thread_free':
    /home/jamiey/ffmpeg/libavcodec/pthread_frame.c:575: undefined reference to `pthread_join'
    /home/jamiey/ffmpeg/lib/libavcodec.a(pthread_frame.o): In function `ff_frame_thread_init':
    /home/jamiey/ffmpeg/libavcodec/pthread_frame.c:705: undefined reference to `pthread_create'
    /home/jamiey/ffmpeg/lib/libavcodec.a(pthread_slice.o): In function `ff_slice_thread_init':
    /home/jamiey/ffmpeg/libavcodec/pthread_slice.c:220: undefined reference to `pthread_create'
    /home/jamiey/ffmpeg/lib/libavcodec.a(pthread_slice.o): In function `ff_slice_thread_free':
    /home/jamiey/ffmpeg/libavcodec/pthread_slice.c:118: undefined reference to `pthread_join'
    /home/jamiey/ffmpeg/lib/libavutil.a(rational.o): In function `av_d2q':
    /home/jamiey/ffmpeg/libavutil/rational.c:115: undefined reference to `log'
    /home/jamiey/ffmpeg/libavutil/rational.c:118: undefined reference to `floor'
    /home/jamiey/ffmpeg/lib/libavutil.a(eval.o): In function `eval_expr':
    /home/jamiey/ffmpeg/libavutil/eval.c:183: undefined reference to `trunc'
    /home/jamiey/ffmpeg/libavutil/eval.c:182: undefined reference to `ceil'
    /home/jamiey/ffmpeg/libavutil/eval.c:181: undefined reference to `floor'
    /home/jamiey/ffmpeg/libavutil/eval.c:241: undefined reference to `pow'
    /home/jamiey/ffmpeg/libavutil/eval.c:177: undefined reference to `exp'
    /home/jamiey/ffmpeg/libavutil/eval.c:176: undefined reference to `exp'
    /home/jamiey/ffmpeg/libavutil/eval.c:287: undefined reference to `pow'
    /home/jamiey/ffmpeg/libavutil/eval.c:278: undefined reference to `floor'
    /home/jamiey/ffmpeg/lib/libavutil.a(eval.o): In function `av_strtod':
    /home/jamiey/ffmpeg/libavutil/eval.c:112: undefined reference to `pow'
    /home/jamiey/ffmpeg/libavutil/eval.c:103: undefined reference to `pow'
    /home/jamiey/ffmpeg/libavutil/eval.c:109: undefined reference to `pow'
    /home/jamiey/ffmpeg/lib/libavutil.a(eval.o): In function `parse_primary':
    /home/jamiey/ffmpeg/libavutil/eval.c:394: undefined reference to `sinh'
    /home/jamiey/ffmpeg/libavutil/eval.c:395: undefined reference to `cosh'
    /home/jamiey/ffmpeg/libavutil/eval.c:396: undefined reference to `tanh'
    /home/jamiey/ffmpeg/libavutil/eval.c:397: undefined reference to `sin'
    /home/jamiey/ffmpeg/libavutil/eval.c:398: undefined reference to `cos'
    /home/jamiey/ffmpeg/libavutil/eval.c:399: undefined reference to `tan'
    /home/jamiey/ffmpeg/libavutil/eval.c:400: undefined reference to `atan'
    /home/jamiey/ffmpeg/libavutil/eval.c:401: undefined reference to `asin'
    /home/jamiey/ffmpeg/libavutil/eval.c:402: undefined reference to `acos'
    /home/jamiey/ffmpeg/libavutil/eval.c:403: undefined reference to `exp'
    /home/jamiey/ffmpeg/libavutil/eval.c:404: undefined reference to `log'
    /home/jamiey/ffmpeg/libavutil/eval.c:405: undefined reference to `fabs'
    collect2: ld returned 1 exit status

    However, I was successful in running functions in other library, such as the ones in "ffmpeg/libavcodec/avcodec.h". Why is this happening to "ffmpeg/libavfilter/lavfutils.h" ?

  • mov : Don't export unknown/unhandled metadata types as if they were UTF8

    1er avril 2021, par Martin Storsjö
    mov : Don't export unknown/unhandled metadata types as if they were UTF8
    

    They can be other incompatible text encodings (such as UTF-16),
    or even binary data.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DH] libavformat/mov.c
  • ffmpeg : cannot save HLS stream to MKV

    15 juillet 2021, par MasterAler

    I am trying to achieve something straightforward : writing the code that captures a video stream and saves it into an *.mkv file "as-is" (yeah, no demuxing or reencoding or whatever). Just want to store those AVPacket-s and the MKV container looks ready for that.

    &#xA;

    Note that the question is about ffmpeg library usage, the ffmpeg binary works fine and can be used to save the HLS steam data via the following :
    &#xA;ffmpeg -i https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8 -c:v copy out.ts
    &#xA;I know that but the goal is to save any (or almost any) stream, thus the MKV. Actually, there is some code that already can save the streams' data, it fails specifically when trying it with HLS.

    &#xA;

    After some efforts to provide a short but readable MCVE, here's a sample code that reproduces the problem. The focus is on making the output codec work with HLS streams, thus it may lack a lot of things and details, like extra error checks, corner-cases, optimizations, proper timestamp handling, etc.

    &#xA;

    #include <atomic>&#xA;#include &#xA;#include <deque>&#xA;#include <functional>&#xA;#include <iostream>&#xA;#include <memory>&#xA;#include <mutex>&#xA;#include <thread>&#xA;&#xA;extern "C" {&#xA;#include "libavcodec/avcodec.h"&#xA;#include "libavfilter/avfilter.h"&#xA;#include "libavfilter/buffersink.h"&#xA;#include "libavfilter/buffersrc.h"&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavdevice></libavdevice>avdevice.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;}&#xA;&#xA;// Some public stream. The code works with RTSP, RTMP, MJPEG, etc.&#xA;// static const char SOURCE_NAME[] = "http://81.83.10.9:8001/mjpg/video.mjpg"; // works!&#xA;&#xA;// My goal was an actual cam streaming via HLS, but here are some random HLS streams&#xA;// that reproduce the problem quite well. Playlists may differ, but the error is exactly the same&#xA;static const char SOURCE_NAME[] = "http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"; // fails!&#xA;// static const char SOURCE_NAME[] = "https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"; // fails!&#xA;&#xA;using Pkt = std::unique_ptr;&#xA;std::deque<pkt> frame_buffer;&#xA;std::mutex frame_mtx;&#xA;std::condition_variable frame_cv;&#xA;std::atomic_bool keep_running{true};&#xA;&#xA;AVCodecParameters *common_codecpar = nullptr;&#xA;std::mutex codecpar_mtx;&#xA;std::condition_variable codecpar_cv;&#xA;&#xA;void read_frames_from_source(unsigned N)&#xA;{&#xA;    AVFormatContext *fmt_ctx = avformat_alloc_context();&#xA;&#xA;    int err = avformat_open_input(&amp;fmt_ctx, SOURCE_NAME, nullptr, nullptr);&#xA;    if (err &lt; 0) {&#xA;        std::cerr &lt;&lt; "cannot open input" &lt;&lt; std::endl;&#xA;        avformat_free_context(fmt_ctx);&#xA;        return;&#xA;    }&#xA;&#xA;    err = avformat_find_stream_info(fmt_ctx, nullptr);&#xA;    if (err &lt; 0) {&#xA;        std::cerr &lt;&lt; "cannot find stream info" &lt;&lt; std::endl;&#xA;        avformat_free_context(fmt_ctx);&#xA;        return;&#xA;    }&#xA;&#xA;    // Simply finding the first video stream, preferrably H.264. Others are ignored below&#xA;    int video_stream_id = -1;&#xA;    for (unsigned i = 0; i &lt; fmt_ctx->nb_streams; i&#x2B;&#x2B;) {&#xA;        auto *c = fmt_ctx->streams[i]->codecpar;&#xA;        if (c->codec_type == AVMEDIA_TYPE_VIDEO) {&#xA;            video_stream_id = i;&#xA;            if (c->codec_id == AV_CODEC_ID_H264)&#xA;                break;&#xA;        }&#xA;    }&#xA;&#xA;    if (video_stream_id &lt; 0) {&#xA;        std::cerr &lt;&lt; "failed to find find video stream" &lt;&lt; std::endl;&#xA;        avformat_free_context(fmt_ctx);&#xA;        return;&#xA;    }&#xA;&#xA;    {   // Here we have the codec params and can launch the writer&#xA;        std::lock_guard locker(codecpar_mtx);&#xA;        common_codecpar = fmt_ctx->streams[video_stream_id]->codecpar;&#xA;    }&#xA;    codecpar_cv.notify_all();&#xA;&#xA;    unsigned cnt = 0;&#xA;    while (&#x2B;&#x2B;cnt &lt;= N) { // we read some limited number of frames&#xA;        Pkt pkt{av_packet_alloc(), [](AVPacket *p) { av_packet_free(&amp;p); }};&#xA;&#xA;        err = av_read_frame(fmt_ctx, pkt.get());&#xA;        if (err &lt; 0) {&#xA;            std::cerr &lt;&lt; "read packet error" &lt;&lt; std::endl;&#xA;            continue;&#xA;        }&#xA;&#xA;        // That&#x27;s why the cycle above, we write only one video stream here&#xA;        if (pkt->stream_index != video_stream_id)&#xA;            continue;&#xA;&#xA;        {&#xA;            std::lock_guard locker(frame_mtx);&#xA;            frame_buffer.push_back(std::move(pkt));&#xA;        }&#xA;        frame_cv.notify_one();&#xA;    }&#xA;&#xA;    keep_running.store(false);&#xA;    avformat_free_context(fmt_ctx);&#xA;}&#xA;&#xA;void write_frames_into_file(std::string filepath)&#xA;{&#xA;    AVFormatContext *out_ctx = nullptr;&#xA;    int err = avformat_alloc_output_context2(&amp;out_ctx, nullptr, "matroska", filepath.c_str());&#xA;    if (err &lt; 0) {&#xA;        std::cerr &lt;&lt; "avformat_alloc_output_context2 failed" &lt;&lt; std::endl;&#xA;        return;&#xA;    }&#xA;&#xA;    AVStream *video_stream = avformat_new_stream(out_ctx, avcodec_find_encoder(common_codecpar->codec_id)); // the proper way&#xA;    // AVStream *video_stream = avformat_new_stream(out_ctx, avcodec_find_encoder(AV_CODEC_ID_H264)); // forcing the H.264&#xA;    // ------>> HERE IS THE TROUBLE, NO CODEC WORKS WITH HLS &lt;&lt;------&#xA;&#xA;    int video_stream_id = video_stream->index;&#xA;&#xA;    err = avcodec_parameters_copy(video_stream->codecpar, common_codecpar);&#xA;    if (err &lt; 0) {&#xA;        std::cerr &lt;&lt; "avcodec_parameters_copy failed" &lt;&lt; std::endl;&#xA;    }&#xA;&#xA;    if (!(out_ctx->flags &amp; AVFMT_NOFILE)) {&#xA;        err =  avio_open(&amp;out_ctx->pb, filepath.c_str(), AVIO_FLAG_WRITE);&#xA;        if (err &lt; 0) {&#xA;            std::cerr &lt;&lt; "avio_open fail" &lt;&lt; std::endl;&#xA;            return;&#xA;        }&#xA;    }&#xA;&#xA;    err = avformat_write_header(out_ctx, nullptr); // &lt;&lt;--- ERROR WITH HLS HERE&#xA;    if (err &lt; 0) {&#xA;        std::cerr &lt;&lt; "avformat_write_header failed" &lt;&lt; std::endl;&#xA;        return; // here we go with hls&#xA;    }&#xA;&#xA;    unsigned cnt = 0;&#xA;    while (true) {&#xA;        std::unique_lock locker(frame_mtx);&#xA;        frame_cv.wait(locker, [&amp;] { return !frame_buffer.empty() || !keep_running; });&#xA;&#xA;        if (!keep_running)&#xA;            break;&#xA;&#xA;        Pkt pkt = std::move(frame_buffer.front());&#xA;        frame_buffer.pop_front();&#xA;        &#x2B;&#x2B;cnt;&#xA;        locker.unlock();&#xA;&#xA;        pkt->stream_index = video_stream_id; // mandatory&#xA;        err = av_write_frame(out_ctx, pkt.get());&#xA;        if (err &lt; 0) {&#xA;            std::cerr &lt;&lt; "av_write_frame failed " &lt;&lt; cnt &lt;&lt; std::endl;&#xA;        } else if (cnt % 25 == 0) {&#xA;            std::cout &lt;&lt; cnt &lt;&lt; " OK" &lt;&lt; std::endl;&#xA;        }&#xA;    }&#xA;&#xA;    av_write_trailer(out_ctx);&#xA;    avformat_free_context(out_ctx);&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    std::thread reader(std::bind(&amp;read_frames_from_source, 1000));&#xA;    std::thread writer;&#xA;&#xA;    // Writer wont start until reader&#x27;s got AVCodecParameters&#xA;    // In this example it spares us from setting writer&#x27;s params properly manually&#xA;&#xA;    {   // Waiting for codec params to be set&#xA;        std::unique_lock locker(codecpar_mtx);&#xA;        codecpar_cv.wait(locker, [&amp;] { return common_codecpar != nullptr; });&#xA;        writer = std::thread(std::bind(&amp;write_frames_into_file, "out.mkv"));&#xA;    }&#xA;&#xA;    reader.join();&#xA;    keep_running.store(false);&#xA;    writer.join();&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;</pkt></thread></mutex></memory></iostream></functional></deque></atomic>

    &#xA;

    What happens here ? Simply put :

    &#xA;

      &#xA;
    1. Two threads are spawned, one reads packets from source and stores them in a buffer
    2. &#xA;

    3. The writer waits for the reader to get the AVCodecParameters, so that you can see they are the same being used, almost no manual param setting here
    4. &#xA;

    5. The reader is supposed to read N packets and finish, then the writer follows him. That's how it works with RTSP, RTMP, MJPEG, etc.
    6. &#xA;

    &#xA;

    What's the problem ? Once an HLS stream is tried, there goes the following error :

    &#xA;

    &#xA;

    Tag [27][0][0][0] incompatible with output codec id '27' (H264)

    &#xA;

    &#xA;

    After that the writer segfaults on any write attempt via it's context (that is avformat_write_header here) avformat_write_header fails with an error (see UPD2 below) and thus no successfull write operation is possible.

    &#xA;

    What's been tried :

    &#xA;

      &#xA;
    1. Forcing arbitrary codecs (ex. : AV_CODEC_ID_H264). No luck there.
    2. &#xA;

    3. Trying the AV_CODEC_ID_MPEGTS. No way, it's documented as a "fake" codec for internal needs.
    4. &#xA;

    5. Switching some of the multiple options for input or output contexts, no luck there
    6. &#xA;

    &#xA;

    I'm currenly confused a lot 'coz the error sounds like "Tag H264 is not compatible with codec H264". The ffmpeg logs look like the library managed to comprehend it's dealing with MPEG-TS being sent via HLS, reading is fine but writing into the chosen media container fails :

    &#xA;

    [hls @ 0x7f94b0000900] Opening &#x27;https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/540_1200000/hls/segment_0.ts&#x27; for reading&#xA;[hls @ 0x7f94b0000900] Opening &#x27;https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/540_1200000/hls/segment_1.ts&#x27; for reading&#xA;[hls @ 0x7f94b0000900] Opening &#x27;https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/720_2400000/hls/segment_0.ts&#x27; for reading&#xA;[hls @ 0x7f94b0000900] Opening &#x27;https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/720_2400000/hls/segment_1.ts&#x27; for reading&#xA;[hls @ 0x7f94b0000900] Opening &#x27;https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_0.ts&#x27; for reading&#xA;[hls @ 0x7f94b0000900] Opening &#x27;https://bitdash-a.akamaihd.net/content/MI201109210084_1/video/1080_4800000/hls/segment_1.ts&#x27; for reading&#xA;[hls @ 0x7f94b0000900] Could not find codec parameters for stream 0 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, 112 kb/s): unspecified sample rate&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options&#xA;[matroska @ 0x7f94a8000900] Tag [27][0][0][0] incompatible with output codec id &#x27;27&#x27; (H264)&#xA;avformat_write_header failed&#xA;Segmentation fault (core dumped)&#xA;

    &#xA;

    No hard googling helped, I'm a bit desperate.
    &#xA;Plz, share your ideas, would be grateful for any.

    &#xA;

    UPD

    &#xA;

      &#xA;
    • ffmpeg -i https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8 out.mkv works fine
    • &#xA;

    • ffmpeg -i http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8 -c:v copy out.mkv also works fine
    • &#xA;

    &#xA;

    ... which means ffmpeg can do the trick and the desired result can be achieved

    &#xA;

    UPD2

    &#xA;

    It occured that the tag error can be suppressed via
    &#xA;out_ctx->strict_std_compliance = FF_COMPLIANCE_UNOFFICIAL;
    &#xA;I assume it's smth about spelling the "h264" properly in a string tag, doesn't look serious.

    &#xA;

    Also, after a closer look it occured that it's av_write_frame that actually segfaults. No wonder — with HLS streams avformat_write_header fails and returns error :

    &#xA;

    &#xA;

    Invalid data found when processing input

    &#xA;

    &#xA;

    That still leaves me with no clues, where's the problem here =((

    &#xA;