Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Changing Audio Volume using FFmpeg Android

    23 août 2018, par kataroty

    As I have understood, the only way to change FFmpeg volume is to do it throught a command line.

    This is what should change the volume of the audio :

    ffmpeg -i input.wav -filter:a "volume=1.5" output.wav
    

    Now I have used FFmpeg with command line before and it looked like this and gave me no errors:

        String[] cmd = { "-i" , pcmtowavTempFile.toString(), "-i", mp3towavTempFile.toString(), "-filter_complex", "amix=inputs=2:duration=first:dropout_transition=3", combinedwavTempFile.toString()};
        ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
            @Override
            public void onSuccess(String message) {                
                super.onSuccess(message);
                encodeWavToAAC();
            }
            @Override
            public void onFailure(String message) {
                super.onFailure(message);
                onError(message);
            }
        });
    

    But If I try to do it with audio volume in the same method, it just ignores it :

        String[] cmd = { "-i" , pcmtowavTempFile.toString(),  "-filter:a", "volume=1.3", pcmtowavTempFile.toString()};
        ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
            @Override
            public void onSuccess(String message) {
                super.onSuccess(message);
            }
            @Override
            public void onFailure(String message) {
                super.onFailure(message);
    
            }
        });
    

    I get neither, no success or error message with the last volume change method.

    Since the volume is there between " ", I tried adding this :

    String[] cmd = { "-i" , pcmtowavTempFile.toString(),  "-filter:a", "\"volume=1.3\"", pcmtowavTempFile.toString()};
    

    But the app started crashing after adding this line.

  • FFMPEG download m3u8 faster

    23 août 2018, par Bruno Andrade

    I have a server with 1 Gbps port speed where I am trying to download m3u8 videos from a website. But he is very slow. I want to know if there is something in my ffmpeg code that I can do to make it get faster?

    ffmpeg -hide_banner -loglevel verbose -n -i http://example.com/list.m3u8 -map 0:4 -map 0:5 -acodec copy -bsf:a aac_adtstoasc -vcodec copy video.mp4 1> log.tx  2>&1
    

    Does the CPU influence this type of ffmpeg download? What I understand of the code is that it is saying not to encode anything. Download the same video is on the site. So CPU processing would not influence the speed correct?

  • FFMPEG outputs stream to UDP port, but no packets received on that port

    23 août 2018, par user10260735

    I am a bit new to FFMPEG and will appreciate any help I can get! Basically, I am trying to transcode a 'webm' UDP stream to Opus audio stream, and then finally output that to a specific UDP port on my network.

    This is the command I am using:

    ffmpeg -re -i udp://127.0.0.1:2222 -vn -map 0:a -c:a libopus -f ogg udp://127.0.0.1:2224
    

    However, when I check on port 2224, I do not receive any packets.

    FFMPEG is definitely receiving the input packets because if I run the following command, the file plays out perfectly:

    ffmpeg -re -i udp://127.0.0.1:2222 -vn -map 0:a -c:a libopus -f test.opus
    

    Does anyone have any suggestions on what mistake I am making?

  • fluent-ffmpeg video merge with hardware acceleration using NVIDIA graphics card

    23 août 2018, par krisalay

    I am trying to concatenate videos to one single .mp4 file.

    If I am not using hardware acceleration then the merge is working fine.

    However, when I provide -hwaccel cuvid as inputOptions and -c:v h264_nvenc as outputOptions then it throws error:

    ffmpeg exited with code 1: 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

    The code:

    ffmpeg
    .input('video1.mp4')
    .input('video2.mp4')
    .inputOptions(['-loglevel error','-hwaccel cuvid'])
    .outputOptions('-c:v h264_nvenc')
    .mergeToFile('filepath.mp4')
    

    What could be the possible reason for the error? And what can be the solution to resolve the error?

  • Changing Audio Volume using FFmpeg Android Error

    23 août 2018, par kataroty

    I am using FFmpeg and I need to change the volume of the Audio.

    This is the command that should change the volume of the audio :

    ffmpeg -i input.wav -filter:a "volume=1.5" output.wav
    

    I read from somewhere that it had to overwrite the file if it already existed so either one had to delete the file or use -y. When I tried to do it without the -y command it never got to onSuccess() or ´onFailure(), but it always printed out the onStart() message.

    String[] cmdy = { "-i -y" , pcmtowavTempFile.toString(),  "-af", "volume=5", pcmtowavTempFile.toString()};
        ffmpeg.execute(cmdy, new ExecuteBinaryResponseHandler() {
    
            @Override
            public void onStart() {
                System.out.println("ayy: onStart");
            }
    
            @Override
            public void onSuccess(String message) {
                System.out.println("ayy: onSuccess");
                super.onSuccess(message);
            }
            @Override
            public void onFailure(String message) {
                System.out.println("ayy: onFailure " + message);
                super.onFailure(message);
            }
    });
    

    At the moment I get this error:

    ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 4.9.x (GCC) 20150123 (prerelease)
      configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
      libavutil      56. 14.100 / 56. 14.100
      libavcodec     58. 18.100 / 58. 18.100
      libavformat    58. 12.100 / 58. 12.100
      libavdevice    58.  3.100 / 58.  3.100
      libavfilter     7. 16.100 /  7. 16.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  1.100 /  5.  1.100
      libswresample   3.  1.100 /  3.  1.100
      libpostproc    55.  1.100 / 55.  1.100
    Unrecognized option 'i -y'.
    

    Which clearly states that it does not recognize option i -y, but also as I said earlier then if I remove the -y it never gets to onSuccess() or onFailure().

    help me to find a solution. Thanks.