Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (82)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

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

Sur d’autres sites (7112)

  • FFmpeg : Copy 'location' metadata to output file name

    11 avril 2023, par Kristian

    I have a FFmpeg batch script for downscaling all videos in a directory. The videos have been recorded in different forests, and I would like to write the geolocation as the output file name.

    


    Currenly, my script is

    


    FOR /F "tokens=*" %G IN ('dir /b *.MP4') DO "c:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "%G"  -vf "scale=trunc(iw/10)*2:trunc(ih/10)*2" -vcodec libx265 -crf 20 "%~nG_komprimeret.mp4"


    


    When I look at the file's metadata, I can see the location

    


    Output #0, mp4, to 'GH013764_komprimeret.mp4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : HD7.01.01.90.00
    location        : +56.1710+009.5756/
    location-eng    : +56.1710+009.5756/


    


    My files output should be named something like GH013764_komprimeret_+56.1710+009.5756.mp4.

    


    How is it possible to include the location metadata in the output file name ?

    


  • Access violation reading location when opening avfromat_open_input

    28 mai 2023, par nokla

    I am trying to build a function for reading a video from .mp4 file using ffmpeg and c++.

    


    This function was already working on one computer but when I copied the code to another one, with the same environment it returned the following error :

    


    Exception thrown at 0x00007FFC81B7667C (avutil-57.dll)
in VideoEditor.exe: 0xC0000005: Access violation 
reading location 0x0000000000000000.


    


    If anyone has ever encountered such an issue or have any idea how to solve it please share.

    



    


    This is the function :

    


    void VideoSource::ReadSource()
{
    auto lock = this->LockSource();
    std::vector> newSource;

    // Open the file using libavformat
    AVFormatContext* av_format_ctx = avformat_alloc_context();
    if (!av_format_ctx) {
        //wxMessageBox("Couldn't create AVFormatContext\n");
        read = false;
        return;
    }
    if (avformat_open_input(&av_format_ctx, path.c_str(), NULL, NULL) != 0) { // error here
        //wxMessageBox("Couldn't open video file\n");
        read = false;
        return;
    }

    // Find the first valid video stream inside the file
    int video_stream_index = -1;
    AVCodecParameters* av_codec_params = NULL;
    const AVCodec* av_codec = NULL;
    for (uint i = 0; i < av_format_ctx->nb_streams; i)
    {
        av_codec_params = av_format_ctx->streams[i]->codecpar;
        av_codec = avcodec_find_decoder(av_codec_params->codec_id);

        if (!av_codec) {
            continue;
        }
        if (av_codec_params->codec_type == AVMEDIA_TYPE_VIDEO) {
            video_stream_index = i;
            break;
        }
    }

    if (video_stream_index == -1) {
        //wxMessageBox("Couldn't find valid video stream inside file\n");
        read = false;
        return;
    }

    // Set up a codec context for the decoder
    AVCodecContext* av_codec_ctx = avcodec_alloc_context3(av_codec);
    if (!av_codec_ctx) {
        //wxMessageBox("Couldn't create AVCpdecContext\n");
        read = false;
        return;
    }

    if (avcodec_parameters_to_context(av_codec_ctx, av_codec_params) < 0)
    {
        //wxMessageBox("Couldn't initialize AVCodecContext\n");
        read = false;
        return;
    }
    if (avcodec_open2(av_codec_ctx, av_codec, NULL) < 0) {
        //wxMessageBox("Couldn't open codec\n");

        read = false;
        return;
    }

    AVFrame* av_frame = av_frame_alloc();
    if (!av_frame) {
        //wxMessageBox("Couldn't allocate AVFrame\n");

        read = false;
        return;
    }
    AVPacket* av_packet = av_packet_alloc();
    if (!av_packet) {
        //wxMessageBox("Couldn't allocate AVPacket\n");

        read = false;
        return;
    }
    int response;
    int counter = 0;
    while (av_read_frame(av_format_ctx, av_packet) >= 0 && counter < 100000) {
        if (av_packet->stream_index != video_stream_index) {
            av_packet_unref(av_packet);
            continue;
        }
        response = avcodec_send_packet(av_codec_ctx, av_packet);
        if (response < 0) {
            //wxMessageBox("Failed to decode packet: %s\n", av_err2str(response));

            read = false;
            return;
        }
        response = avcodec_receive_frame(av_codec_ctx, av_frame);
        if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
            av_packet_unref(av_packet);
            continue;
        }
        else if (response < 0) {
            //wxMessageBox("Failed to decode frame: %s\n", av_err2str(response));

            read = false;
            return;
        }
        counter++;
        av_packet_unref(av_packet);

        av_packet = av_packet_alloc();

        response = avcodec_send_frame(av_codec_ctx, av_frame);
        std::string tmp = av_err2str(response);
        //source.push_back(*av_frame);
        //auto mat_frame = Avframe2Cvmat(av_frame);

        //source.push_back(im);
        //bool isEqual = (cv::sum(Avframe2Cvmat(av_frame) != Avframe2Cvmat(&source[0])) == cv::Scalar(0, 0, 0, 0));
        //bool isEqual = (cv::sum(im != source[0]) == cv::Scalar(0, 0, 0, 0));
        //im.release();
        newSource.push_back(SyncObject(av_frame_clone(av_frame)));

        /*
        if (int iRet = av_frame_copy(&source.back(), av_frame) == 0) {
            av_log(NULL, AV_LOG_INFO, "Ok");
        }
        else {
            av_log(NULL, AV_LOG_INFO, "Error: %s\n", av_err2str(iRet));
        }*/
        av_frame_unref(av_frame);
    }


    avformat_close_input(&av_format_ctx);
    avformat_free_context(av_format_ctx);
    av_frame_free(&av_frame);
    av_packet_free(&av_packet);
    avcodec_free_context(&av_codec_ctx);
    //this->LockSource();
    source_.swap(newSource);
}


    


    This function is inside A class and those are its memebers :

    


        bool created;
    bool read;
    std::string path; // THE PATH TO THE FILE
    std::vector> source_; // vector containing all of the video frames


    


    This is what I get in Call Stack

    


    This is what I get in the debugger when the error accures :

    


    [![Debugger values][1]][1]


    


  • How can I get the location of my screenshot made from video with ffmpeg in Node.js ?

    17 juin 2023, par Terry Windwalker

    This is how I did it.

    


    const ffmpegPath = require('@ffmpeg-installer/ffmpeg');
