Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg - SIGSTOP generate moov atom

    6 juin, par user2828522

    I use ffmpeg in a script that does "motion detection".

    The principle is as follows:

    • ffmpeg is launched then immediately stopped with a "killall -s STOP ffmpeg";

    • at each motion detection, a "killall -s CONT ffmpeg" is sent to the program in order to record the sequence;

    • after X seconds, a "killall -s STOP ffmpeg" is sent pending a new motion detection.

    When ffmpeg records following a SIGCONT, it is possible to properly stop ffmpeg with a "killall -s QUIT ffmpeg" and thus generate the atom moov. However, I can't find a way to properly stop ffmpeg and generate the atom moov afterwards at a SIGSTOP. "killall -s QUIT ffmpeg" has no effect on a SIGSTOP ...

    In summary, how can we generate the moov atom when ffmpeg is on SIGSTOP?

  • FFMPEG : embed current time in milliseconds into video [closed]

    5 juin, par stevendesu

    I would like to embed the computer's local time in milliseconds into a stream using FFMPEG.

    I can embed the local time in seconds using drawtext like so:

    ffmpeg -i  -vf "drawtext=text='%{localtime\:%T}'" -f flv 
    

    Looking through the documentation for drawtext, doing some tests, and Googling around, it seems like localtime and gmtime don't provide milliseconds -- just seconds. However the pts options does have milliseconds:

    ffmpeg -i  -vf "drawtext=text='%{pts\:hms}'" -f flv 
    

    I also found out that pts supports an offset, so I was able to use something like this to display local time (kind of):

    ffmpeg -i  -vf "drawtext=text='%{pts\:hms\:$(date +%s.%N)}'" -f flv 
    

    This had two problems:

    1. It displayed something like 17499:17:29 for the time... I found a (rather complex) way to work around this
    2. It uses the server's current time when you first run the ffmpeg command as the offset -- not the server's current time when ffmpeg actually starts decoding video. I noticed ffmpeg had about a 2-second startup time, causing the clock to be off by roughly 2 seconds

    Is there a way to modify my solution, or an entirely separate solution, that can embed server local time in milliseconds into the stream?

  • Building ffmpeg-kit for android

    5 juin, par kish0n

    I want to create an AAR dependency for my Android project, where I only convert video to audio files and use ffprobe to extract media information. https://github.com/arthenica/ffmpeg-kit

    I am using the below command for generating the AAR file:

    ./android.sh -d --enable-android-media-codec --enable-android-zlib --enable-lame --enable-shine --enable-opus --enable-libvorbis --disable-arm-v7a-neon --disable-x86 --disable-x86-64 --disable-arm-v7a

    When I import the AAR file to my project I get this error in the runtime:

    java.lang.ClassNotFoundException: Didn't find class "com.arthenica.smartexception.java.Exceptions" on path: DexPathList[[zip file "/data/app/~~jEhW86BHvWX75oI4OlJ1Ew==/com.pkappstudio.mediatools-jxJu72Vroc6h16UeNwn0Mw==/base.apk"],nativeLibraryDirectories=[/data/app/~~jEhW86BHvWX75oI4OlJ1Ew==/com.pkappstudio.mediatools-jxJu72Vroc6h16UeNwn0Mw==/lib/arm64, /data/app/~~jEhW86BHvWX75oI4OlJ1Ew==/com.pkappstudio.mediatools-jxJu72Vroc6h16UeNwn0Mw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]

    Now, could anyone please help me to solve the issue, and tell me the correct way to genrate AAR file for only video to auto conversion and ffprobe. My ultimate goal is to minimize the app size.

  • Scrolling Effect of an Image using FFmpeg [closed]

    5 juin, par neeebzz

    I want to create an mp4 video of 40 seconds where an image just floats from top to bottom and vice versa.

    I am using the following ffmpeg command:

    ffmpeg 
        -loop 1 
        -t 40 
        -i ./input.jpg 
        -filter_complex [0]scale=800:-1[s0];[s0]crop=h=450:w=800:x=0:y=(ih-450)*(3*pow(t/40.241\,2) - 2*pow(t/40\,3))[s1];[s1]scale=800:400[s2] 
        -map [s2] 
        -pix_fmt yuv420p 
        -preset medium 
        -r 30 
        -vcodec libx264 
        ./output.mp4 -y
    

    The animation is working as expected however the motion is very jerky. How can I smooth it out?

    Ffmpeg version:

    ffmpeg version 5.1.6-0+deb12u1 Copyright (c) 2000-2024 the FFmpeg developers
    
  • I am really confused with this kind of compilation error( C ffmpeg Qt)

    4 juin, par David Tree

    I downloaded the latest ffmpeg source code and successfully installed it on Ubuntu But I failed to compile a simple demo.(I did included proper headers)

    Here are the error messages ,just to name a few:

    error: unknown type name 'AVFrame'
    
    error: 'NULL' undeclared (first use in this function)
    
    error: request for member 'streams' in something not a structure or union
    
    error: 'AVMEDIA_TYPE_VIDEO' undeclared (first use in this function)
    
    error: expected expression before ')' token
    

    Can you help me solve this problem?

    Contents Added:

    e.g this is my includes

    extern "C"{
    #include avcodec.h>
    #include avformat.h>
    #include swscale.h>
    #include avutil.h>
    }
    
    int main(int argc, char *argv[]) {
    AVFormatContext *pFormatCtx;
    int i, videoStreamIdx;
    AVCodecContext *pCodecCtx;
    AVCodec *pCodec;
    AVFrame *pFrame;
    AVFrame *pFrameRGB;
    

    e.g AVFormatContext is declared in /usr/include/libavformat/avformat.h error message box shows Unknown type name AVFormatContext But How could it possibly be?