Hot answers tagged

10

Use drawbox for the box, and drawtext for the text. ffmpeg -i input.mp4 -vf \ "format=yuv444p, \ drawbox=y=ih/PHI:color=black@0.4:width=iw:height=48:t=max, \ drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \ format=yuv420p" \ -c:v libx264 -c:a copy -movflags +faststart output.mp4 ...


6

This is possible but will require scripting. ffprobe will be used to determine the duration of the input, then the countdown and background box will be created by the drawtext filter. A 30 second input will start from 30 and count down to 0. Example: input=input.mp4 duration=$(ffprobe -loglevel error -show_entries format=duration -of default=nw=1:nk=1 ...


5

Using the latest ffmpeg General users should always use ffmpeg from the current git master branch (the latest code available): When encountering an issue the first thing to do is check to see if you are using a build from git master. It is considered stable. It will have more bug fixes and features. FFmpeg development is very active. If you want to get ...


5

-select_streams If you only want the information from the first video stream, then add this to your command: -select_streams v:0 duration Note that duration may be missing or incorrect; especially with damaged files. You can always compare it with the output of: ffmpeg -i input -f null - Then look at time= in the second to last line. This will decode ...


5

This should do it: ffmpeg -i input.mp4 \ -filter_complex "[0:v] crop=iw/3:ih:0:0,pad=iw:2*ih [left]; \ [0:v] crop=iw/3:ih:(iw/3)+1:0 [middle]; \ [0:v] crop=iw/3:ih:(2*iw/3)+1:0 [right]; \ [left][middle] overlay=0:main_h/2,pad=iw:(3*ih/2) [out1]; \ [out1][right] overlay=0:(2*main_h/3) [fout] " \ -c:v libx264 -an -map "[fout]" ...


5

I'm not well-versed with Unix shell scripting, and also only have basic proficiency in Windows scripting, so I can only offer a pseudocode flow of the script: 1) Break up your full video into N-second segments of only audio (into a temporary folder) ffmpeg -i GoProFull.mp4 -vn -c:a copy -segment_time n -f segment GP%03d.mp4 Obviously, this will generate ...


5

The fs parameter will stop the encode once it hits its value. So, if the output hits the 10MB mark while encoding the 15th second, then that's the duration of your output file. If you want to make sure that the entire file is encoded but it doesn't cross the set target size, then use the bitrate method. To accommodate the muxing overhead and other data ...


5

MPEG-2 doesn't seem to be an officially sanctioned codec for the Quicktime container. The official specification has a section related to MPEG-1 in MOV but not MPEG-2. The US Library of Congress also does not have an entry for the subtype MPEG-2 in MOV, like it does for MPEG-1 (just called QTV_MPEG). So, there's no official word on "allowable alternative ...


4

Your current method using the concat demuxer while stream copying is probably the fastest (I'm just counting the ffmpeg time and not any time you take to enter the additional commands). Unfortunately, you have to perform several steps, but the advantage is that your non-filtered segments are not being re-encoded which preserves quality and results in fast ...


4

This should work faster... ffmpeg -ss 1:00 -t 5 -i in.mkv -ss 2:00 -t 5 -i in.mkv \ -filter_complex "[0][1]concat=n=2:v=1:a=1" \ out.mkv There's no need to specify -t on the output. There's no need to split the audio and video before the concat.


4

Hope this explanation is what you're looking for: When you transcode to an encoding such as H.264 (MPEG-4 part 10) you necessarily also resample the video, that's part of H.264 compression technique. Nontheless, I doubt if this is the reason you experience a timing gap since the resampling doesn't necessarily influence the clock rate of the media. So, I ...


4

BTW, this question might be better on stackoverflow, or maybe unix.stackexchange, or maybe serverfault. This site is I think less focused on questions that don't involve decisions based on creative merit or at least perceptual video / audio quality. However, I'm all about the tech details, so I'll answer. FFmpeg uses multi-threading by default, so you ...


4

From https://trac.ffmpeg.org/wiki/FFprobeTips If you want to get the bit_rate of the 1st video stream you could use: ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 input.mp4 Where -select_steams v:0 is selecting the 1st video stream and :nokey=1 gives the value without the key. You could also ...


4

Using crop and vstack: ffmpeg -i input -filter_complex \ "[0:v]crop=iw/3:ih:0:0[left]; \ [0:v]crop=iw/3[center]; \ [0:v]crop=iw/3:ih:ow*2:0[right]; \ [left][center][right]vstack=inputs=3[v]" \ -map "[v]" -map 0:a -c:a copy output vstack is faster than pad + overlay. If your ffmpeg is too old for the vstack filter then just download a recent build.


4

Here's a way to do it with the blackdetect and trim filters. First, a better way to get the blackdetect output is via ffprobe because it is capable of writing structured data such as XML, JSON or one key=value per line. You do this using metadata injection: ffprobe -f lavfi -i "movie=/path/to/input.mp4,blackdetect[out0]" -show_entries ...


4

The CRF scales for x264 and x265 do not correspond. x265 CRF 28 is supposed to be equivalent to x264 CRF 23. But x265 is not yet as mature in its development as x264, so take that CRF equivalence with a pinch of salt. That said, you can try to establish your own calibration between the current versions of the encoding libraries in your ffmpeg by running ...


4

I am the author of the original Calf plugin, I had no idea it was being used in FFmpeg, great! The original plugin used to have a sidechain input to use as the level detection, but I am assuming the ported version just uses the input signal as this level. The main parameter is the threshold, it sets the level below which gating begins to occur. Having 0 ...


4

As you are hardcoding subtitles, the video (with the subtitles added) will be re-encoded. You can use the CRF rate control method to modulate the quality of the output. So, start with ffmpeg -i grdedFinal.mov -vf subtitles=portSbs.srt -crf 18 -c:a copy gradedFinalwithSubs.mov If the quality's not acceptable, lower that value till it is - in exchange ...


4

You're trying to store an AAC stream in a MP3 container, would be my guess. Either store the result as "${i%.mp3}-ENCODED.aac" or switch -c:a aac to -c:a libmp3lame


3

libtheora is single threaded. There is a multithreaded experimental build, but is not maintained. I would suggest running it in parallel with the other encodes. Also if possible use libfdk-aac over libfaac. Much higher audio fidelity at the same bitrate.


3

This was bug in atrim filter, not supporting unknown channel layouts, it should be fixed in latest ffmpeg.


3

At least on FFmpeg 2.8.x (but oldie should works too) you can use lavfi as input format and complex filter graph using movie and setpts filters as a argument for -i option. Next command doing this work for you: ffmpeg -re -f lavfi -i "movie=filename=input.mp4:loop=0, setpts=N/(FRAME_RATE*TB)" output.mp4 Zero loop= arguments means infinity loop. Values ...


3

HDV camera, right? It's not untypical for cameras to claim higher resolution than they actually scan. In such cases you have to look at the different aspect ratios involved: pixel, frame, display, sample. Here's a post that discusses this, or google "HDV aspect ratio". And here's a link to the spec from the HDV consortium. It's essentially anamorphic. The ...


3

Rather than using constant bitrate, have a go using constant quality (AKA constant rate factor, or crf). So instead of -b:v 2000 use -crf 23 (adjust the number to change the quality, higher is smaller / lower quality and lower is larger / better quality). Constant quality usually gives you more bang for your bits, as it skimps on bitrate where it's not ...


3

If your question was Where are these pixel formats defined? Go to http://ffmpeg.org/download.html and download the source of ffmpeg. Then unpack it tar -xavf FILENAME.tar.* and descend to the folder in the source code that is called libavutil cd ffmpeg-*/libavutil/ and open the file pixfmt.h where you will find a description of all pixel formats. ...


3

MPEG -TS. See here: All MPEG-2 TS operations from GPAC (client and MP42TS) are supported on HEVC. MP42TS can be used to generate TS files usable for DASH or for injection in modulation chains; it can also be used to send the TS over an UDP or RTP stream in unicast or multicast mode


3

The end of the filter chain should output full RGB, like this: Windows batch: ffmpeg.exe -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" ^ -filter_complex ^ scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),^ pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,^ format=rgb24 franck-padded.jpg ...


3

Judge based on the quality rather than the bitrate value. Use CRF mode encoding and if the quality isn't what you can accept, decrease the CRF value. ffmpeg -i "%%a" -s 3840x2610 -c:v libx264 -crf 18 -acodec copy D:\%%~na.mp4


3

While I always guessed that the big / little endian was more a matter of patents rather than performance, Nope little endian was developed as a performance optimization whern moving to multi byte words. https://en.wikipedia.org/wiki/Endianness#Optimization Nothing to to with patents. Different representation have different advantages and disadvantage. ...


3

The order of the components in RGB32 seems to do with endianness: PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA color is put together as: (A << 24) | (R << 16) | (G << 8) | B This is stored as BGRA on little-endian CPU architectures and ARGB on big-endian CPUs. The descriptions of the various related formats ...



Only top voted, non community-wiki answers of a minimum length are eligible