import ffmpeg from 'fluent-ffmpeg';
import path from 'path';
const os = require('os');
ffmpeg.setFfmpegPath(ffmpegPath.path);


export const generateThumbnailFromVideo = async (mp4Buffer) => {
    console.log('generateThumbnailFromVideo is triggered');
    const timePosition = '00:00:00.500';
    const filename = `temp/temp-${new Date().getTime()}.png`;
    return new Promise((resolve, reject) => {
        ffmpeg({
            source: bufferToStream(mp4Buffer)
        })
        .on('error', (err) => {
            console.error('An error occurred: ' + err.message);
            reject(err);
        })
        .on('end', () => {
            console.log('Thumbnail generated successfully');
            fs.readFile(filename, (err, data) => {
                if (err) {
                    console.error('An error occurred while reading the thumbnail file:', err);
                    reject(err);
                    return;
                }
                fs.unlink(filename);
                uploadBuffer(data, filename, data.length)
            })
            resolve(filename);
        })
        .screenshots({
            timestamps: [timePosition],
            filename: filename,
            folder: 'temp/',
            size: '320x240',
        });
    });
}


    


    And this is the log came up.

    


    generateThumbnailFromVideo is triggered
Thumbnail generated successfully
createProjectMedia is triggered
userId:  1
projectId:  25
mediaArray:  [
  {
    mediaUrl: 'medias/1/1686843801535/medias_1_1684753043519_1_(1)_(4)_(1).mp4',
    thumbnailUrl: 'medias/1/1686843801535/medias_1_1684753043519_1_(1)_(4)_(1)_thumbnail.jpg',
    mediaType: 2
  }
]
An error occurred while reading the thumbnail file: [Error: ENOENT: no such file or directory, open 'temp/temp-1686843802255.png'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'temp/temp-1686843802255.png'
}


    


    It claims the screenshot has been created but I cannot find it anywhere. Tried absolute route with __dirname and os.tmpdir() with no luck. The screenshot it claimed has been created are not there.

    


    Can somebody help me out ? I have been stuck here for 5 hours with no progress so far.

    


    Also, I have checked the file temp in the root directory of the repo. It is empty.

    


    UPDATE : Checked and can confirm that the router used in the key "folder" (temp/) is correct, since deleting that folder will trigger an error saying that the folder is not found. Creating the folder again will remove this error. But even though the "generated successfully" log is printed, the image is not saved in that folder, and the folder is still empty after that log is printed.

    


    That fs.unlink is also unrelated. Removing it won't cause any change.