Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Accurate progress update using FFmpeg

    16 mai 2019, par ClassA

    I'm currently showing the progress inside onProgress, as shown below:

    @Override
        public void onProgress(String message) {
    
            Pattern pattern = Pattern.compile("time=([\\d\\w:]{8}[\\w.][\\d]+)");
    
            if (message.contains("speed")) {
                Matcher matcher = pattern.matcher(message);
    
                if (matcher.find()) {
                    String tempTime = String.valueOf(matcher.group(1));
                    String[] arrayTime = tempTime.split("[:|.]");
    
                    long currentTime = TimeUnit.HOURS.toMillis(Long.parseLong(arrayTime[0]))
                                + TimeUnit.MINUTES.toMillis(Long.parseLong(arrayTime[1]))
                                + TimeUnit.SECONDS.toMillis(Long.parseLong(arrayTime[2]))
                                + Long.parseLong(arrayTime[3]);
    
                    //Length of video in milliseconds
                    long timeToExportInMillis = rightThumbTimeRef - leftThumbTimeRef;
    
                    //Calculate percentage
                    long percent = 100 * currentTime / timeToExportInMillis;
    
                    //Set percentage to TextView
                    percentText.setText(percent + " %");
    
                }
            }
        }
    

    The problem I have is that the progress gets updated like this:

    0 - 9 - 17 - 30 - 38 etc. (till 100)

    I would like to show the progress without skipping values, like:

    0 - 1 - 2 - 3 - 4 etc. (till 100)


    I'm not even sure if this is possible because the update of currentTime (above) depends on FFmpeg's progress output, any advice would be appreciated.

  • ffmpeg converting mov to mp4

    16 mai 2019, par alienbuild

    Trying to convert .mov to .mp4. Tried various suggestion codes on stackoverflow but nothing seems to be working.

    `...muxer does not support non seekable output [48] => Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument [49] => Error initializing output stream 0:0 -- [50] => Conversion failed! ) 1`
    

    I've tried various codec properties such as ac3, aac, libvo_aacenc

    exec('
    /usr/local/bin/ffmpeg -y -i https://***.***.com/assets/regions/region-1/input.mov' . 
    ' -c:a ac3 ' 
    . 'https://***.***.com/assets/regions/region-1/output.mp4' 
    . ' 2>&1', $out, $res);
    
    $modx->log(modX::LOG_LEVEL_ERROR, print_r($out));
    $modx->log(modX::LOG_LEVEL_ERROR, $res);
    
    return true;
    
  • Chop video in parts

    15 mai 2019, par Reckless Velociraptor

    I tried to use this command:

    ffmpeg -i "in.mp4" -codec copy -map 0 -f segment -segment_list out.txt -segment_times 01:00:00,01:00:00,01:00:00 out%03d.mp4

    and expected 1hour long parts. But this is not what I get. What is correct syntax for -segment_times?

  • Conversion to HEVC using FFmpeg produces video s incompatible with Keynote, but Handbrake works

    15 mai 2019, par Gabriel

    I have a video ( https://www.dropbox.com/s/01rg7rgarqfruy3/Spore%20-%20Assymetrical%20Creatures%2C%20excerpt.mov?dl=0 ) that I want to convert to HEVC (H265).

    When I convert it using Handbrake, it produces an output video that I can then include in a presentation in Keynote.

    When I convert it using ffmpeg on the command line myself, then the output cannot be included in a Keynote presentation; the error message I get is "Operation could not be completed". The ffmpeg version plays fine in Quicktime Player, though. I have already googled, but could not find a solution to the mystery. Also, I have already looked at Handbrake's Activity Log, but could not find a substantial difference . I have already tried to change some of the options and parameters I usually use for running ffmpeg, to no avail.

    Question is: how do I have to run ffmpeg, which options should I use, so that the output can always be included in Keynote?

    Note that some ffmpeg output videos can be inserted in Keynote. I know that I could, of course, always use Handbrake to manually convert the videos, but I'd rather use ffmpeg on the command line so that I can convert lots of my videos in batch.

    Steps to reproduce the problem:

    Convert this video https://www.dropbox.com/s/01rg7rgarqfruy3/Spore%20-%20Assymetrical%20Creatures%2C%20excerpt.mov?dl=0
    using Handbrake using the H265 codec.

    Convert it also using ffmpeg. My command line is: /opt/local/bin/ffmpeg -loglevel level+info -hide_banner -nostats -nostdin -i "Spore - Assymetrical Creatures, excerpt copy.mov" -map 0 -map -0:v:1 -c:s copy -map_metadata 0 -map_metadata:s:v 0:s:v -dn -map_metadata:s:a 0:s:a -c:a aac -b:a 128k -filter:v crop=in_w-mod(in_w\,2):in_h-mod(in_h\,2) -codec:v hevc -tag:v hvc1 -max_muxing_queue_size 1024 -preset faster -crf 25 -x265-params me=umh:subme=5:ref=4:aq-mode=2:aq-strength=1.0:psy-rd=2.0:psy-rdoq=1.0:rd=6:profile=main:log-level=2 -ignore_unknown -f mp4 "Spore - Assymetrical Creatures, excerpt copy.h265.mp4_converting"

    Go to Keynote / Insert / Choose .. , select the video (either the Handbrake or the ffmpeg version).

    My HandBrake version (e.g., 1.0.0):
    Version 1.2.0 (2018122200)

    My ffmpeg version:

      built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
      configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-libjack --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --disable-securetransport --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-version3 --enable-libsmbclient --enable-nonfree --enable-libfdk-aac
      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
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  3.100 /  5.  3.100
      libswresample   3.  3.100 /  3.  3.100
      libpostproc    55.  3.100 / 55.  3.100
    

    Operating system and version:
    macOS 10.14.3 (Mojave)

    Handbrake log: https://www.dropbox.com/s/4zsn7b2agwwyu1x/Spore%20-%20Assymetrical%20Creatures%2C%20Excerpt%201%202019-04-29%2014-44-28.txt?dl=0

    CLI ffmpeg log: https://www.dropbox.com/s/qx2wf1h5svbrjbc/Spore%20-%20Assymetrical%20Creatures%2C%20Excerpt%201%20-%20ffmpeg%20cli.txt?dl=0

    Output from Console.app, which occurred at the point when I tried to insert the ffmpeg version of the video, filtered by "keynote": https://www.dropbox.com/s/2oam7cp3az9kp34/Console-keynote-output.txt?dl=0

    Here are the logs of ffmpeg when I run ffmpeg -i ... on the video that was output by ffmpeg, and for the video output by Handbrake (as suggested by Gyan):
    https://www.dropbox.com/s/kddpit4sbq8vdhp/log_on_ffmpeg_result.txt?dl=0
    https://www.dropbox.com/s/v8n1ihgsp4tdwvp/log_on_handbrake_result.txt?dl=0

    Any hints, suggestions , or insights will be highly appreciated.

    Best regards, Gabriel

  • I want to upload a camera video stream to Amazon S3 and download it to an Android phone. I'm completely new to this. How can I do this ?

    15 mai 2019, par jwu

    I'm really dumb and new to RTP/SIP. Is there a stack that's recommended for uploading video to the cloud from a camera attached to a microprocessor? What's the difference between all the things I'm seeing - MPEG DASH, Live555, ffmpeg, and so on...?

    How does WhatsApp or Dropcam transmit live video?