Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (76)

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

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (7724)

  • How to get correct sample_aspect_ratio and display_aspect_ratio when exporting AVI file to fragmented mp4 using javacv

    28 mai 2021, par Thomas

    I have an AVI movie file (h264 encoded) that I would like to export to a fragmented MP4 file using JavaCV. This movie file has a display aspect ratio that is different from the sample aspect ratio as can be seen from the output of the ffprobe command :

    


    


    ffprobe -show_streams bureau.avi

    


    


    which results in (partial results shown for brevity)

    


    .
. 
 Duration: 00:00:31.00, start: 0.000000, bitrate: 1014 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 720x576 [SAR 4320:3037 DAR 5400:3037], 1010 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
.
.
sample_aspect_ratio=4320:3037
display_aspect_ratio=5400:3037
.
.


    


    When converting this video file using the ffmpeg command

    


    


    ffmpeg -i bureau.avi -vf scale='trunc(ih*dar):ih',setsar=1/1 -frag_duration 1 -movflags empty_moov+default_base_moof+frag_keyframe bureau_scaled_fragmented.mp4

    


    


    the ffprobe results of the mp4 file are (partial output for brevity)

    


    .
.
Duration: 00:00:31.00, start: 0.000000, bitrate: 416 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 414 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
.
.
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
.
.


    


    When playing this video file with VLC, the aspect ratio of the video is correct.

    


    I would like to be able to get the same result by using the JavaCV library (currently using version 1.5.5, but was not succesfull with the following small Java program where I tried using an FfmpegFrameFilter to scale each frame as it is being grabbed. The program does result in an mp4 file being generated but the aspect ratio of the video is incorrect when playing it with e.g. VLC. The result of the ffprobe command also show that the SAR and DAR are missing :

    


      Duration: 00:00:31.00, start: 0.000000, bitrate: 383 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 720x576, 357 kb/s, 25 fps, 25 tbr, 12800 tbn, 25600 tbc (default)
.
.
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
.
.


    


    Is is possible to use such a frame filter (or by any other means) to scale the video so the resulting sample_aspect_ratio and display_aspect_ratio are the same as when using the ffmpeg command ?

    


    The Java program being used.

    


    import org.bytedeco.ffmpeg.global.avcodec;
import org.bytedeco.javacv.FFmpegFrameFilter;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.Frame;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class App {


    public static void main(String[] args) throws IOException {
        File file = new File("/Users/werk/projects/video/bureau.avi");
        FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(file.getAbsolutePath());
        String fileName = null;
        Frame captured_frame = null;
        FFmpegFrameRecorder recorder = null;

        try {
            frameGrabber.start();
            fileName = file.getAbsolutePath().replace(".avi", "_edited.mp4");
            recorder = new FFmpegFrameRecorder(fileName, frameGrabber.getImageWidth(), frameGrabber.getImageHeight(), frameGrabber.getAudioChannels());
            recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
            recorder.setVideoCodecName("avc");
            recorder.setFormat("mp4");
            // enable fragmented mp4 generation
            Map options = new HashMap<>();
            options.put("frag_duration", "1");
            options.put("movflags", "empty_moov+default_base_moof+frag_keyframe");
            recorder.setOptions(options);

            recorder.setFrameRate(frameGrabber.getFrameRate());

            FFmpegFrameFilter filter = new FFmpegFrameFilter("scale='trunc(ih*dar):ih',setsar=1/1", frameGrabber.getImageWidth(), frameGrabber.getImageHeight());
            filter.start();

            recorder.start();
            while (true) {
                try {
                    captured_frame = frameGrabber.grabFrame();

                    if (captured_frame == null) {
                        break;
                    }

                    filter.push(captured_frame);
                    Frame scaledFrame = filter.pull();
                    recorder.record(scaledFrame);

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            recorder.stop();
            recorder.release();
            frameGrabber.stop();
            filter.stop();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


    


  • What would be the correct way to use Exec or Transcode ffmpeg in SRS version of Windows 5.0.128

    29 janvier 2023, par diegosn79

    i was doing tests in different ways, and i can't use the Exec or Transcode option, i highlight that I have copied the ffmpeg.exe in the objs folder.
These are the codes I tried, and I attach the log errors.

    


    exec {

enabled on;

publish ./objs/ffmpeg.exe -rtbufsize 10M -i rtmp://10.1.9.240/live/encoder  -vf scale=1080:720 -c:v libx264 -profile:v high -level 4.2 -preset fast -b:v 1500k -c:a aac -ac 2 -b:a 96k -f flv -y rtmp://10.1.9.240:1935/live/encoderlow/;

}


    


    LOGS

    


    [2023-01-04 10:05:46.410][WARN][1309][01568ctu][11] EXEC : Ignore error, code=3028(FFmpegFork)(Failed to fork FFmpeg trancoder process) :
process start : vfork process failed, cli=./objs/ffmpeg.exe -rtbufsize 10M -i rtmp ://10.1.9.240/live/encoder -vf scale=1080:720 -c:v libx264 -profile:v high -level 4.2 -preset fast -b:v 1500k -c:a aac -ac 2 -b:a 96k -f flv -y rtmp ://10.1.9.240:1935/live/encoderlow/
thread [1309][01568ctu] : do_cycle() [./src/app/srs_app_ng_exec.cpp:108][errno=11]
thread [1309][01568ctu] : start() [./src/app/srs_app_process.cpp:197][errno=11]

    


    transcode

    


        enabled     on;

    ffmpeg      ./objs/ffmpeg.exe;

    engine ff {

        enabled         on;

        vfilter {

        }

        vcodec          libx264;

        vthreads        4;

        vprofile        high;

        vpreset         fast;

        vbitrate        1500k;

        vparams {

        }

        acodec          libfdk_aac;

        aparams {

        }

        output          rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];

    }

}


    


    LOGS

    


    [2023-01-04 11:04:45.295][WARN][1489][34r32764][11] Encoder : Ignore error, code=3028(FFmpegFork)(Failed to fork FFmpeg trancoder process) : ffmpeg start : vfork process failed, cli=./objs/ffmpeg.exe -f flv -i rtmp ://127.0.0.1:1935/live ?vhost=defaultVhost/encoder -vcodec libx264 -b:v 1500000 -threads 4 -profile:v high -preset fast -acodec libfdk_aac -f flv -y rtmp ://127.0.0.1:1935/live/encoder_ff ?vhost=defaultVhost 1 > ./objs/ffmpeg-encoder-defaultVhost-live-encoder-ff.log 2 > ./objs/ffmpeg-encoder-defaultVhost-live-encoder-ff.log
thread [1489][34r32764] : do_cycle() [./src/app/srs_app_encoder.cpp:117][errno=11]
thread [1489][34r32764] : start() [./src/app/srs_app_process.cpp:197][errno=11]

    


  • ffmpeg not adding correct timestamps in recorded files [closed]

    27 avril 2023, par Aman Hanjra

    I am using ffmpeg to record a camera stream using rtsp protocol. I am creating 10 second files by setting output_ts_offset to epoch realtime.
ffmpeg command :
ffmpeg -hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://camera_ip:camera_port/stream_url -muxpreload 0 -muxdelay 0 -c:v copy -an -f segment -strftime 1 -segment_time 10 -output_ts_offset $EPOCHREALTIME -segment_atclocktime 1 -segment_clocktime_offset 30 -segment_format mp4 file_%s_10.mp4

    


    Each file is saved with offset - start_time as epoch timestamp(current timestamp when ffmpeg pipeline starts and keep on adding 10 seconds as it creates 10 second files) and adding the same timestamp in file name also. eg file_1669903600_10.mp4
FPS is 15.
ffprobe output :

    


    start_time=1669903599.93233
duration=10.106771
[/STREAM]
[FORMAT]
filename=file_1669903600_10.mp4
[/FORMAT]

[STREAM]
start_time=**1669903605.53452**
duration=10.106771
[/STREAM]
[FORMAT]
filename=file_**1669903610**_10.mp4
[/FORMAT]


    


    In second example, there is difference of 5 seconds in start_time and filename which is incorrect.
Similarily sometimes there are differences upto 50000 seconds in timestamps.

    


    Files are being saved with start_time metadata either in past or future. Anyone faced the same issue with ffmpeg ?

    


    Sometimes I am getting files with 76ms duration and then this timestamp diff(start_time - filename timestamp) starts increasing negatively by 10 and goes up to -47270(in past) or sometimes it goes in future.

    


    Tried fixing the fps to 15(-r 15 argument) but didn't work.

    


    Expected output :
Timestamps should match(start_time timestamp should be equal to filename timestamp)