Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • get specific metadata with ffprobe

    1er mai, par mikem

    I'm having a terrible time getting one single line of metadata from ffprobe.

    I'm running this command:

    ffprobe -show_entries 'stream_tags : format_tags=com.apple.quicktime.creationdate' -loglevel error IMG_9931.MOV

    And I get this output

    [STREAM]

    TAG:creation_time=2022-05-14T20:24:55.000000Z

    TAG:language=und

    TAG:handler_name=Core Media Video

    TAG:encoder=H.264

    [/STREAM]

    [STREAM]

    TAG:creation_time=2022-05-14T20:24:55.000000Z

    TAG:language=und

    TAG:handler_name=Core Media Audio

    [/STREAM]

    [STREAM]

    TAG:creation_time=2022-05-14T20:24:55.000000Z

    TAG:language=und

    TAG:handler_name=Core Media Metadata

    [/STREAM]

    [STREAM]

    TAG:creation_time=2022-05-14T20:24:55.000000Z

    TAG:language=und

    TAG:handler_name=Core Media Metadata

    [/STREAM]

    [STREAM]

    TAG:creation_time=2022-05-14T20:24:55.000000Z

    TAG:language=und

    TAG:handler_name=Core Media Metadata

    [/STREAM]

    [FORMAT]

    TAG:com.apple.quicktime.creationdate=2022-05-14T16:24:55-0400

    [/FORMAT]

    But the only thing I want returned is

    com.apple.quicktime.creationdate=2022-05-14T16:24:55-0400

    I've searched and searched but I can't find any examples of pulling a single specific value of metadata.

    In actuality, I really just want the value of com.apple.quicktime.creationdate... ie "2022-05-14T16:24:55-0400"

    I know I can grep and awk my way through it, but it seems like there should be a way to do it with ffprobe alone given all of the options it has. I just can't figure out how.

    How can I do this? Any help would be appreciated.

  • Why can't I seek using PTS while reading an MXF file until av_write_trailer() is called ?

    1er mai, par Summit

    I'm writing an MXF file using FFmpeg in C++ and then reading it back for real-time playback. However, I'm running into a problem: seeking by PTS (av_seek_frame()) doesn't work properly until I call av_write_trailer() at the end of the writing session.

    Here’s the workflow:

    I'm encoding and writing frames to an MXF file using avformat_write_header() and av_interleaved_write_frame().

    I want to read from the same file while it’s still being written (like a growing file or EVS-style live playback).

    But seeking using av_seek_frame() to a specific PTS fails or behaves incorrectly until I finalize the file with av_write_trailer().

    Here is a simplified version of my writing logic:

    avformat_write_header(formatContext, nullptr);
    // ... loop ...
    avcodec_send_frame(codecContext, frame);
    avcodec_receive_packet(codecContext, &pkt);
    av_interleaved_write_frame(formatContext, &pkt);
    // NO call to av_write_trailer() yet
    

    And this is how I try to seek in the reading logic:

    av_seek_frame(inputFormatContext, videoStreamIndex, targetPts, AVSEEK_FLAG_BACKWARD);
    
  • Flutter ffmpeg_kit_flutter_full_gpl-6.0.3 PluginRegistry.Registrar flutter version 3.29

    30 avril, par Lisa

    I am using ffmpeg_kit_flutter_full_gpl-6.0.3 for flutter version 3.27 but when upgrading to flutter 3.29, with android, there is an error PluginRegistry.Registrar registrar. Is there any solution to replace the current ffmpeg_kit_flutter_full_gpl because I see this library was updated 17 months ago

    /Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java:157: error: cannot find symbol
        public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
                                                                                     ^
      symbol:   class Registrar
      location: interface PluginRegistry
    /Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java:651: error: cannot find symbol
        protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final io.flutter.plugin.common.PluginRegistry.Registrar registrar, final ActivityPluginBinding activityBinding) {
                                                                                                                                                    ^
      symbol:   class Registrar
      location: interface PluginRegistry
    2 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':ffmpeg_kit_flutter_full_gpl:compileReleaseJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * Try:
    > Run with --info option to get more log output.
    > Run with --scan to get full insights.
    

    Is there any alternative?

  • Difference behaviour between Ubuntu and Windows for popen, _popen

    30 avril, par Humam Helfawi

    I need to open FFMPEG pipe and write frames data to that pipe. I am using this code:

    #ifdef _WIN32
    #define POPEN _popen
    #define PCLOSE _pclose
    #else
    #define POPEN popen
    #define PCLOSE pclose
    #endif
    
    // FFmpeg command to receive raw BGR24 data and encode with libx264
    std::ostringstream oss;
    oss << "ffmpeg -y -f rawvideo -pixel_format bgr24 "
        << "-video_size " << width << "x" << height << " "
        << "-framerate " << fps << " -i - "
        << "-c:v libx264 -preset ultrafast "
        << "" << video_path << "";
    std::string cmd = oss.str();        
    #ifdef _WIN32
    auto mode = "wb";
    #else
    auto mode = "w";
    #endif
    pipe_ = POPEN(cmd.c_str(), mode);
    if (!pipe_) {
        throw std::runtime_error("[FFmpegWriter::FFmpegWriter] FFmpeg pipe could not be oppnened");
    }
    

    The writing (in loop) looks like:

    size_t written = fwrite(img.data, 1, img.total() * img.elemSize(), pipe_);
    

    This works fine but it is much slower on Ubuntu (while writing frames) than it is on Windows. The wb option does not work on ubuntu and return empty pipe_. What exactly the problem here:

    1. Why wb does not work on Ubuntu?
    2. if w is the way to go on Ubuntu, why it is much slower than windows (2-3X)?
  • FFmpeg webcam image capture from default Windows webcam

    29 avril, par Mark Ryan

    I want to capture a webcam image from my default Windows webcam without specifying the webcam name and save it as a JPG. I also want to scale and crop it to 640x480. I have come up with -

    ffmpeg -f dshow -i "video=EasyCamera" -vf scale=-1:480,crop=640:480 -frames:v 1 test.jpg -y

    And it works fine, but I want to be able to be able to capture the image without having to specify the camera name. Is this possible?

    I have been able to do it with the following -

    ffmpeg.exe -f vfwcap -i 0 -vf scale=-1:480,crop=640:480 -frames:v 1 test.jpg -y

    But vfwcap is very old & I shouldn't be using it.

    Sorry if this is a very basic question but I am new to FFmpeg and have spent a long time try to figure this out. Any help would be greatly appreciated