Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Convert .flac to .mp3 with ffmpeg, keeping all metadata

    17 mars, par Vito Gentile

    How can I convert .flac to .mp3 with ffmpeg, keeping all metadata (that is converting Vorbis comment in .flac files to ID3v2 metadata of .mp3)?

  • FFMPEG : Invalid data found when processing input

    16 mars, 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' }
    
  • ffmpeg produces different file sizes between MacOS and Linux [closed]

    16 mars, par kojow7

    I have several .wav files. When I use ffmpeg to convert to m4a, it produces different file sizes between the two systems.

    Example:

    original.wav (on MacOS) - 418004 bytes original.wav (on Linux) - 418004 bytes

    Method 1:

    for f in *.wav; do ffmpeg -i "$f" -c:a aac -b:a 96k "${f%.wav}.m4a"; done

    MacOS - 18408 bytes Linux - 15814 bytes

    Method 2:

    for f in *.wav; do ffmpeg -i "$f" -c:a aac -b:a 192k "${f%.wav}.m4a"; done

    MacOs - 36428 bytes Linux - 26060 bytes

    Method 3:

    for f in *.wav; do ffmpeg -i "$f" -c:a aac "${f%.wav}.m4a"; done

    MacOS - 24168 bytes Linux - 19765 bytes

    As you notice, the Linux examples are quite smaller than the MacOS examples.

    What is going on here that would make the difference? Is it a different AAC codec being used in both cases or is it the ffmpeg version? If so, what would the versions be doing differently here?

    On my Mac, it appears I am using ffmpeg version 7.1.1 On Linux, it appears I am using ffmpeg version 4.3.8-0+deb11u3

  • How to change metadata with ffmpeg/avconv without creating a new file ?

    16 mars, par Stephan Kulla

    I am writing a python script for producing audio and video podcasts. There are a bunch of recorded media files (audio and video) and text files containing the meta information.

    Now I want to program a function which shall add the information from the meta data text files to all media files (the original and the converted ones). Because I have to handle many different file formats (wav, flac, mp3, mp4, ogg, ogv...) it would be great to have a tool which add meta data to arbitrary formats.

    My Question:

    How can I change the metadata of a file with ffmpeg/avconv without changing the audio or video of it and without creating a new file? Is there another commandline/python tool which would do the job for me?

    What I tried so far:

    I thought ffmpeg/avconv could be such a tool, because it can handle nearly all media formats. I hoped, that if I set -i input_file and the output_file to the same file, ffmpeg/avconv will be smart enough to leave the file unchanged. Then I could set -metadata key=value and just the metadata will be changed.

    But I noticed, that if I type avconv -i test.mp3 -metadata title='Test title' test.mp3 the audio test.mp3 will be reconverted in another bitrate.

    So I thought to use -c copy to copy all video and audio information. Unfortunately also this does not work:

    :~$ du -h test.wav # test.wav is 303 MB big
    303M    test.wav
    
    :~$ avconv -i test.wav -c copy -metadata title='Test title' test.wav
    avconv version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the
    Libav    developers
    built on Jun 12 2012 16:37:58 with gcc 4.6.3
    [wav @ 0x846b260] max_analyze_duration reached
    Input #0, wav, from 'test.wav':
    Duration: 00:29:58.74, bitrate: 1411 kb/s
        Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    File 'test.wav' already exists. Overwrite ? [y/N] y
    Output #0, wav, to 'test.wav':
    Metadata:
        title           : Test title
        encoder         : Lavf53.21.0
        Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, 1411 kb/s
    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Press ctrl-c to stop encoding
    size=     896kB time=5.20 bitrate=1411.3kbits/s    
    video:0kB audio:896kB global headers:0kB muxing overhead 0.005014%
    
    :~$ du -h test.wav # file size of test.wav changed dramatically
    900K    test.wav
    

    You see, that I cannot use -c copy if input_file and output_file are the same. Of course I could produce a temporarily file:

    :-$ avconv -i test.wav -c copy -metadata title='Test title' test_temp.mp3
    :-$ mv test_tmp.mp3 test.mp3
    

    But this solution would create (temporarily) a new file on the filesystem and is therefore not preferable.

  • Can m3u8 files have mp4 file urls ?

    15 mars, par 89neuron

    I am in a situation where I have my flv video converted to mp4 and then I am streaming this as http url using my nginx server. For multibitrate supoport on html5 I have created a m3u8 file like this :

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=200111, RESOLUTION=512x288
    http://streamer.abc.com:8080/videos/arvind1.mp4
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3000444, RESOLUTION=400x300
    http://streamer.abc.com:8080/videos/arvind1.mp4
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=400777, RESOLUTION=400x300
    http://streamer.abc.com:8080/videos/arvind1.mp4
    #EXT-X-ENDLIST
    

    But jwplayer is not playing this saying playlist not loaded. Specifically "No playable sources found". Please help.