Recherche avancée

Médias (91)

Sur d’autres sites (115)

  • How to merge segmented webvtt subtitle files and output a single file ?

    24 février 2019, par Dobbelina

    How to merge a segmented webvtt subtitle file and output a single file ?,
    m3u8 looks like this example :

    #EXTM3U
    #EXT-X-VERSION:4
    #EXT-X-PLAYLIST-TYPE:VOD
    #EXT-X-MEDIA-SEQUENCE:1
    #EXT-X-INDEPENDENT-SEGMENTS
    #EXT-X-TARGETDURATION:4
    #USP-X-TIMESTAMP-MAP:MPEGTS=900000,LOCAL=1970-01-01T00:00:00Z
    #EXTINF:4, no desc
    0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-1.webvtt
    #EXTINF:4, no desc
    0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-2.webvtt
    #EXTINF:4, no desc
    0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-3.webvtt
    #EXTINF:4, no desc
    0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-4.webvtt
    #EXTINF:4, no desc
    0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-5.webvtt
    #EXTINF:4, no desc
    0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-6.webvtt
    #EXT-X-ENDLIST

    I noticed that each segment is not synchronized/cued against total playing time, but against the individual ts segments.
    If ffmpeg could be used to do this, what magic input do i need to give it ?

    A single correctly cued vtt or srt file is what i want.

    I have a great appetite and don’t like chunks, lol !

    Thanks for any replies you lovely people !


    With this i get a merged vtt file, but the cues are all wrong :

    ffmpeg -i "https://cmoreseusphlsvod60.akamaized.net/vod/bea44/0ghzi1b2cz5(11792107_ISMUSP).ism/0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000.m3u8" -f segment -segment_time 4 -segment_format webvtt -scodec copy out-%05d.vtt

    Each segment is not synchronized/cued against total playing time, but against the individual ts segments.
    Example output of above command :

    WEBVTT

    00:00.000 --> 00:03.040
    Du har aktier i ett företag
    som saknar framtid.

    00:00.000 --> 00:03.280
    De vill ha aktierna.
    Du känner dem inte, Olga.

    00:00.000 --> 00:01.720
    De som får Kastrups aktier vinner.

    Cues all start like this which isn’t very helpfull : 00:00.000

    Some segments contains no cues, like segment 15 for example :
    https://cmoreseusphlsvod60.akamaized.net/vod/bea44/0ghzi1b2cz5(11792107_ISMUSP).ism/0ghzi1b2cz5(11792107_ISMUSP)-textstream_swe=2000-15.webvtt

    "A WebVTT Segment MAY contain no cues ; this indicates that no
    subtitles are to be displayed during that period."

  • Adding multiple subtitle streams to MP4 with FFMPEG

    5 janvier 2021, par Dragonix

    After a lot of trial and error, I managed to add multiple subtitle streams to one MP4.
However, when checking the metadata of the MP4, I see some results that I want to change, hoping someone can help me or can explain why it happened.

    



    This is the input (original MP4 to which I added subtitle streams)

    



    $ ffmpeg -i movie.mp4 
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
   Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2048x872 [SAR 1:1 DAR 256:109], 2352 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 440 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler


    



    Then, I execute the following command. I gathered this information from different sources and I'm not an FFMPEG guru :)

    



    ffmpeg -i movie.mp4 -f srt -i nl.srt -i mk.srt -i sk.srt \
-map 0:0 -map 0:1 -map 1:0 -map 2:0 -map 3:0 \
-c:v copy -c:a copy \
-c:s mov_text -c:s mov_text -c:s mov_text \
-metadata:s:s:0 language=nld -metadata:s:s:1 language=mkd -metadata:s:s:2 language=skv \
NEW.mp4


    



    In a few seconds, the NEW.mp4 is created and when playing the video I get the video and audio that I expect and 3 subtitle streams that can be switched during playback. The subtitles itself are also what I expect to be.

    



    Output of NEW.mp4

    



    $ ffmpeg -i NEW.mp4 
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2048x872 [SAR 1:1 DAR 256:109], 2352 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
  handler_name    : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 440 kb/s (default)
Metadata:
  handler_name    : SoundHandler
Stream #0:2(nld): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
Metadata:
  handler_name    : SubtitleHandler
Stream #0:3(mkd): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
Metadata:
  handler_name    : SubtitleHandler
Stream #0:4(svk): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
Metadata:
  handler_name    : SubtitleHandler


    



    I'm not sure if the type of subtitle is the one I should use -> 'mov_text'. If I use the same command but instead of using 'mov_text', I want to use 'srt' or 'subrip', I get some errors.

    



    [mp4 @ 0x7ba2c0] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x7ba2c0] Codec for stream 1 does not use global headers but container format requires global headers
