Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Is there an ffmpeg option to specify the size of macroblocks in H.264 compression ?

    24 septembre 2019, par MEHDI SAOUDI

    I am setting up a system that extract motion vectors from videos after compressing them in H.264 using FFmpeg

    Is there an FFMPEG H.264 compression option that allows modification of the size of the macroblocks in order to minimize the number of lines of the extracted motion vectors file ?

    In other words, if i change the compression of the mackroblocks from 4x4 to 8x8, I will minimize the size of the file?

    My goal is minimizing the size of the motion vector file. thank you

  • ffmpeg error : could not get mpeg2 profile and level av_interleaved_write_frame() : Operation not permitted

    24 septembre 2019, par A Person

    Getting a weird error could not get mpeg2 profile and level av_interleaved_write_frame(): Operation not permitted and i do not understand how to fix it

    ffmpeg -i video.mpeg -i audio.wav -c copy -map 0:0 -map 1:0 out.mxf

    ffmpeg version N-94821-g976617c7d2 Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 9.1.1 (GCC) 20190807
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
      libavutil      56. 35.100 / 56. 35.100
      libavcodec     58. 56.101 / 58. 56.101
      libavformat    58. 32.104 / 58. 32.104
      libavdevice    58.  9.100 / 58.  9.100
      libavfilter     7. 58.102 /  7. 58.102
      libswscale      5.  6.100 /  5.  6.100
      libswresample   3.  6.100 /  3.  6.100
      libpostproc    55.  6.100 / 55.  6.100
    Input #0, mpegvideo, from 'video.mpeg':
      Duration: N/A, bitrate: N/A
        Stream #0:0: Video: mpeg2video (High), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 50 tbc
    Guessed Channel Layout for Input Stream #1.0 : stereo
    Input #1, wav, from 'audio.wav':
      Duration: 00:07:36.16, bitrate: 1536 kb/s
        Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Output #0, mxf, to 'out.mxf':
      Metadata:
        encoder         : Lavf58.32.104
        Stream #0:0: Video: mpeg2video (High), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
        Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #1:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [mxf @ 000001b5e48f9680] could not get mpeg2 profile and level
    av_interleaved_write_frame(): Operation not permitted
    
  • ffmpeg vcodec copy does not work when start/duration is messed up in video file

    24 septembre 2019, par anishsane

    My Video file shows below meta-data with ffprobe/ffmpeg:

    Duration: 00:44:27.52, start: 1333.760000, bitrate: 335 kb/s
      Stream #0.0(und): Video: h264 (Main), yuv420p, 640x480, 25 tbr, 90k tbn, 50 tbc
    

    Note: The file does not contain audio.

    I am trying to convert this video file to other video file, using ffmpeg/avconv.

    This works: (but encodes h.264 video to mpeg4)

    ffmpeg -i input.mp4 output.mp4
    

    & it generates output file of proper duration (44:27 - 1333 seconds = 22:14)

    This does not work:

    ffmpeg -i input.mp4 -vcodec copy output.mp4
    

    Generates file without video.

    The output contains:

    $ avconv -i input.mp4 -vcodec copy output.mp4
    
    avconv version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
      built on Nov  9 2013 19:09:46 with gcc 4.8.1
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
      Metadata:
        major_brand     : dash
        minor_version   : 0
        compatible_brands: iso6avc1mp41
        creation_time   : 2014-01-19 22:43:21
      Duration: 00:44:27.52, start: 1333.760000, bitrate: 335 kb/s
        Stream #0.0(und): Video: h264 (Main), yuv420p, 640x480, 25 tbr, 90k tbn, 50 tbc
        Metadata:
          creation_time   : 2014-01-19 22:43:21
    Output #0, mp4, to 'output.mp4':
      Metadata:
        major_brand     : dash
        minor_version   : 0
        compatible_brands: iso6avc1mp41
        creation_time   : 2014-01-19 22:43:21
        encoder         : Lavf53.21.1
        Stream #0.0(und): Video: ![0][0][0] / 0x0021, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
        Metadata:
          creation_time   : 2014-01-19 22:43:21
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
    Press ctrl-c to stop encoding
    frame=    0 fps=  0 q=-1.0 Lsize=       0kB time=10000000000.00 bitrate=   0.0kbits/s    
    video:0kB audio:0kB global headers:0kB muxing overhead inf%
    
  • create single video form 3 separate videos using FFmpeg

    24 septembre 2019, par Shijin

    I was trying to create single video form 3 separate videos using FFmpeg.

    ffmpeg -y -loglevel debug  -i /home/ubuntu/test/1569317318/15693173181124138568.webm   -i /home/ubuntu/test/1569317318/1569317318867082351.webm   -i /home/ubuntu/test/1569317318/1569317318191333163.webm  -filter_complex '[0]scale=320:-1[a];[1]scale=320:-1[b];[2]scale=320:-1[c];[3]scale=320:-1[d];[a]pad=640:480[x];[x][b]overlay=320[y];[y][c]overlay=0:240[z];[z][d]overlay=320:240;[0][1]amix'  -c:v libx264   -crf 23   -preset veryfast   -shortest   /home/ubuntu/test/1569317318/1569317318478598265.mp4
    

    This is not woking, It throws an error like bellow

    Invalid file index 3 in filtergraph description [0]scale=320:-1[a];[1]scale=320:-1[b];[2]scale=320:-1[c];[3]scale=320:-1[d];[a]pad=640:480[x];[x][b]overlay=320[y];[y][c]overlay=0:240[z];[z][d]overlay=320:240;[0][1]amix.

    How to fix it? If we provide four inputs, It is working

  • How to increase encoding speed of ffmpeg in adding text/sticker to video ?

    24 septembre 2019, par Gopinathan B

    While adding text/sticker to video using FFMPEG library in android. Processing time is very slow.

    For adding text to video I am using following command -

    cmd = arrayOf("-y", "-i", videoFile!!.path, "-vf", "drawtext=fontfile=" + font!!.path + ": text=" + text + ": fontcolor=" + color + ": fontsize=" + size + border + ": " + position, "-c:v", "libx264", "-preset", "ultrafast", "-c:a", "copy", "-movflags", "+faststart", outputFile.path)
    

    For adding sticker to video I am using following command -

    cmd = arrayOf("-y", "-i", videoFile!!.path, "-i", imagePath!!, "-filter_complex", position!!, "-preset", "ultrafast", "-codec:a", "copy", outputFile.path)
    

    While merging two video files also takes more time -

    cmd = if (havingAudio) {
       arrayOf("-y", "-i", videoFile!!.path, "-filter_complex", ffmpegFS!!, "-map", "[v]", "-map", "[a]", "-preset", "ultrafast", outputFile.path)
    } else {
       arrayOf("-y", "-i", videoFile!!.path, "-filter:v", ffmpegFS!!, "-preset", "ultrafast", outputFile.path) 
    }
    

    I have tried FFmpeg adding image watermark to video process is very slow. But processing time is not increased.

    Help me how to make processing time faster in FFMPEG.