Recherche avancée

Médias (0)

Mot : - Tags -/organisation

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

Autres articles (101)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (7361)

  • What is the best way to split videos into equally sized parts using ffmpeg ? [closed]

    18 juin 2024, par GBPU

    I have tried to split an mp4 file into smaller parts of equal time length like this ffmpeg -i ../data/2024-06-02_12-34-51.mp4 -c copy -map 0 -segment_time 00:00:05 -f segment v1_%03d.mp4. However, this produced videos of highly variables size, some 25x larger than others. I assume this was due to inconsistent framerate during recording.

    


    Next, I tried a script that would split based and limit each part to a specific size :

    


    #!/bin/sh
# Short script to split videos by filesize using ffmpeg by LukeLR

if [ $# -ne 3 ]; then
    echo 'Illegal number of parameters. Needs 3 parameters:'
    echo 'Usage:'
    echo './split-video.sh FILE SIZELIMIT "FFMPEG_ARGS'
    echo 
    echo 'Parameters:'
    echo '    - FILE:        Name of the video file to split'
    echo '    - SIZELIMIT:   Maximum file size of each part (in bytes)'
    echo '    - FFMPEG_ARGS: Additional arguments to pass to each ffmpeg-call'
    echo '                   (video format and quality options etc.)'
    exit 1
fi

FILE="../data/$1"
SIZELIMIT="$2"
FFMPEG_ARGS="$3"

# Duration of the source video
DURATION=$(ffprobe -i "$FILE" -show_entries format=duration -v quiet -of default=noprint_wrappers=1:nokey=1|cut -d. -f -2)

# Duration that has been encoded so far
CURDURATION=0

# Filename of the source video (without extension)
BASENAME="${FILE%.*}"

# Extension for the video parts
#EXTENSION="${FILE##*.}"
EXTENSION="mp4"

# Number of the current video part
i=1

# Filename of the next video part
NEXTFILENAME="$BASENAME-$i.$EXTENSION"

echo "Duration of source video: $DURATION"

# Until the duration of all partial videos has reached the duration of the source video
#while [[ $CUR_DURATION -lt $DURATION ]]; do
while [[ $(bc <<< "$CURDURATION < $DURATION") -eq 1 ]]; do
    # Encode next part
    echo ffmpeg -i "$FILE" -ss "$CURDURATION" -fs "$SIZELIMIT" $FFMPEG_ARGS "$NEXTFILENAME"
    ffmpeg -ss "$CURDURATION" -i "$FILE" -fs "$SIZELIMIT" $FFMPEG_ARGS "$NEXTFILENAME"

    # Duration of the new part
    NEWDURATION=$(ffprobe -i "$NEXTFILENAME" -show_entries format=duration -v quiet -of default=noprint_wrappers=1:nokey=1|cut -d. -f -2)

    # Total duration encoded so far
    echo $CURDURATION
    CURDURATION=$(bc <<< "$CURDURATION + $NEWDURATION")
    echo $CURDURATION

    i=$((i + 1))

    echo "Duration of $NEXTFILENAME: $NEWDURATION"
    echo "Part No. $i starts at $CURDURATION"
    echo "Current Duration: $CURDURATION"

    NEXTFILENAME="$BASENAME-$i.$EXTENSION"
done


    


    I call the script like this : bash split-video.sh 2024-06-02_12-34-51.mp4 10000000 "-c copy"
Unfortunately, this has an issue where some of the sub videos are extremely short and have wildly inconsistent numbers of frames in them (some with nearly 400, others with 1), despite being similar sizes. I am guessing this has something to do with inconsistent framerate and keyframes or something ?

    


    I am curious what the best way to split a video into equally sized parts, and ideally with similar numbers of frames, is using ffmpeg.

    


  • FFmpeg "Non-monotonous DTS in output stream" error when processing video from Safari's MediaRecorder

    17 juillet 2024, par Hackermon

    I'm recording a video stream in Safari with MediaRecorder, then sending it to a remote server which then uses ffmpeg to reencode the video. When reencoding with FFmpeg, I get a lot of warnings and the final video is broken, frame are glitching and out of sync but the audio sounds fine.

    


    Here's my MediaRecorder script :

    


    const camera = await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
const recorder = new MediaRecorder(camera, {
        mimeType: 'video/mp4', // Safari only supports MP4
        bitsPerSecond: 1_000_000,
});

recorder.ondataavailable = async ({ data: blob }) => {
        // open contents in new tab
        var fileURL = URL.createObjectURL(file);
         window.open(fileURL, '_blank');
};

recorder.start();
setTimeout(() => recorder.stop(), 5000);


    


    I download the video blob from Safari and use this command to reencode it :

    


    ffmpeg -i ./blob.mp4 -preset ultrafast -strict -2 -threads 10 -c copy ./output.mp4


    


    Logs :

    


    ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x559826616000] DTS 29 < 313 out of order
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './chunk1.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 1
    compatible_brands: isomiso5hlsf
    creation_time   : 2024-07-17T14:30:47.000000Z
  Duration: 00:00:01.00, start: 0.000000, bitrate: 3937 kb/s
    Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], 6218 kb/s, 33.36 fps, 600 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2024-07-17T14:30:47.000000Z
      handler_name    : Core Media Video
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 420 kb/s (default)
    Metadata:
      creation_time   : 2024-07-17T14:30:47.000000Z
      handler_name    : Core Media Audio