[mp4 @ 0x7ba2c0] Could not find tag for codec subrip in stream #2, codec not currently supported in container


    



    The only question that remains for me is how can I make it work with 'srt' or 'subrip' ? In the meantime I will look for solutions and when found, I will put it here.

    


  • ClipBucket video upload and conversion issue

    23 mars 2018, par Aleksandr Levcenko

    I am trying to migrate ClipBucket 2.8.1, RC2, REV 4328 into a new Azure server.
    I managed to install and enable all required modules such as : FFMPEG, PHP CLI, Media Info, MP4Box, ImageMagick and FFProbe.
    Post, Upload, Execution time and Memory limit configuration values have been increased as well on the server side.

    ClipBucket seems to be up and running smoothly, but I have an issue with uploading the videos.
    After uploading a video it shows error message "This video might not work properly".
    When I checked Video Manager it stucks at Processing and does not go any further.

    I tried to delete conversion .loc file but still no luck.

    Can anyone help me with this please ?

    Here is a converion log below :

    Exec function exists
    PHP CLI is enabled
    FFMPEG Exists

    medium
    640
    1280
    720k
    96k
    ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
    built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
    configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc
    libavutil 55. 58.100 / 55. 58.100
    libavcodec 57. 89.100 / 57. 89.100
    libavformat 57. 71.100 / 57. 71.100
    libavdevice 57. 6.100 / 57. 6.100
    libavfilter 6. 82.100 / 6. 82.100
    libavresample 3. 5. 0 / 3. 5. 0
    libswscale 4. 6.100 / 4. 6.100
    libswresample 2. 7.100 / 2. 7.100
    libpostproc 54. 5.100 / 54. 5.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/opt/bitnami/apache2/htdocs/media.emathsmaster.co.uk/public_html/admin_area/lab_resources/testing_videos/SampleVideo_1280x720_2mb.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    creation_time : 1970-01-01T00:00:00.000000Z
    encoder : Lavf53.24.2
    Duration: 00:00:13.50, start: 0.000000, bitrate: 1248 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 862 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
    creation_time : 1970-01-01T00:00:00.000000Z
    handler_name : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 381 kb/s (default)
    Metadata:
    creation_time : 1970-01-01T00:00:00.000000Z
    handler_name : SoundHandler
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
    Press [q] to stop, [?] for help
    [libx264 @ 0x27bbca0] using SAR=8/9
    [libx264 @ 0x27bbca0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x27bbca0] profile High, level 3.1
    [libx264 @ 0x27bbca0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=720 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to '/opt/bitnami/apache2/htdocs/media.emathsmaster.co.uk/public_html/files/temp/1502179041121.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    encoder : Lavf57.71.100
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x640 [SAR 8:9 DAR 16:9], q=-1--1, 720 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
    creation_time : 1970-01-01T00:00:00.000000Z
    handler_name : VideoHandler
    encoder : Lavc57.89.100 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/720000 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 22050 Hz, 5.1, s16, 96 kb/s (default)
    Metadata:
    creation_time : 1970-01-01T00:00:00.000000Z
    handler_name : SoundHandler
    encoder : Lavc57.89.100 libfdk_aac
    frame= 48 fps=0.0 q=0.0 size= 0kB time=00:00:01.99 bitrate= 0.0kbits/s speed=3.99x
    frame= 91 fps= 87 q=36.0 size= 153kB time=00:00:03.71 bitrate= 336.3kbits/s speed=3.56x
    frame= 130 fps= 84 q=35.0 size= 280kB time=00:00:05.24 bitrate= 437.8kbits/s speed= 3.4x
    frame= 174 fps= 84 q=33.0 size= 426kB time=00:00:07.01 bitrate= 497.5kbits/s speed=3.38x
    frame= 214 fps= 83 q=32.0 size= 567kB time=00:00:08.59 bitrate= 541.0kbits/s speed=3.34x
    frame= 254 fps= 83 q=33.0 size= 771kB time=00:00:10.21 bitrate= 618.5kbits/s speed=3.32x
    frame= 322 fps= 90 q=29.0 size= 914kB time=00:00:12.95 bitrate= 578.1kbits/s speed=3.61x
    frame= 337 fps= 83 q=-1.0 Lsize= 1110kB time=00:00:13.51 bitrate= 672.7kbits/s speed=3.32x
    video:940kB audio:161kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.863801%
    [libx264 @ 0x27bbca0] frame I:3 Avg QP:20.42 size: 43729
    [libx264 @ 0x27bbca0] frame P:126 Avg QP:24.65 size: 4901
    [libx264 @ 0x27bbca0] frame B:208 Avg QP:31.30 size: 1023
    [libx264 @ 0x27bbca0] consecutive B-frames: 13.9% 7.1% 12.5% 66.5%
    [libx264 @ 0x27bbca0] mb I I16..4: 24.5% 58.7% 16.8%
    [libx264 @ 0x27bbca0] mb P I16..4: 1.3% 2.2% 0.2% P16..4: 24.1% 5.8% 2.6% 0.0% 0.0% skip:63.7%
    [libx264 @ 0x27bbca0] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 20.3% 0.7% 0.1% direct: 0.2% skip:78.5% L0:41.4% L1:57.4% BI: 1.2%
    [libx264 @ 0x27bbca0] final ratefactor: 25.93
    [libx264 @ 0x27bbca0] 8x8 transform intra:59.0% inter:80.0%
    [libx264 @ 0x27bbca0] coded y,uvDC,uvAC intra: 44.2% 60.8% 19.7% inter: 3.9% 5.1% 0.2%
    [libx264 @ 0x27bbca0] i16 v,h,dc,p: 18% 32% 8% 43%
    [libx264 @ 0x27bbca0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 17% 5% 7% 8% 8% 7% 6%
    [libx264 @ 0x27bbca0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 17% 11% 8% 10% 9% 8% 9% 6%
    [libx264 @ 0x27bbca0] i8c dc,h,v,p: 55% 18% 20% 7%
    [libx264 @ 0x27bbca0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x27bbca0] ref P L0: 71.5% 16.9% 9.1% 2.5%
    [libx264 @ 0x27bbca0] ref B L0: 92.4% 6.8% 0.8%
    [libx264 @ 0x27bbca0] ref B L1: 97.9% 2.1%
    [libx264 @ 0x27bbca0] kb/s:570.66
    Video file is convertable..

    Testing SampleVideo_1280x720_2mb.mp4 conversion Phase 1..
    please wait...