Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Create an mp4 video from list of frames using ffmpeg

    11 août 2018, par Yevgeni Burshtein

    I have an directory with images that looks like this:

    frame0d.jpg
    frame1d.jpg
    frame2d.jpg
    ...
    frame4297d.jpg
    

    I need to create mp4 file with 30 fps from them.

    I've tried command:

    ffmpeg -framerate 30 -i frame%04d.jpg video.mp4
    

    But it fails with error:

    [image2 @ 0000026fd7c5a000] Could find no file with path 'frame%04d.jpg' and index in the range 0-4
    frame%04d.jpg: No such file or directory
    

    Thanks a lot !

  • JavaFx MediaPlayer can't play my mp3 and m4a files converted by ffmpeg

    10 août 2018, par Freewind

    I record some .wav files from microphone, and convert it to mp3 and m4a files. These files can be played with my desktop player correctly.

    Then in my JavaFX program, I play them as:

    String fileUri = file.toURI().toString();
    Media media = new Media(fileUri);
    MediaPlayer mediaPlayer = new MediaPlayer(media);
    mediaPlayer.play();
    

    But there is no sound, and no errors.

    I use ffmpeg to view them:

    ffmpeg -i demo.m4a

    Input #0, aac, from 'demo.m4a':
      Duration: 00:00:54.00, bitrate: 132 kb/s
        Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 132 kb/s
    

    ffmpeg -i hello.mp3

    Input #0, mp3, from 'hello.mp3':
      Metadata:
        encoder         : Lavf57.83.100
      Duration: 00:00:01.12, start: 0.069063, bitrate: 49 kb/s
        Stream #0:0: Audio: mp3, 16000 Hz, stereo, s16p, 48 kb/s
    

    And use this command to convert by ffmpeg:

    ffmpeg -i hello.wav hello.mp3
    

    Not sure where is wrong.


    Update: finally I use this command to generate mp3 which can be played by JavaFx

     ffmpeg -i hello.wav -f mp2 hello.mp3
    

    (also can add -c:a libmp3lame to generate smaller size mp3)

    Seems like JavaFx only supports mp2 format of mp3 files.

  • FFMPEG error when making animations with certain frame dimensions

    10 août 2018, par jtam

    I have been using ffmpeg to successfully generate animations of png images with a size of 7205x4308 with the following command:

    -framerate 25 -f image2 -start_number 1 -i fig%4d.png -f mp4 -vf scale=-2:ih -vcodec libx264 -pix_fmt yuv420p 2015-2018.mp4
    

    When I try to run the same command for a group of images with a different size, e.g., 6404x5575, I get the following error:

    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    Conversion failed!
    

    I have concluded that the reason it is failing has something to do with the frame size because that is the only thing that is different between the first successful animation and the one that is failing. But, my intuition could be wrong(?). I have tried to remove the scaling parameter in the command but I get the same error.

    I am using ffmpeg version 3.4.2 on Mac OSX 10.13 via python.

    Any help would be much appreciated. Thanks!

  • JavaFx MediaPlayer can't play my mp3 and m4a files

    10 août 2018, par Freewind

    I record some .wav files from microphone, and convert it to mp3 and m4a files. These files can be played with my desktop player correctly.

    Then in my JavaFX program, I play them as:

    String fileUri = file.toURI().toString();
    Media media = new Media(fileUri);
    MediaPlayer mediaPlayer = new MediaPlayer(media);
    mediaPlayer.play();
    

    But there is no sound, and no errors.

    I use ffmpeg to view them:

    ffmpeg -i demo.m4a

    Input #0, aac, from 'demo.m4a':
      Duration: 00:00:54.00, bitrate: 132 kb/s
        Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 132 kb/s
    

    ffmpeg -i hello.mp3

    Input #0, mp3, from 'hello.mp3':
      Metadata:
        encoder         : Lavf57.83.100
      Duration: 00:00:01.12, start: 0.069063, bitrate: 49 kb/s
        Stream #0:0: Audio: mp3, 16000 Hz, stereo, s16p, 48 kb/s
    

    Not sure where is wrong.

  • FFmpeg command works locally but not on Azure Batch Service

    10 août 2018, par Elgert

    I have a command that generates a video with background and text on it with FFmpeg and would like to render it using Azure Batch Service. Locally my command works:

    ./ffmpeg -f lavfi -i color=c=green:s=854x480:d=7 -vf "[in]drawtext=fontsize=46:fontcolor=White:text=dfdhjf dhjf dhjfh djfh djfh:x=(w-text_w)/2:y=((h-text_h)/2)-48,drawtext=fontsize=46:fontcolor=White:text= djfh djfh djfh djfh djf jdhfdjf hjdfh djfh jd fhdj:x=(w-text_w)/2:y=(h-text_h)/2,drawtext=fontsize=46:fontcolor=White:text=fh:x=(w-text_w)/2:y=((h-text_h)/2)+48[out]" -y StoryA.mp4

    while the one generated programatically with C# and added as a task in batch service retursn failure:

    cmd /c %AZ_BATCH_APP_PACKAGE_ffmpeg#3.4%\ffmpeg-3.4-win64-static\bin\ffmpeg -f lavfi -i color=c=green:s=854x480:d=7 -vf "[in]drawtext=fontsize=46:fontcolor=White:text=dfdhjf dhjf dhjfh djfh djfh:x=(w-text_w)/2:y=((h-text_h)/2)-48,drawtext=fontsize=46:fontcolor=White:text= djfh djfh djfh djfh djf jdhfdjf hjdfh djfh jd fhdj:x=(w-text_w)/2:y=(h-text_h)/2,drawtext=fontsize=46:fontcolor=White:text=fh:x=(w-text_w)/2:y=((h-text_h)/2)+48[out]" -y StoryA.mp4

    The ffmpeg configuration works, and also the Pool as I've already tested it with simpler ffmpeg commands which had input and output files. This command doesnt have input file, maybe that is part of the problem ?

    Thank you