File './safari3.mp4' already exists. Overwrite ? [y/N] Output #0, mp4, to './safari3.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 1
    compatible_brands: isomiso5hlsf
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 6218 kb/s, 33.36 fps, 600 tbr, 19200 tbn, 600 tbc (default)
    Metadata:
      creation_time   : 2024-07-17T14:30:47.000000Z
      handler_name    : Core Media Video
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 420 kb/s (default)
    Metadata:
      creation_time   : 2024-07-17T14:30:47.000000Z
      handler_name    : Core Media Audio
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x559826644340] Non-monotonous DTS in output stream 0:0; previous: 10016, current: 928; changing to 10017. This may result in incorrect timestamps in the output file.
[mp4 @ 0x559826644340] Non-monotonous DTS in output stream 0:0; previous: 10017, current: 1568; changing to 10018. This may result in incorrect timestamps in the output file.
[mp4 @ 0x559826644340] Non-monotonous DTS in output stream 0:0; previous: 10018, current: 2208; changing to 10019. This may result in incorrect timestamps in the output file.
...x100
frame=  126 fps=0.0 q=-1.0 Lsize=     479kB time=00:00:00.97 bitrate=4026.2kbits/s speed= 130x    
video:425kB audio:51kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.652696%


    


    Not sure what's happening or how to fix it. This issue only happens in Safari, videos from Chrome are perfectly fine.

    


    I've tried various flags :

    


    -fflags +igndts
-bsf:a aac_adtstoasc
-c:v libvpx-vp9 -c:a libopus
etc


    


    None of them seem to fix the issue.

    


  • Filter concat has an unconnected output while Video concatenation in ffmpeg wrapper in java

    28 février 2024, par Thor

    I am trying to stitch variable number of videos using ffmpeg wrapper.

    


    I have this code :

    


    private void videoStich(List<string> videoPaths){&#xA;        FFmpeg ffmpeg = null;&#xA;        FFprobe ffprobe=null;&#xA;        String stitchedOutputPath = outputFolder &#x2B; "/stitched_output.mp4";&#xA;&#xA;        try {&#xA;            ffmpeg = new FFmpeg();&#xA;            ffprobe = new FFprobe();&#xA;        } catch (IOException e) {&#xA;            throw new RuntimeException(e);&#xA;        }&#xA;&#xA;&#xA;        FFmpegBuilder builder = new FFmpegBuilder();&#xA;&#xA;        for (int i = 0; i &lt; videoPaths.size(); i&#x2B;&#x2B;) {&#xA;            String videoPath = videoPaths.get(i);&#xA;            builder.addInput(videoPath);&#xA;        }&#xA;&#xA;        // Add complex filter for concatenation&#xA;        StringBuilder complexFilter = new StringBuilder();&#xA;        for (int i = 0; i &lt; videoPaths.size(); i&#x2B;&#x2B;) {&#xA;            complexFilter.append("[").append(i).append(":v][").append(i).append(":a]");&#xA;//            if (i &lt; videoPaths.size() - 1) {&#xA;//                complexFilter.append("[");&#xA;//            }&#xA;        }&#xA;        complexFilter.append("concat=n=").append(videoPaths.size()).append(":v=1:a=1[v][a]");&#xA;&#xA;        builder.setComplexFilter(complexFilter.toString())&#xA;                .addOutput(stitchedOutputPath)&#xA;                .setFormat("mp4")&#xA;                .done();&#xA;&#xA;        FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);&#xA;        executor.createJob(builder).run();&#xA;    }&#xA;</string>

    &#xA;

    but getting this error :

    &#xA;

    2024-02-28T16:30:53.033&#x2B;05:30  INFO 4711 --- [sample_project] [pool-3-thread-1] net.bramp.ffmpeg.RunProcessFunction      : ffmpeg -version&#xA;2024-02-28T16:30:53.126&#x2B;05:30  INFO 4711 --- [sample_project] [pool-3-thread-1] net.bramp.ffmpeg.RunProcessFunction      : ffmpeg -y -v error -i src/main/resources/cutted_videos/0_trimmed.mp4 -i src/main/resources/cutted_videos/1_trimmed.mp4 -filter_complex [0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a] -f mp4 src/main/resources/cutted_videos/stitched_output.mp4&#xA;Filter concat has an unconnected output&#xA;java.lang.RuntimeException: java.io.IOException: ffmpeg returned non-zero exit status. Check stdout.&#xA;

    &#xA;

    I have been trying to fix this since a long time and didn't find any issue with the filter, it is looking good to me. Can anyone help me with it ?

    &#xA;

    EDIT :&#xA;I found that when I use this command in terminal :

    &#xA;

    ffmpeg -i in1.mp4 -i in2.mp4\&#xA;            -filter_complex "[0:v] [0:a] [1:v] [1:a] \&#xA;concat=n=2:v=1:a=1 [v] [a]" \&#xA;            -f mp4  output_test5.mp4&#xA;

    &#xA;

    it didn ;t work&#xA;while when i used this :

    &#xA;

    ffmpeg -i in1.mp4 -i in2.mp4\&#xA;            -filter_complex "[0:v] [0:a] [1:v] [1:a] \&#xA;concat=n=2:v=1:a=1 [v] [a]" \&#xA;            -f mp4 -map "[v]" -map "[a]" output_test4.mp4&#xA;

    &#xA;

    it worked. I think i need to add -map "[v]" -map "[a]" somehow in the code.

    &#xA;

    but when i try to add :&#xA;builder.setComplexFilter(complexFilter.toString())&#xA;.addOutput(stitchedOutputPath)&#xA;.setFormat("mp4")&#xA;.map()&#xA;.done() ;

    &#xA;

    or

    &#xA;

    builder.setComplexFilter(complexFilter.toString())&#xA;.addOutput(stitchedOutputPath)&#xA;.setFormat("mp4")&#xA;.setMap()&#xA;.done() ;

    &#xA;

    both .set() or setMap() doesn't exist. What to do, how to do ?

    &#xA;