Recherche avancée

Médias (39)

Mot : - Tags -/audio

Sur d’autres sites (114)

  • fluent-ffmpeg concatenate audio files

    8 septembre 2020, par Martin

    I am trying to use fluent-ffmpeg with my electron app to concatenate multiple audio files together with an image in a video. So if i have three files :

    


    song1.mp3 1:00
song2.mp3 0:30
song3.mp3 2:00
front.jpg

    


    I could create output.mp4 which would be 3:30 seconds long, and play each file one after the other in order. With front.jpg set as the background image.

    


    I have succesfully been able to render a single audio file with an image file, but havent been able to render multiple audio files together yet into a video.

    


    Here is my concat attempt :

    


    const command = ffmpeg();
       
            const audioFiles = ['C:\\Users\\marti\\Documents\\martinradio\\uploads\\Movers - 1970 greatest hits vol. 2\\01 back from the moon.mp3', 'C:\\Users\\marti\\Documents\\martinradio\\uploads\\Movers - 1970 greatest hits vol. 2\\02 love me not.mp3'];
            audioFiles.forEach((fileName)=>{
                command.input(fileName);
            })
            command
                    .complexFilter([
                        '[0]adelay=1000|1000[a]',
                        '[1]adelay=4000|4000[b]',
                        '[a][b]amix=2'
                    ])
                    .input(imgPath)
                    .videoCodec('copy')
                    .save('C:\\Users\\marti\\Documents\\martinradio\\uploads\\Movers - 1970 greatest hits vol. 2\\concat-autio.mp4')
                    .on('codecData', function(data) {
                        console.log('codecData=',data);
                    })
                    .on('progress', function({ percent }) {
                        console.log('progress percent: ' + percent);
                    })
                    .on('end', function() {
                        console.log('file has been converted succesfully');
                    })
                    .on('error', function(err) {
                        console.log('an error happened: ' + err.message);
                    })
                    command.run()


    


    When I run it I can see in my console it start, run, and end.

    


    enter image description here

    


    My example uses two audio files :

    


    01 back from the moon.mp3 02:31
02 love me not.mp3' 02:35

    


    So my output file should be 05:06 in length, but my output is only 02:39 in length
enter image description here

    


  • FFMPEG mp4 copied to matroska loses last frame

    16 juin 2020, par Mike

    I am running this simple ffmpeg command to change an mp4 video to matroska format so it can support streaming. ffmpeg -i test.mp4 -c copy out.mkv. My issue is that the out.mkv file has one less frame than the original mp4 file. It seems to be missing the last frame.

    



    I thought using copy as the codec should retain the same video. Am I missing passing an option to FFmpeg ? Thanks.

    



    EDIT : Full Log

    



    ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.59)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.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:29.57, start: 0.000000, bitrate: 1421 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1032 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, 383 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
File 'out.mkv' already exists. Overwrite ? [y/N] y
Output #0, matroska, to 'out.mkv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1032 kb/s, 25 fps, 25 tbr, 1k tbn, 12800 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, 5.1, fltp, 383 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  739 fps=0.0 q=-1.0 Lsize=    5129kB time=00:00:29.54 bitrate=1422.0kbits/s speed= 493x
video:3727kB audio:1386kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.309803%


    


  • FFMPEG Webvtt m3u8 download into single vtt file, ignore the "X-TIMESTAMP-MAP=MPEGTS=" (timestamp sync problem)

    5 janvier 2021, par Panda Xia

    I want to download the subtitle of a video, it has separated m3u8 file for subtitle :

    


    webvtt source in m3u8 format : https://sdn-global-streaming-cache.3qsdn.com/9378/files/19/05/1199332/Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes.ism/Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes-textstream_deu=1000.m3u8

    


    looks like :

    


    #EXTM3U
#EXT-X-VERSION:4
## Created with Unified Streaming Platform(version=1.9.5)
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:989
#USP-X-TIMESTAMP-MAP:MPEGTS=900000,LOCAL=1970-01-01T00:00:00Z
#EXTINF:24.72, no desc
Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes-textstream_deu=1000-1.webvtt
#EXTINF:2.56, no desc
Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes-textstream_deu=1000-13.webvtt
#EXTINF:50.88, no desc
Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes-textstream_deu=1000-14.webvtt
#EXTINF:3.079, no desc
Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes-textstream_deu=1000-40.webvtt
#EXTINF:60.401, no desc
....


    


    Then use the command to download the multiple webvtts into one vtt file "EN.vtt" :

    


    ffmpeg -i  "https://sdn-global-streaming-cache.3qsdn.com/9378/files/19/05/1199332/Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes.ism/Dqt6jZBkvX2nLyY4CGhxmpK89PbQRFV7-drm-aes-textstream_deu=1000.m3u8"  "DE.vtt"


    


    In output "DE.vtt" the X-TIMESTAMP-MAP=MPEGTS:xxxxxx,LOCAL:00:00:00.000 from each webvtt file (webvtt in m3u8) are ignored.

    


    so that the time Synchronisation is broken, the start time of each Segment always begins from 00:00:00, looks like :

    


    WEBVTT

00:00.000 --> 00:02.560
So viel Macht.

00:00.000 --> 00:03.079
Was er sagte.

00:00.000 --> 00:04.680
oder
die Schönheit

00:00.000 --> 00:01.440
Er sagte immer:

00:00.000 --> 00:03.840
Auf seinen Klang 

00:00.000 --> 00:07.519
Seine Paranoia.


    


    Could ffmpeg support the relative time stamp to convert into absolute time stamp ?
Or use other method to download perfect webvvt file ?