Recherche avancée

Médias (91)

Autres articles (43)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

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

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

Sur d’autres sites (4427)

  • FFMPEG - rewarp MPEGDash to MP4 changes audio bitrate mode

    30 juin 2022, par Matthieu Ducorps

    I'm rewrapping some MPEGDash to MP4 wrapper and some files are outputed with variable audio bitrate where others with constant bitrate,and both sources looks exactly the same.

    


    For reference :

    


    I'm using FFMPEG 5.0 for the rewrapping

    


    ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
    built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
    libavutil      57. 17.100 / 57. 17.100
    libavcodec     59. 18.100 / 59. 18.100
    libavformat    59. 16.100 / 59. 16.100
    libavdevice    59.  4.100 / 59.  4.100
    libavfilter     8. 24.100 /  8. 24.100
    libswscale      6.  4.100 /  6.  4.100
    libswresample   4.  3.100 /  4.  3.100
    libpostproc    56.  3.100 / 56.  3.100


    


    And MediaInfo 22.09 to check the medias.

    


    MediaInfoVersion

    


    I'm using this command to rewrap the media :

    


    ffmpeg.exe -y -i MPEGDash.mpd -map 0:v -map 0:a -c copy OutFile.mp4


    


    This source MPEGDASH with constant audio bitrate

    


    General
Complete name                            : \\Constant\PROXY\A0002_30sec\MPEGDash_A0002_30sec.mpd
Format                                   : DASH MPD
File size                                : 4.14 MiB
Duration                                 : 30 s 80 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 154 kb/s

