Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (36)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (4936)

  • String input in .bat script for ffmpeg encoder

    27 janvier 2016, par Ѕвонко Петровски

    Okay, I have this script which does batch encoding in ffmpeg. It basically calls upon ffmpeg for every file. What I want to do is to make the script ask for input and output locations before it starts executing.

    Here is the original script :

    for %%a in ("*.mp4") do "G:\ffmpeg\bin\ffmpeg" -i "%%a" -c:v libx264 -preset slow -crf 20 -maxrate 15000k -bufsize 2000k -acodec copy "newfiles\%%~na.mp4"

    Now I’d like to be able to input a string with a location for the files in he first brackets ("*.mp4") and at the end for "newfiles\%% na.mp4".

    I would presume that %% na is used to generate number orders or something but I’m not completely sure.

    I would presume that two variables/strings need to be created and then utilized by reading from keyboard. Sadly I have absolutely no experience with this. Did some c++ in school but that was that.

    Thanks in advance.

  • PHP upload video files to database

    13 janvier 2016, par Mick Jack

    I am working on a school project that let users upload video files to a server. Server will compress the video using ffmpeg and store the file in upload folder. Other users will be able to stream the uploaded videos.

    My question is how do i retrieve the video that ffmpeg generated and store the link in the database ?

    i am using this code but it only retrieve path of the original video.

    $filePath = dirname(__FILE__);

    partial code of Upload.php

    $target_dir = "upload/"; //where you want to upload the files to
    $target_file = $target_dir.basename($_FILES['file']['name']);
    $fileType = pathinfo($target_file, PATHINFO_EXTENSION);
    $newFileName = $target_dir.sha1(pathinfo(basename($_FILES['file']['name']), PATHINFO_FILENAME)).'-'.time().'.'.$fileType;
    move_uploaded_file($_FILES['file']['tmp_name'], $newFileName);
    $unique_id = rand(1000000,9999999);

    shell_exec("C:\\ffmpeg\\bin\\ffmpeg.exe -i ".$newFileName." -vcodec libx264 -crf 20 \"upload\\{$newFileName}\" > logfile.txt 2>&1");

    /// save information into database
                   $username = "root";
                   $password = "";
                   $hostname = "localhost";
                   $dbname = "test_database";

                   //connect to the database
                   $dbc = mysqli_connect($hostname, $username, $password, $dbname) or die ("could not connect to the database");

                   //execute the SQL query and return records
                    $result = mysqli_query($dbc, "INSERT INTO `viewvideo` (`vID`, 'video_id`, `video_link`) VALUES ('', '".$unique_id."', '".$newFileName."')");

                   if(!$result){echo mysqli_error($dbc); }

                   echo $result;

               /*  
                   declare in the order variable
                   $result = mysqli_query($dbc, $sql); //order executes
                   if($result){
                       echo("<br />Input data is succeed");
                   } else{
                       echo("<br />Input data is fail");
                   }
               */  

                   //close the connection
                   mysqli_close($dbc);

    output
    enter image description here

  • ffmpeg GRAY16 stream over network

    28 novembre 2023, par Norbert P.

    Im working in a school project where we need to use depth cameras. The camera produces color and depth (in other words 16bit grayscale image). We decided to use ffmpeg, as later on compression could be very useful. For now we got some basic stream running form one PC to other. These settings include :

    &#xA;

      &#xA;
    • rtmp
    • &#xA;

    • flv as container
    • &#xA;

    • pixel format AV_PIX_FMT_YUV420P
    • &#xA;

    • codec AV_CODEC_ID_H264
    • &#xA;

    &#xA;

    The problem we are having is with grayscale image. Not every codec is able to cope with this format, so as not every protocol able to work with given codec. I got some settings "working" but receiver side is just stuck on avformat_open_input() method.&#xA;I have also tested it with commandline where ffmpeg is listening for connection and same happens.

    &#xA;

    I include a minimum "working" example of client code. Server can be tested with "ffmpeg.exe -f apng -listen 1 -i rtmp ://localhost:9999/stream/stream1 -c copy -f apng -listen 1 rtmp ://localhost:2222/live/l" or code below. I get no warnings, ffmpeg is newest version installed with "vcpkg install —triplet x64-windows ffmpeg[ffmpeg,ffprobe,zlib]" on windows or packet manager on linux.

    &#xA;

    The question : Did I miss something ? How do I get it to work ? If you have any better ideas I would very gladly consider them. In the end I need 16 bits of lossless transmission, could be split between channels etc. which I also tried with same effect.

    &#xA;

    Client code that would have camera and connect to server :

    &#xA;

    extern "C" {&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>channel_layout.h>&#xA;#include <libavutil></libavutil>common.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;}&#xA;&#xA;int main() {&#xA;&#xA;    std::string container = "apng";&#xA;    AVCodecID codec_id = AV_CODEC_ID_APNG;&#xA;    AVPixelFormat pixFormat = AV_PIX_FMT_GRAY16BE;&#xA;&#xA;    AVFormatContext* format_ctx;&#xA;    AVCodec* out_codec;&#xA;    AVStream* out_stream;&#xA;    AVCodecContext* out_codec_ctx;&#xA;    AVFrame* frame;&#xA;    uint8_t* data;&#xA;&#xA;    std::string server = "rtmp://localhost:9999/stream/stream1";&#xA;&#xA;    int width = 1280, height = 720, fps = 30, bitrate = 1000000;&#xA;&#xA;    //initialize format context for output with flv and no filename&#xA;    avformat_alloc_output_context2(&amp;format_ctx, nullptr, container.c_str(), server.c_str());&#xA;    if (!format_ctx) {&#xA;        return 1;&#xA;    }&#xA;&#xA;    //AVIOContext for accessing the resource indicated by url&#xA;    if (!(format_ctx->oformat->flags &amp; AVFMT_NOFILE)) {&#xA;        int avopen_ret = avio_open(&amp;format_ctx->pb, server.c_str(),&#xA;            AVIO_FLAG_WRITE);// , nullptr, nullptr);&#xA;        if (avopen_ret &lt; 0) {&#xA;            fprintf(stderr, "failed to open stream output context, stream will not work\n");&#xA;            return 1;&#xA;        }&#xA;    }&#xA;&#xA;&#xA;    const AVCodec* tmp_out_codec = avcodec_find_encoder(codec_id);&#xA;    //const AVCodec* tmp_out_codec = avcodec_find_encoder_by_name("hevc");&#xA;    out_codec = const_cast(tmp_out_codec);&#xA;    if (!(out_codec)) {&#xA;        fprintf(stderr, "Could not find encoder for &#x27;%s&#x27;\n",&#xA;            avcodec_get_name(codec_id));&#xA;&#xA;        return 1;&#xA;    }&#xA;&#xA;    out_stream = avformat_new_stream(format_ctx, out_codec);&#xA;    if (!out_stream) {&#xA;        fprintf(stderr, "Could not allocate stream\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    out_codec_ctx = avcodec_alloc_context3(out_codec);&#xA;&#xA;    const AVRational timebase = { 60000, fps };&#xA;    const AVRational dst_fps = { fps, 1 };&#xA;    av_log_set_level(AV_LOG_VERBOSE);&#xA;    //codec_ctx->codec_tag = 0;&#xA;    //codec_ctx->codec_id = codec_id;&#xA;    out_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    out_codec_ctx->width = width;&#xA;    out_codec_ctx->height = height;&#xA;    out_codec_ctx->gop_size = 1;&#xA;    out_codec_ctx->time_base = timebase;&#xA;    out_codec_ctx->pix_fmt = pixFormat;&#xA;    out_codec_ctx->framerate = dst_fps;&#xA;    out_codec_ctx->time_base = av_inv_q(dst_fps);&#xA;    out_codec_ctx->bit_rate = bitrate;&#xA;    //if (fctx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;    //{&#xA;    //    codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;    //}&#xA;&#xA;    out_stream->time_base = out_codec_ctx->time_base; //will be set afterwards by avformat_write_header to 1/1000&#xA;&#xA;    int ret = avcodec_parameters_from_context(out_stream->codecpar, out_codec_ctx);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        fprintf(stderr, "Could not initialize stream codec parameters!\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVDictionary* codec_options = nullptr;&#xA;    av_dict_set(&amp;codec_options, "tune", "zerolatency", 0);&#xA;&#xA;    // open video encoder&#xA;    ret = avcodec_open2(out_codec_ctx, out_codec, &amp;codec_options);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        fprintf(stderr, "Could not open video encoder!\n");&#xA;        return 1;&#xA;    }&#xA;    av_dict_free(&amp;codec_options);&#xA;&#xA;    out_stream->codecpar->extradata_size = out_codec_ctx->extradata_size;&#xA;    out_stream->codecpar->extradata = static_cast(av_mallocz(out_codec_ctx->extradata_size));&#xA;    memcpy(out_stream->codecpar->extradata, out_codec_ctx->extradata, out_codec_ctx->extradata_size);&#xA;&#xA;    av_dump_format(format_ctx, 0, server.c_str(), 1);&#xA;&#xA;    frame = av_frame_alloc();&#xA;&#xA;    int sz = av_image_get_buffer_size(pixFormat, width, height, 32);&#xA;#ifdef _WIN32&#xA;    data = (uint8_t*)_aligned_malloc(sz, 32);&#xA;    if (data == NULL)&#xA;        return ENOMEM;&#xA;#else&#xA;    ret = posix_memalign(reinterpret_cast(&amp;data), 32, sz);&#xA;#endif&#xA;    av_image_fill_arrays(frame->data, frame->linesize, data, pixFormat, width, height, 32);&#xA;    frame->format = pixFormat;&#xA;    frame->width = width;&#xA;    frame->height = height;&#xA;    frame->pts = 1;&#xA;    if (avformat_write_header(format_ctx, nullptr) &lt; 0) //Header making problems!!!&#xA;    {&#xA;        fprintf(stderr, "Could not write header!\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    printf("stream time base = %d / %d \n", out_stream->time_base.num, out_stream->time_base.den);&#xA;&#xA;    double inv_stream_timebase = (double)out_stream->time_base.den / (double)out_stream->time_base.num;&#xA;    printf("Init OK\n");&#xA;    /*  Init phase end*/&#xA;    int dts = 0;&#xA;    int frameNo = 0;&#xA;&#xA;    while (true) {&#xA;        //Fill dummy frame with something&#xA;        for (int y = 0; y &lt; height; y&#x2B;&#x2B;) {&#xA;            uint16_t color = ((y &#x2B; frameNo) * 256) % (256 * 256);&#xA;            for (int x = 0; x &lt; width; x&#x2B;&#x2B;) {&#xA;                data[x&#x2B;y*width] = color;&#xA;            }&#xA;        }&#xA;&#xA;        memcpy(frame->data[0], data, 1280 * 720 * sizeof(uint16_t));&#xA;        AVPacket* pkt = av_packet_alloc();&#xA;&#xA;        int ret = avcodec_send_frame(out_codec_ctx, frame);&#xA;        if (ret &lt; 0)&#xA;        {&#xA;            fprintf(stderr, "Error sending frame to codec context!\n");&#xA;            return ret;&#xA;        }&#xA;        while (ret >= 0) {&#xA;            ret = avcodec_receive_packet(out_codec_ctx, pkt);&#xA;            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                break;&#xA;            else if (ret &lt; 0) {&#xA;                fprintf(stderr, "Error during encoding\n");&#xA;                break;&#xA;            }&#xA;            pkt->dts = dts;&#xA;            pkt->pts = dts;&#xA;            dts &#x2B;= 33;&#xA;            av_write_frame(format_ctx, pkt);&#xA;            frameNo&#x2B;&#x2B;;&#xA;            av_packet_unref(pkt);&#xA;        }&#xA;        printf("Streamed %d frames\n", frameNo);&#xA;    }&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    And part of server that should receive. code where is stops and waits

    &#xA;

    extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavformat></libavformat>avio.h>&#xA;}&#xA;&#xA;int main() {&#xA;    AVFormatContext* fmt_ctx = NULL;&#xA;    av_log_set_level(AV_LOG_VERBOSE);&#xA;    AVDictionary* options = nullptr;&#xA;    av_dict_set(&amp;options, "protocol_whitelist", "file,udp,rtp,tcp,rtmp,rtsp,hls", 0);&#xA;    av_dict_set(&amp;options, "timeout", "500000", 0); // Timeout in microseconds &#xA;&#xA;//Next Line hangs   &#xA;    int ret = avformat_open_input(&amp;fmt_ctx, "rtmp://localhost:9999/stream/stream1", NULL, &amp;options);&#xA;    if (ret != 0) {&#xA;        fprintf(stderr, "Could not open RTMP stream\n");&#xA;        return -1;&#xA;    }&#xA;&#xA;    // Find the first video stream&#xA;    ret = avformat_find_stream_info(fmt_ctx, nullptr);&#xA;    if (ret &lt; 0) {&#xA;        return ret;&#xA;    }&#xA;    //...&#xA;} &#xA;&#xA;

    &#xA;

    Edit :&#xA;I tried to just create a animated png and tried to stream that from the console to another console window to avoid any programming mistakes on my side. It was the same, I just could not get 16 PNG encoded stream to work. I hung trying to receive and closed when the file ended with in total zero frames received.

    &#xA;

    I managed to get other thing working :&#xA;To not encode gray frames with YUV420, I installed ffmpeg with libx264 support (was thinking is the same as H264, which in code is, but it adds support to new pixel formats). Used H264 again but with GRAY8 with doubled image width and reconstructing the image on the other side.

    &#xA;

    Maybe as a side note, I could not get any other formats to work. Is "flv" the only option here ? Could I get more performance if I changed it to... what ?

    &#xA;