Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG : Invalid data found when processing input

    14 juillet, par Schüler

    I am unable to upload mp3 or mp4 is there any specific path format? Here is my code. I have tried this also ffmpeg -i Video/" + Name + " -ss 01:30 -r 1 -an -vframes 1 -f mjpeg Video/" + Name + ".jpg

    exec("ffmpeg -y -i Video/" + Name + " -map_metadata -1 -ab 192k Video/" + Name + ".jpg", function(err) {
                if (err) {console.log(err)}
            console.log('Done', {'Image' : 'Video/' + Name + '.jpg'});
            });
    

    Here is the error

    { Error: Command failed: ffmpeg -y -i Video/ac9358e25dd41a69e95a72d3e71e4881 -map_metadata -1 -ab 192k Video/ac9358e25dd41a69e95a72d3e71e4881.jpg
    ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 8.2.1 (GCC) 20190212
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
      libavutil      56. 22.100 / 56. 22.100
      libavcodec     58. 35.100 / 58. 35.100
      libavformat    58. 20.100 / 58. 20.100
      libavdevice    58.  5.100 / 58.  5.100
      libavfilter     7. 40.101 /  7. 40.101
      libswscale      5.  3.100 /  5.  3.100
      libswresample   3.  3.100 /  3.  3.100
      libpostproc    55.  3.100 / 55.  3.100
    Video/ac9358e25dd41a69e95a72d3e71e4881: Invalid data found when processing input
    
        at ChildProcess.exithandler (child_process.js:275:12)
        at emitTwo (events.js:126:13)
        at ChildProcess.emit (events.js:214:7)
        at maybeClose (internal/child_process.js:925:16)
        at Socket.stream.socket.on (internal/child_process.js:346:11)
        at emitOne (events.js:116:13)
        at Socket.emit (events.js:211:7)
        at Pipe._handle.close [as _onclose] (net.js:557:12)
      killed: false,
      code: 1,
      signal: null,
      cmd: 'ffmpeg -y -i Video/ac9358e25dd41a69e95a72d3e71e4881 -map_metadata -1 -ab 192k Video/ac9358e25dd41a69e95a72d3e71e4881.jpg' }
    
  • Can't import moviepy due to missing ffmpex.exe

    14 juillet, par SilentGrove_99

    I was trying to create an application with python using the moviepy library. I installed it using:

    pip install moviepy
    

    I found this from a MoviePy crash-course:

    # Import everything needed to edit video clips
    from moviepy.editor import *
    # or 
    from moviepy import *  # moviepy v2 after removal of editor
    

    After trying to run this line i get this error:

    Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32     bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> # Import everything needed to edit video clips
    ... from moviepy.editor import *
    Traceback (most recent call last):
      File "", line 2, in 
      File "C:\Python27\lib\site-packages\moviepy\editor.py", line 22, in 
        from .video.io.VideoFileClip import VideoFileClip
      File "C:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 3, in 
        from moviepy.video.VideoClip import VideoClip
      File "C:\Python27\lib\site-packages\moviepy\video\VideoClip.py", line 20, in 
        from .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video
      File "C:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 15, in 
        from moviepy.config import get_setting
      File "C:\Python27\lib\site-packages\moviepy\config.py", line 38, in 
        FFMPEG_BINARY = get_exe()
      File "C:\Python27\lib\site-packages\imageio\plugins\ffmpeg.py", line 86, in get_exe
        raise NeedDownloadError('Need ffmpeg exe. '
    imageio.core.fetching.NeedDownloadError: Need ffmpeg exe. You can download it by calling:
      imageio.plugins.ffmpeg.download()
    

    What is the problem here, and how can i fix it?

  • Cutting multimedia files based on start and end time using ffmpeg

    14 juillet, par Kalaiyarasan

    I tried to cut the video using the start and end time of the video by using the following command:

    ffmpeg -ss 00:00:03 -t 00:00:08 -i movie.mp4 -acodec copy -vcodec copy -async 1 cut.mp4
    

    By using the above command I want to cut the video from 00:00:03 to 00:00:08. But it is not cutting the video between those times instead of that it is cutting the video with first 11 seconds.

  • Error in writing video file using moviepy and ffmpeg

    13 juillet, par Divakar Sharma

    I have been working with moviepy library for the first time. I have a video clip around 7 hours long, and I'd like to clip it into small clips. I have a list of start and end time.

    video = VideoFileClip("videoFile.mp4")
    clips = []
    for cut in cuts:
       clip = video.subclip(cut[0], cut[1])
       clips.append(clip)
    clips
    clip = video.subclip("7:32:18", "7:38:38")
    clips.append(clip)
    for clip, title in zip(clips, title_list):
     clip.write_videofile(title + '.mp4', threads=8, fps=24, audio=True, codec='libx264',preset=compression)
    video.close()
    

    clips[] contain the start and end time for clipping. I have a list of title too which I have scraped from youtube. I have not included the two lists here but a small example could be:

    cuts = [('0:00', '2:26'),
     ('2:26', '5:00'),
     ('5:00', '7:15'),
     ('7:15', '10:57'),
     ('10:57', '18:00'),
     ('18:00', '18:22'),
     ('18:22', '19:57'),
     ('19:57', '20:37'),
     ('20:37', '28:27'),
     ('28:27', '40:32'),
     ('40:32', '49:57'),...
    title_list = ['Introduction (What is Todoist?), tech stack talk', 'Showing the final application (with dark mode!)', 'Installing create react app', "Clearing out what we don't need from create react app", "Let's get building our components!", 'Installing packages using Yarn', 'Building the Header component', 'Building the Content component',...
    
    OSError: [Errno 32] Broken pipe
    
    MoviePy error: FFMPEG encountered the following error while writing file Introduction(WhatisTodoist?),techstacktalkTEMP_MPY_wvf_snd.mp3:
    
    b'Introduction(WhatisTodoist?),techstacktalkTEMP_MPY_wvf_snd.mp3: Invalid argument\r\n'
    
    In case it helps, make sure you are using a recent version of FFMPEG (the versions in the Ubuntu/Debian repos are deprecated).
    

    Above is the error I am getting after running the write_videofile(). I have looked at the documentation and the issues on github, I tried updating the ffmpeg through pip too. I don't know why it can't write the audio file.

  • ffmpeg dshow and ddagrab desync [closed]

    12 juillet, par Light Guardian

    so i have a code for screen capture

    ffmpeg.exe -hide_banner ^ 
    -f dshow -i audio="virtual-audio-capturer" ^ 
    -f dshow -i audio="@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{8049B44D-EB44-4706-83C2-7480DCD60587}" ^ 
    -filter_complex "[0:a][1:a]amix=inputs=2,volume=1.5[a];ddagrab=0:framerate=30[v];" ^ 
    -map "[v]" -map "[a]" ^ 
    -c:v h264_nvenc -rc vbr -cq 36 -qmin 29 ^ 
    -c:a aac ^ 
    "vid.mkv"
    

    first audio input - system sound second audio input - my mic

    The main problem is that the sound lags behind the video by about 0.5 seconds. Also, the first audio lags behind the second by about 0.2 seconds. In simple words - first I see that I started the video, then I hear that I pressed the spacebar, and only then do I hear the sound of the video itself.

    my ffmpeg version 7.1.1-full_build-www.gyan.dev

    log when recording

    Input #0, dshow, from 'audio=virtual-audio-capturer':   
    Duration: N/A, start: 7907.655000, bitrate: 1536 kb/s   
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s 
    Input #1, dshow, from 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{8049B44D-EB44-4706-83C2-7480DCD60587}':
    Duration: N/A, start: 7907.915000, bitrate: 1411 kb/s
    Stream #1:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s Stream mapping:
    Stream #0:0 (pcm_s16le) -> amix
    Stream #1:0 (pcm_s16le) -> amix
    ddagrab:default -> Stream #0:0 (h264_nvenc)
    volume:default -> Stream #0:1 (aac)
    

    To fix this, I tried: changing buffers. -async 1. -itsoffset -0.2 for directshow (this helped a little, but it didn't completely fix the issue, because lowering the value causes ffmpeg to start dropping frames). -fflags nobuffer. setpts=PTS+0.45\*S for filter_complex, etc.

    The problem might be that the sample rate of the audio inputs is different. 48000 Hz for the first and 44100 Hz for the second. But I'm not sure about this, as I tried to adjust them to the same value using -ar 48000 and -ar 44100, but it did not yield any results.