Video
ID                                       : 0-1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Muxing mode                              : dash
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 30 ms
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.093
Stream size                              : 2.28 MiB (55%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Source                                   : V0_360p_640000/V0_360p_640000_init.mp4
Codec configuration box                  : avcC

Audio #1
ID                                       : 160-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A0_48000_128000/A0_48000_128000_init.mp4

Audio #2
ID                                       : 161-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A1_48000_128000/A1_48000_128000_init.mp4

Audio #3
ID                                       : 162-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A2_48000_128000/A2_48000_128000_init.mp4

Audio #4
ID                                       : 163-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:20:16
Tagged date                              : UTC 2022-06-30 08:20:16
Source                                   : A3_48000_128000/A3_48000_128000_init.mp4


    


    Has the expected output with constant audio bitrate on the MP4

    


    General
Complete name                            : \\Constant\PROXY\A0002_30sec\A0002_30sec.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 4.13 MiB
Duration                                 : 30 s 96 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 152 kb/s
Movie name                               : MPEGDash_A0002_30sec.mpd
Writing application                      : Lavf59.16.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 96 ms
Source duration                          : 29 s 997 ms
Bit rate mode                            : Constant
Bit rate                                 : 590 kb/s
Nominal bit rate                         : 640 kb/s
Maximum bit rate                         : 636 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.085
Stream size                              : 2.12 MiB (51%)
Source stream size                       : 2.28 MiB (55%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
mdhd_Duration                            : 30030
Codec configuration box                  : avcC

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

Audio #2
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 2

Audio #3
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 3

Audio #4
ID                                       : 5
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 4


    


    But this source MPEGDASH which has the same characteristics :

    


    General
Complete name                            : \\Variable\PROXY\A0005_30sec\MPEGDash_A0005_30sec.mpd
Format                                   : DASH MPD
File size                                : 4.15 MiB
Duration                                 : 30 s 80 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 157 kb/s

Video
ID                                       : 0-1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Muxing mode                              : dash
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 30 ms
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.093
Stream size                              : 2.29 MiB (55%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Source                                   : V0_360p_640000/V0_360p_640000_init.mp4
Codec configuration box                  : avcC

Audio #1
ID                                       : 160-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 461 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A0_48000_128000/A0_48000_128000_init.mp4

Audio #2
ID                                       : 161-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A1_48000_128000/A1_48000_128000_init.mp4

Audio #3
ID                                       : 162-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A2_48000_128000/A2_48000_128000_init.mp4

Audio #4
ID                                       : 163-1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : dash
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Encoded date                             : UTC 2022-06-30 08:24:03
Tagged date                              : UTC 2022-06-30 08:24:03
Source                                   : A3_48000_128000/A3_48000_128000_init.mp4


    


    Has this output where the MP4 have the first audio with variable bitrate

    


    General
Complete name                            : \\Variable\PROXY\A0005_30sec\A0005_30sec.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 4.14 MiB
Duration                                 : 30 s 96 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 155 kb/s
Movie name                               : MPEGDash_A0005_30sec.mpd
Writing application                      : Lavf59.16.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                     : M=3, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 96 ms
Source duration                          : 29 s 997 ms
Bit rate mode                            : Constant
Bit rate                                 : 593 kb/s
Nominal bit rate                         : 640 kb/s
Maximum bit rate                         : 640 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.086
Stream size                              : 2.13 MiB (51%)
Source stream size                       : 2.29 MiB (55%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
mdhd_Duration                            : 30030
Codec configuration box                  : avcC

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Variable
Bit rate                                 : 126 kb/s
Maximum bit rate                         : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 461 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

Audio #2
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 2

Audio #3
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 3

Audio #4
ID                                       : 5
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 80 ms
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 460 KiB (11%)
Language                                 : English
Default                                  : Yes
Alternate group                          : 4


    


    Maybe I'm missing something but,I don't see what.

    


  • FFMPEG Api conversion from YUV420P to RGB produces strange output

    20 novembre 2024, par fasc8

    I'm using the FFMPEG Api in Rust to get RGB images from video files.

    


    While some videos work correct and I get the frames back as expected, some work not. Or at least the result is not the way I expected it to be.

    


    The code I use in Rust :

    


    ffmpeg::init().unwrap();

let in_ctx = input(&Path::new(source)).unwrap();
let input = in_ctx
    .streams()
    .best(Type::Video)
    .ok_or(ffmpeg::Error::StreamNotFound)?;

let decoder = input.codec().decoder().video()?;

let scaler = Context::get(
    decoder.format(),
    decoder.width(),
    decoder.height(),
    Pixel::RGB24,
    decoder.width(),
    decoder.height(),
    Flags::FULL_CHR_H_INT | Flags::ACCURATE_RND,
)?; // <--- Is basically sws_getContext

// later to get the actual frame
let mut decoded = Video::empty();
if self.decoder.receive_frame(&mut decoded).is_ok() {
    let mut rgb_frame = Video::empty();
    self.scaler.run(&decoded, &mut rgb_frame)?; // <--- Does sws_scale
    println!("Converted Pixel Format: {}", rgb_frame.format() as i32);
    Ok(Some(rgb_frame))
}


    


    Which should roughly translate to C like so :

    


    // Get the context and video stream
SwsContext * ctx = sws_getContext(imgWidth, imgHeight,
                              imgFormat, imgWidth, imgHeight,
                              AV_PIX_FMT_RGB24, 0, 0, 0, 0);
sws_scale(ctx, decoded.data, decoded.linesize, 0, decoded.height, rgb_frame.data, rbg_frame.linesize);


    


    And like I said earlier, sometimes it works fine and I get the expected frame back. But sometimes I get something like this :
Weird result image

    


    I saved the images as .ppm files for quick visual comparison. I used this method, which basically writes the bytes to a file with a simple .ppm header :

    


    fn save_file(frame: &Video, index: usize) -> std::result::Result<(), std::io::Error> 
{
    let mut file = File::create(format!("frame{}.ppm", index))?;
    file.write_all(format!("P6\n{} {}\n255\n", frame.width(), frame.height()).as_bytes())?;
    file.write_all(frame.data(0))?;
    Ok(())
}


    


    Here you can see that on the left side there is a good image result vs. on the right side there is a bad image result.
Comparison of the .ppm files

    


    To come to the question now :

    


    Why is this happening. I tested everything on my side and the only thing left is ffmpeg conversion. FFMPEG seems to convert these two test files differently even though it reports YUV420P as format for both. I cannot figure out what the difference may be...

    


    Here the info for the two video files i used :

    


    Good video file :

    


    General
Complete name                            : /mnt/smb/Snapchat-174933781.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/mp42)
File size                                : 1.90 MiB
Duration                                 : 9 s 612 ms
Overall bit rate                         : 1 661 kb/s
Encoded date                             : UTC 2021-07-28 22:09:36
Tagged date                              : UTC 2021-07-28 22:09:36
eng                                      : -180.00

Video
ID                                       : 512
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 9 s 598 ms
Bit rate                                 : 1 597 kb/s
Width                                    : 480 pixels
Height                                   : 944 pixels
Display aspect ratio                     : 0.508
Frame rate mode                          : Variable
Frame rate                               : 29.797 FPS
Minimum frame rate                       : 15.000 FPS
Maximum frame rate                       : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.118
Stream size                              : 1.83 MiB (96%)
Title                                    : Snap Video
Language                                 : English
Encoded date                             : UTC 2021-07-28 22:09:36
Tagged date                              : UTC 2021-07-28 22:09:36
Color range                              : Full
colour_range_Original                    : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.601
transfer_characteristics_Original        : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 256
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 9 s 612 ms
Bit rate mode                            : Constant
Bit rate                                 : 62.0 kb/s
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 73.3 KiB (4%)
Title                                    : Snap Audio
Language                                 : English
Encoded date                             : UTC 2021-07-28 22:09:36
Tagged date                              : UTC 2021-07-28 22:09:36


    


    Bad video file :

    


    General
Complete name                            : /mnt/smb/Snapchat-1989594918.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/mp42)
File size                                : 2.97 MiB
Duration                                 : 6 s 313 ms
Overall bit rate                         : 3 948 kb/s
Encoded date                             : UTC 2019-07-11 06:43:04
Tagged date                              : UTC 2019-07-11 06:43:04
com.android.version                      : 9

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L3.1
Format settings                          : 1 Ref Frames
Format settings, CABAC                   : No
Format settings, Reference frames        : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 6 s 313 ms
Bit rate                                 : 3 945 kb/s
Width                                    : 496 pixels
Height                                   : 960 pixels
Display aspect ratio                     : 0.517
Frame rate mode                          : Variable
Frame rate                               : 29.306 FPS
Minimum frame rate                       : 19.767 FPS
Maximum frame rate                       : 39.508 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.283
Stream size                              : 2.97 MiB (100%)
Title                                    : VideoHandle
Language                                 : English
Encoded date                             : UTC 2019-07-11 06:43:04
Tagged date                              : UTC 2019-07-11 06:43:04
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC


    


    Or as a diff image : image diff

    


    The problem is that I am not that familiar with ffmpeg yet I don't know all the quirks it has.

    


    I hope someone can point me in the right direction.

    


  • How to embed subtitles to .mp4 movie using ffmpeg

    2 septembre 2021, par hudac

    I'm trying to embed subtitles I wrote to a movie I created.
    
I'm using FFmpeg version : ffmpeg-20150418-git-edbb9b5-win64-static with the command :

    


    ffmpeg -i in.mp4 -f srt -i subs.srt -c:v copy -c:a copy -c:s mov_text out.mp4


    


    I saw here.

    


    But I get errors during the process, and when the process is done there's an output file out.mp4 without subtitles embedded.
    
When I play the in.mp4 in some player such as media player classic with the subtitles separately, the subtitles are sync and everything is fine.

    


    The subtitles are subrip encoded in UTF8.

    


    I tried to look out for these errors but didn't find anything useful. it seems something ridiculous.
    
What am I doing wrong ?

    


    Errors such as :

    


    [mp4 @ 00000000003fe020] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 00000000003fe020] Codec for stream 1 does not use global headers but container format requires global headers
[mp4 @ 00000000003fe020] Application provided duration: -8 / timestamp: 72205 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value


    


    Movie details from Media info :

    


    Video  
ID: 1  
Format: AVC  
Format/Info: Advanced Video Codec  
Format profile: Main@L4.2  
Format settings, CABAC: Yes  
Format settings, ReFrames: 3 frames  
Format settings, GOP: M=4, N=24  
Codec ID: avc1  
Codec ID/Info: Advanced Video Coding  
Duration: 8mn 32s  
Source duration: 8mn 32s  
Bit rate: 23.4 Mbps  
Width: 1920 pixels  
Height: 1080 pixels  
Display aspect ratio: 16:9  
Original display aspect ratio: 2.2:1  
Frame rate mode: Variable  
Frame rate: 23.976 fps  
Minimum frame rate: 23.976 fps  
Maximum frame rate: 24.000 fps  
Standard: NTSC  
Color space: YUV  
Chroma subsampling: 4:2:0  
Bit depth: 8 bits  
Scan type: Progressive  
Bits/(Pixel*Frame): 0.472  
Stream size: 1.40 GiB (99%)  
Source stream size: 1.40 GiB (99%)  
Language: English  
Encoded date: UTC 2015-04-28 20:31:41  
Tagged date: UTC 2015-04-28 20:31:41  
mdhd_Duration: 512137  


    


    Ffmpeg command output :

    


    ffmpeg version N-71497-gedbb9b5 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
  libavutil      54. 22.101 / 54. 22.101
  libavcodec     56. 34.100 / 56. 34.100
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 14.100 /  5. 14.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2015-04-28 20:31:41
  Duration: 00:08:32.17, start: 0.000000, bitrate: 23640 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 40:33 DAR 640:297], 23444 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 t
