Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

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

    24 janvier 2019, par Dobbelina

    How to merge a segmented webvtt subtitle file and output a single srt 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 file would work to. Thanks for any replies you lovely people!

  • How to improve my current method of generating an audio transcript from an online video

    23 janvier 2019, par 5areductase

    I am working on a project that needs to download and analyze online videos. Most of the videos are hosted on YouTube but some are hosted on Facebook.

    My task is to generate an audio transcript for every video.

    My colleague was using a series of programs sequentially given some {link}:

    youtube-dl -f '(mp4)[height = 360][width = 640]' {link} -o '{out_1}.%(ext)s'
    
    ffmpeg -i {out_1} -vn {out_2}.wav
    
    sox {out_2} {out_3} channels 1 rate 16000
    
    pocketsphinx_continuous -infile {out_3} -samprate 16000 -hmm {ACOUSTICMODEL} -dict {DICTIONARY} -lm {LANGMODEL} -fwdflat yes -bestpath yes 2> error.log | tee {out_4}.log && rm error.log
    

    Note that there's an extra ffmpeg step to extract the audio, instead of simply directly downloading it with youtube-dl because video is needed as well.

    Everything works correctly as far as I can tell, but I've never really dealt with audio before so I'm not sure if this is the best way to go about it.

  • encoding jpeg as h264 video

    23 janvier 2019, par jefftimesten

    I am using the following command to encode an AVI to an H264 video for use in an HTML5 video tag:

    ffmpeg -y -i "test.avi" -vcodec libx264 -vpre slow -vpre baseline -g 30 "out.mp4"
    

    And this works just fine. But I also want to create a placeholder video (long story) from a single still image, so I do this:

    ffmpeg -y -i "test.jpg" -vcodec libx264 -vpre slow -vpre baseline -g 30 "out.mp4"
    

    And this doesn't work. What gives?

    EDIT: After trying LordNeckbeards answer, here is my full output: http://pastebin.com/axhKpkLx

  • MP3 files created using FFmpeg are not starting playback in browser immediately. Is there any major difference between FFmpeg and AVCONV ?

    23 janvier 2019, par AR5

    I am working on a website that streams music. We recently changed server from Debian (with avconv) to a Centos7 (with FFmpeg) server. The mp3 files created on Debian server start playback on browser (I have tested Chrome and Firefox) start almost at the same time they start loading into the browser (I used Network tab on Developer Tools to monitor this)

    Now after the switch to Centos/FFmpeg server, the files being created on this new server are displaying a strange behavior. They only start playback after about 1MB is loaded into the browser.

    I have used identical settings for converting original file into MP3 in both AVCONV and FFmpeg but the files created using FFmpeg are showing this issue. Is there something that might be causing such an issue? Are there differences in terms of audio conversion between AVCONV and FFmpeg?

    I have already tried

    I first found that the files created on old server (Debian/Avconv) were VBR (variable bitrate) and the ones created on new server were CBR (constant bitrate), so I tried switching to VBR but the issue still persisted.

    I checked the mp3 files using MediaInfo app and there seems to be no difference between the files.

    I also checked if both files were being served as 206 Partial Content and they both are indeed.

    I am trying to create mp3 files using FFmpeg that work exactly like the ones created before using avconv

    I am trying to make the streaming site work on the new server but the mp3 files created using FFmpeg are not playing back correctly as compared to the ones created on the old server. I am trying to figure out what I might be doing wrong? or if there is a difference between avconv and FFmpeg that is causing this issue.

    I am really stuck on this issue, any help will be really appreciated.


    Edit

    I don't have access to old server anymore so I couldn't retrieve the log output of avconv. The command that I was using was as follows:

    avconv -y -i "/test/Track 01.mp3" -ac 2 -ar 44100 -acodec libmp3lame -b:a 128k "/test/Track 01 (converted).mp3"
    

    Here is the command and log output from new server:

    ffmpeg -y -i "/test/Track 01.mp3" -ac 2 -ar 44100 -acodec libmp3lame -b:a 128k "/test/Track 01 (converted).mp3"
    ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
      configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
      libpostproc    53.  3.100 / 53.  3.100
    [mp3 @ 0xd60be0] Skipping 0 bytes of junk at 240044.
    Input #0, mp3, from '/test/Track 01.mp3':
      Metadata:
        album           : Future Hndrxx Presents: The WIZRD
        artist          : Future
        genre           : Hip-Hop
        title           : Never Stop
        track           : 1
        lyrics-eng      : rgf.is
        WEB SITE        : rgf.is
        TAGGINGTIME     : rgf.is
        WEB             : rgf.is
        date            : 2019
        encoder         : Lavf56.40.101
      Duration: 00:04:51.40, start: 0.025056, bitrate: 121 kb/s
        Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 114 kb/s
        Metadata:
          encoder         : Lavc56.60
        Stream #0:1: Video: png, rgb24(pc), 333x333 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
        Metadata:
          comment         : Cover (front)
    [mp3 @ 0xd66ec0] Frame rate very high for a muxer not efficiently supporting it.
    Please consider specifying a lower framerate, a different muxer or -vsync 2
    Output #0, mp3, to '/test/Track 01 (converted).mp3':
      Metadata:
        TALB            : Future Hndrxx Presents: The WIZRD
        TPE1            : Future
        TCON            : Hip-Hop
        TIT2            : Never Stop
        TRCK            : 1
        lyrics-eng      : rgf.is
        WEB SITE        : rgf.is
        TAGGINGTIME     : rgf.is
        WEB             : rgf.is
        TDRC            : 2019
        TSSE            : Lavf56.40.101
        Stream #0:0: Video: png, rgb24, 333x333 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc
        Metadata:
          comment         : Cover (front)
          encoder         : Lavc56.60.100 png
        Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p, 128 kb/s
        Metadata:
          encoder         : Lavc56.60.100 libmp3lame
    Stream mapping:
      Stream #0:1 -> #0:0 (png (native) -> png (native))
      Stream #0:0 -> #0:1 (mp3 (native) -> mp3 (libmp3lame))
    Press [q] to stop, [?] for help
    [libmp3lame @ 0xd9b0c0] Trying to remove 1152 samples, but the queue is emptys/s
    frame=    1 fps=0.1 q=-0.0 Lsize=    4788kB time=00:04:51.39 bitrate= 134.6kbits/s
    video:234kB audio:4553kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.014809%
    

    Samples of MP3 files

    I have uploaded samples of mp3 files created using both avconv and FFmpeg. Please find these here: https://drive.google.com/drive/folders/1gRTmMM2iSK0VWQ4Zaf_iBNQe5laFJl08?usp=sharing

  • Concatenate/Synchronize timestamp and video FFMPEG raspberry

    23 janvier 2019, par Andrea

    I have a raspberry pi 3 B+ and a logitech c920 webcam. I need to stream the webcam source from the raspberry along with the timestamp (per each frame) by maintaining 30fps.

    I used the following command:

    ffmpeg -ar 44100 -ac 2 -f alsa -i hw:1,0 -f v4l2 -codec:v h264 -framerate 30 -video_size 1920x1080 -itsoffset 0.5 -vsync 0 -copyts -i /dev/video0 -copyinkf -codec:v copy -use_wallclock_as_timestamps 1 -flags +global_header -codec:a aac -ab 128k -g 10 -vsync 0 -f mpegts udp://ip_of_my_machine:1234 -vsync 0 -f mkvtimestamp_v2 udp://ip_of_my_machine:1235
    

    I generate 2 udp streams but if I get the outpt with mplayer and netcat, respectively, I see a displacement between the timestamp in mplayer and the timestamp streamed of about 2 seconds.

    I need to get the two information separated because I have to process them and to maintain 30 FPS I cannot encode the output of the video.

    Is there a way to do it?