bc (default)
    Metadata:
      creation_time   : 2015-04-28 20:31:41
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2015-04-28 20:31:41
      handler_name    : #Mainconcept MP4 Sound Media Handler
Input #1, srt, from 'subs.srt':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Subtitle: subrip
[mp4 @ 00000000003fe020] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 00000000003fe020] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    encoder         : Lavf56.30.100
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 40:33 DAR 640:297], q=2-31, 23444 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k t
bc (default)
    Metadata:
      creation_time   : 2015-04-28 20:31:41
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 189 kb/s (default)
    Metadata:
      creation_time   : 2015-04-28 20:31:41
      handler_name    : #Mainconcept MP4 Sound Media Handler
    Stream #0:2: Subtitle: mov_text ([8][0][0][0] / 0x0008)
    Metadata:
      encoder         : Lavc56.34.100 mov_text
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #1:0 -> #0:2 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
[mp4 @ 00000000003fe020] Application provided duration: -8 / timestamp: 72205 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -7 / timestamp: 74217 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -8 / timestamp: 76267 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -4 / timestamp: 77872 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -7 / timestamp: 79260 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -1 / timestamp: 88987 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -60 / timestamp: 91489 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -4 / timestamp: 108080 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -1 / timestamp: 112974 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -8 / timestamp: 115528 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -9 / timestamp: 122758 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 124862 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -12 / timestamp: 130307 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -140 / timestamp: 150079 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -144 / timestamp: 156606 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -245 / timestamp: 158916 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 231587 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -1 / timestamp: 234743 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -9 / timestamp: 239406 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 242670 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -4 / timestamp: 249833 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -9 / timestamp: 252669 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 257713 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -2 / timestamp: 272866 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -152 / timestamp: 276417 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -3 / timestamp: 290209 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 302825 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 305466 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -3 / timestamp: 314151 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -8 / timestamp: 315957 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -1 / timestamp: 322568 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -164 / timestamp: 333373 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -3 / timestamp: 379341 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -5 / timestamp: 385070 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -7 / timestamp: 396166 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -7 / timestamp: 402007 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -4 / timestamp: 404571 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -2 / timestamp: 418218 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -5 / timestamp: 428136 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -5 / timestamp: 433347 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -4 / timestamp: 438939 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -7 / timestamp: 445657 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 449039 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -6 / timestamp: 451870 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
[mp4 @ 00000000003fe020] Application provided duration: -5 / timestamp: 456582 is out of range for mov/mp4 format
[mp4 @ 00000000003fe020] pts has no value
frame=12279 fps=138 q=-1.0 Lsize= 1477815kB time=00:08:32.16 bitrate=23637.2kbits/s
video:1465658kB audio:11840kB subtitle:8kB other streams:0kB global headers:0kB muxing overhead: 0.020907%