text:
ffmpeg: explicitly tag h.264 as bt.601, rather than leaving unspecified?
I want to tag video as explicitly bt.601, rather than "unspecified".  I know players typically choose bt.601 as the default for videos less than 1280 pixels wide, but I want to make it explicit that bt.601 is the correct colour matrix for a video.
The sticking point is that there is no bt601 option for ffmpeg or libx264, only bt709 and some others.
I have some videos that were downscaled from HD, and are still in bt.709, but aren't tagged properly.  So when I watch a video, I sometimes have to manually toggle my player to bt.709.  Tagging explicitly as bt.601 will communicate to future viewers (e.g. myself) that it's definitely bt.601, and not a mis-tagged bt.709 video, when I look at it with mediainfo.
Another use-case for this would be if you upscaled a bt.601 video to 1280 or higher without doing a colormatrix conversion (using -vf colormatrix), players would incorrectly assume bt.709 if you left the color information unspecified.
FFMpeg's colormatrix video filter does support bt601 as an input or output color matrix, but doesn't also set tags.  (Since it doesn't have the side-effect of setting ffmpeg's color options, it refuses to even operate with src and dest the same, like -vf colormatrix=bt601:bt601.)

ffmpg in  -color_primaries bt709 -color_trc bt709 -colorspace bt709  out

will tag the output video as using bt.709 for yuv<->rgb.  The tags end up inside the video bitstream itself, not just in the container (since this is seems to be a codec-specific thing, not a container thing, for mp4 and mkv containers at least).
e.g. mediainfo output:
Complete name             : out.mkv
...
Writing application                      : Lavf57.14.100
Writing library                          : Lavf57.14.100

Video
ID                                       : 1
Format                                   : AVC
...
Writing library                          : x264 core 148 r2638+4 afcf21c
Encoding settings                        : cabac=1 / ref=8 / ...
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

So bt.709 is easy to tag.  The problem is, I don't see bt.601 anywhere.  Is one of other names an alias for it, or is there really no way to specify it explicitly?
x264 --fullhelp output:

  --colorprim <string>    Specify color primaries ["undef"]
                              - undef, bt709, bt470m, bt470bg, smpte170m,
                                smpte240m, film, bt2020
  --transfer <string>     Specify transfer characteristics ["undef"]
                              - undef, bt709, bt470m, bt470bg, smpte170m,
                                smpte240m, linear, log100, log316,
                                iec61966-2-4, bt1361e, iec61966-2-1,
                                bt2020-10, bt2020-12
  --colormatrix <string>  Specify color matrix setting ["???"]
                              - undef, bt709, fcc, bt470bg, smpte170m,
                                smpte240m, GBR, YCgCo, bt2020nc, bt2020c

ffmpeg -h full  shows the same set of options for its color options, which ffmpeg's -c:v libx264 video codec passes on to x264.  Is any of these an alias for bt.601, or have a numerically equivalent colour matrix?

I have the exact same problem. Did you figure out the command line to use to get h264 HD footage tagged with BT.601?

@Casper: yes, I accepted Mulvya's answer because it was plenty of info to look up the right options.  I made an edit to include the right options explicitly (e.g. NTSC is -color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m).

PAL and NTSC have different color primaries, so
NTSC = SMPTE 170M = BT 601 525
PAL = BT 470 BG = BT 601 625
See the rows for value 5 & 6 on the table on page 387 of the active H.264 standard.

So the right args for ffmpeg are:
NTSC:
# NTSC
ffmpeg -i input  \
 -colorspace smpte170m -color_primaries smpte170m -color_trc smpte170m

mediainfo:
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601

PAL:
-color_trc doesn't accept bt470bg, but ffmpeg -h full shows that gamma28 means "BT.470 BG" for that option.
# PAL
ffmpeg -i input  \
 -colorspace bt470bg -color_primaries bt470bg -color_trc gamma28

mediainfo:
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.470 System B, BT.470 System G
Matrix coefficients                      : BT.601

-colorspace is the most important option; the others don't make a visible difference for software players like mpv on Linux.

Ah of course.  I was even looking at the bt601 wikipedia page, and didn't clue in from the table having two rows.  Derp.

For those looking to do this same setting with HandBrake, under the Video tab, inside the Extra Options edit box, enter this string: "colorprim=smpte170m:transfer=smpte170m:colormatrix=smpte170m"


text:
How to split video into multiple files based on chapter markers?
Is there a way to automatically split a video into multiple files based on chapter markers?
I don't want to re-encode the file, just a video/audio passthru.
The source file is a MKV container, but I guess it doesn't really matter.
Apple OS X, Windows… either OS would be fine.

Use ffmpeg to split file by chapters

mkvmerge, a part of MKVtoolnix, will split a MKV file by chapters.
Basic syntax is
mkvmerge -o chapter.mkv --split chapters:all input.mkv

but see Section 2.5 #7 of the documentation for more details.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Removing MP4 encoding information
Is it possible to remove certain information form a MP4 file? Specifically things like tagging and encoding dates, Writing library and application, Encoding settings... No client needs to know when I encoded something or what software and settings I've used.
My only guess was to remux the file with ffmpeg, but that only gets rid of the dates and replaces the writing application info with the more generic Lavf.
I'm on Windows, btw, but MacOS and Linux (Ubuntu) would work as well.

Regular ffmpeg won't do this. You'll need a combination of two tools to carry this out.
#1 Use ffmpeg from direct264, a modded version of an old ffmpeg build with a custom filter to modify H264 bitstreams. This build is crippled in most other ways, so rename it or don't put it in your path.
ffmpeg -i in.mp4 -vcodec copy -acodec copy -vbsf h264_changesps=removesei -map_metadata -1 out.mp4

#2 Use mp4box from the GPAC suite to strip the writing application metadata
mp4box -add out.mp4 -new stripped.mp4

Use bitstream filter filter_units with ffmpeg 4.0 or newer.
ffmpeg -i INPUT -c copy -bsf:v 'filter_units=remove_types=6' OUTPUT

P.S.
/* NAL unit types */
enum {
    H264_NAL_SLICE           = 1,
    H264_NAL_DPA             = 2,
    H264_NAL_DPB             = 3,
    H264_NAL_DPC             = 4,
    H264_NAL_IDR_SLICE       = 5,
    H264_NAL_SEI             = 6,
    H264_NAL_SPS             = 7,
    H264_NAL_PPS             = 8,
    H264_NAL_AUD             = 9,
    H264_NAL_END_SEQUENCE    = 10,
    H264_NAL_END_STREAM      = 11,
    H264_NAL_FILLER_DATA     = 12,
    H264_NAL_SPS_EXT         = 13,
    H264_NAL_AUXILIARY_SLICE = 19,
};

Yes, this is now directly possible.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Is it possible to speed up a video using handbrake?
Is it possible to speed up a video using handbrake ?
I am looking for a software like handbrake to convert videos for faster playback. It should speed up the video up to 30x.
Is it possible with handbrake or are there similar tools ?

You can use ffmpeg, a free command-line tool, to do this.
The basic command is
ffmpeg -i input.mov -vf "setpts=(PTS-STARTPTS)/30" -crf 18 output.mov

The 30 indicates the factor by which the video will be sped up.

Thanks a lot. This helps mutch. Is there propably also a way to revirse a video with ffmpeg ?

Sure. but it loads the whole file into memory, so I suggest applying it after speed change, like this: -vf "setpts=(PTS-STARTPTS)/30,reverse"

Note, this seems to add a bunch of empty blackness at the end. Or, rather, it condenses the video but keeps the original length and just fills it with solid black.

If you have an audio track in the input which isn't correspondingly sped up, yes, but not otherwise. Add -an to disable or -af atempo=2,atempo=2,atempo=2,atempo=2,atempo=1.875 to speed up the audio as well.

If you do keep audio (without speed up), whether it's black depends on the player's behaviour. In Potplayer, the last frame is frozen.

@Mulvya What's the relation between video speed up factor of 30 and audio tempo speed up of 1.875? Basically I just want to speed up a video 4 times, what should be the arguments for audio speed up in that case?

Audio is sped up using the atempo filter, which only takes values in the range of [0.5-2]. So to make a speed change outside that range, multiple atempo filters have to be daisychained. I have four filters with value of 2 and 1 of 1.875 since 2*2*2*2*1.875=30. For four times, you need atempo=2,atempo=2

What is crf 18?

Constant rate factor - in practice, a measure of the quality/size tradeoff used by the default video encoder (x264) for MP4 and MOVs. Lower is better but bigger. 18 is good; 23 is default.

Using FFmpeg's command-line, this is totally possible. I do it to increase the speed of my videos by 10% (increasing both the audio AND video by 10%, without sounding like a chipmunk).
The command to increase your video's speed by 10% is:
<ffmpeg path> -i <origin video path> -vf "setpts=(PTS-STARTPTS)/1.1" -crf 18 -af atempo=1.1 <output video path>

Here's the exact command line that I use:
"C:\Program Files\ffmpeg-win64\bin\ffmpeg.exe" -i "G:\minecraft lets play.mp4" -vf "setpts=(PTS-STARTPTS)/1.1" -crf 18 -af atempo=1.1 "G:\minecraft lets play ffmpeg.mp4"

If you want to increase your video's speed by more, or less, then you just change the "1.1" at both lines to something else. "1.1" is 10%. "1.5" is 50%. "3" is 300%. "10" is 1000%.

great answer! as you mention audio, cheers!


text:
Converting a Video from 1600*1200 to 1920*1080
How can I convert a video from 1600*1200 to 1920*1080 ?
I know that the aspect will be not correct, but I just like to do.
With Handbrake I can't do it, because it will not allow me to go beyond the 1600 pixels in the width.
Thanks for helping.

Are you ok with using a command-line tool?

Yes , would be happy to know. I guess you gave me already helped me with the ffmpeg tool to make a video faster. Can I do it with ffmpeg ? Thanks for helping.

Using ffmpeg,
ffmpeg -i input.mp4 -vf "scale=1920:1080:flags=lanczos,setsar=1" output.mp4

This will stretch the video to 1920x1080.

ffmpeg -i input.mp4 -vf "scale=-1:1080:flags=lanczos,setsar=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" output.mp4

This will keep the aspect ratio but place black bars on the left and right.

The flag in the scale filter determines the scaling algorithm to use. lanczos is the best available, in general, for video.
The setsar sets the pixel aspect ratio. Advisable to keep this square (1) unless you know what you're doing.
In the 2nd command, the -1 tells ffmpeg to preserve original proportion when scaling height to 1080. The pad fills out the canvas to 1920x1080 and centers the scaled video within it.

Can we add blur background of playing video or something like that instead black bars?

See https://stackoverflow.com/q/43577377/


text:
Convert 1920x1080 Video to 720x480 With Letterboxing
I'm trying to find the best application on windows to do this HD to SD conversion for a video server which requires files to be exactly 720x480/29.97fps MP4 H.264 to function. I can't find any options for leterboxing in Handbrake so I suppose I'll need an alternative.

You can use ffmpeg, a free command-line tool, to do this:
Without letterboxing, NTSC wide pixel-aspect
ffmpeg -i input.mp4 -vf "scale=720x480,setdar=16/9" -r 30000/1001 -c:v libx264 -crf 20 -c:a aac -movflags +faststart output.mp4

With letterboxing, NTSC 4:3 pixel-aspect
ffmpeg -i input.mp4 -vf "pad=1920:1440:0:180,scale=720x480,setdar=4/3" -r 30000/1001 -c:v libx264 -crf 20 -c:a aac -movflags +faststart output.mp4

With letterboxing, square pixels
ffmpeg -i input.mp4 -vf "scale=720x404,pad=720:480:0:38,setsar=1" -r 30000/1001 -c:v libx264 -crf 20 -c:a aac -movflags +faststart output.mp4

Read up on sample or pixel aspect ratios, if you're unfamiliar with them. Your requirements make it sound like NTSC-spec files are expected, so try the commands in the order listed.
If your source audio is MP4-ready i.e. of codec AAC or MP3, then you can replace -c:a aac with -c:a copy


text:
Why does ffmpeg report wrong or missing size information when demuxing some EXRs?
I am converting EXR image sequences to mp4. Some sequences are converted without error, but others report "wrong or missing size information" and generate . It is difficult to identify what is different in these sequences. So far it seems that:

Single layer EXRs always work, multilayer EXRs usually work
EXRs with no transparency always work, EXRs with transparency usually work
ExifTool reports a "Composite" image size of 1920x1082 on failing EXRs
Increasing analyzeduration and probesize makes no difference
Explicitly setting video_size 1920x1080 on failing image sequences makes no difference (stills fails, slightly different error message)

C:\Users\username\Documents\exr_bad1>ffmpeg -y -start_number 101 -i F1_255_020.%04d.exr test.mp4
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[exr @ 04e48880] Wrong or missing size information.
[image2 @ 04e536a0] decoding for stream 0 failed
[image2 @ 04e536a0] Could not find codec parameters for stream 0 (Video: exr, rgba64le): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
F1_255_020.%04d.exr: could not find codec parameters
Input #0, image2, from 'F1_255_020.%04d.exr':
  Duration: 00:00:01.20, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: exr, rgba64le, 25 tbr, 25 tbn, 25 tbc
[buffer @ 04e4cdc0] Unable to parse option value "0x0" as image size
    Last message repeated 1 times
[buffer @ 04e4cdc0] Error setting option video_size to value 0x0.
[graph 0 input from stream 0:0 @ 04e81c60] Error applying options to the filter.
Error opening filters!

Note that 2.8.4 is considered old and users are encouraged to use a build from current git master branch, which Zeranoe provides. Updating your ffmpeg after encountering an issue is always the first step to try.

ExifTool reports a "Composite" image size of 1920x1082 on failing EXRs

This was the problem. Some multilayer EXRs were made up of multiple 1920x1080 layers, but the layers were not aligned, so the final size was incorrect (as reported by ExifTool) and ffmpeg couldn't handle it.
After correcting the EXR generation, the new image sequence worked.


text:
Is it worth re-encoding GoPro footage to H.265?
Considering that I'm not a professional editor and only record some random skateboard, snowboard or just some travel footage around with my GoPro Session 4, is re-encoding to H.265 to save storage space a good idea?
What possible drawback could I expect if I wanted to edit with these files after the re-encoding?

If your only goal is to save storage space and you never plan on editing or re-encoding the files again, you probably won't notice any change in quality.
However, if you plan to edit or re-encode to another format in the future, I'd strongly recommend against re-encoding to H.265 now. Every time you decode and re-encode video to the same or a different codec, especially highly compressed codecs like H.264 and H.265, you lose quality. With these highly compressed codecs, the generational loss and concatenation artifacts become noticeable to the average viewer in as little as one codec cycle.

Only you can answer if it is worth it, because nobody else understands the economics of your project. Like how much video you have, and how important quality it. Hard drives are cheep, unless you have thousands of hours of video. Video compression isn't lossless, meaning you will never get a higher quality recording than you have now. Every time you recompress it, it will get a litte worse. So unless your hard drive budget is too high, why accept an extra qenerational loss?


text:
Use A6000 as webcam type camera
I need to do a live stream and I'm looking for a way to connect my Sony A6000 to my computer so that it can be used as a camera for Facebook Live. Any ideas?

For real time output you only have hdmi (the USB is for file transfer) so all you need is an hdmi input card for your PC.
Then you can grab that input as a source for applications.


text:
ffmpeg problem converting Prores 444 to Prores 422
Converting a Prores file with parameters:
arguments: -i "input.mov" -map 0 -c copy -c:v prores -profile:v 2 -c:a pcm_s16le "output.mov"
gives the following output:
ffmpeg version 2022-01-30-git-1530b3f566-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 19.100 / 57. 19.100
  libavcodec     59. 20.100 / 59. 20.100
  libavformat    59. 17.101 / 59. 17.101
  libavdevice    59.  5.100 / 59.  5.100
  libavfilter     8. 26.101 /  8. 26.101
  libswscale      6.  5.100 /  6.  5.100
  libswresample   4.  4.100 /  4.  4.100
  libpostproc    56.  4.100 / 56.  4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000061fbc9c240] Using non-standard frame rate 18432/1024
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.27.103
  Duration: 00:30:12.67, start: 0.000000, bitrate: 865279 kb/s
  Stream #0:0[0x1](eng): Video: prores (4444) (ap4h / 0x68347061), yuv444p12le(tv, bt709, progressive), 4096x2160, 864125 kb/s, SAR 1:1 DAR 256:135, 18 fps, 18 tbr, 18432 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc58.53.100 prores_ks
      timecode        : 01:00:00:00
  Stream #0:1[0x2](eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 01:00:00:00
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:v prores' will be used.
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 1, only the last option '-c:a pcm_s16le' will be used.
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> prores (native))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[prores @ 00000061fbd03440] encoding with ProRes Proxy/LT/422/422 HQ (apco, apcs, apcn, ap4h) profile, need YUV422P10 input
[prores @ 00000061fbca0200] ff_frame_thread_encoder_init failed
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

Does this:

encoding with ProRes Proxy/LT/422/422 HQ (apco, apcs, apcn, ap4h)
profile, need YUV422P10 input

mean it's not supported by ffmpeg at all or is there a solution to this problem.
(Used the latest version of ffmpeg)

Half of that ffmpeg command is redundant. Therte's no point using -c copy if you then specify different audio and video codecs, and with only one input there's no need to use -map 0. You could just use -i "input.mov" -c:v prores -profile:v 2 -pix_fmt yuv422p10le -c:a pcm_s16le "output.mov"

The input has full chroma sub-sampling and is 12-bit, and, by default, ffmpeg will try to retain as much fidelity as possible when converting the pixel format for the output encoder. However, for the selected profile, the encoder needs a pixel format with chroma sub-sampling and a lower bit depth. So you'll have to manually set the required one.
Add -pix_fmt yuv422p10le.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Producing small H.264 files with Adobe Media Encoder vs ffmpeg/libx264
I am a terrible ignoramus in the subject, but the coronavirus has thrown me in the business of producing videos with my lectures. I care a bit for video quality and a bit more for small size. My source is probably seen as abysmal from professionals: it is a screen capture (4K) by Zoom, heavily compressed. It still looks fairly decent and I import clips in Adobe Premiere Pro 2020 and edit them. The problem is in encoding the final sequences.
I lazily started by using the default preset for H.264 ("Match Source - High bitrate). Unsurprisingly, files are very big but visual quality as good as it gets. Good enough for me at first.
Then a student suggested I use this to compress the videos with this

ffmpeg -i input.mp4 -vf scale=1920:-1 -vcodec libx264 -crf 20 output.mp4

I did not run myself but he sent me an example and my 1.4 GB file went down to 74 MB without any particularly noticeable quality loss (note that most of the videos are slides and completely static for minutes, so it stands to reason that they compress very well). Here an example of typical frames:

Great, but, of course, I thought that I would not reencode with libx264 and rather produce similarly small files directly from Adobe Media Encoder. Firstly, I reduced the resolution to 1920x1080 during the export. Then, I spent an inordinate amount of time with the default H.264 encoder ("Hardware Encoding") to explore what happens reducing the only control I thought I should focus on (Target Bitrate). I would not manage to go below 650 MB with the smallest target bitrate (0.19 Mbps) but could reach 420 MB with a target bitrate of 1 Mbps. This makes little sense to me, but then I read somewhere to use the "Software Encoding" to get small files. I tried (also exploring blindly different profiles: Main, High, High10) and set the target and maximum bitrate also to the minimum (0.19 Mbps again). Size went down to 112 MB and, although not as small as the libx264 file, I thought it would be ok. The problem is that the quality degraded very noticeably. Here are a couple of examples:

Clearly, I must be missing something pretty fundamental here, but what? Is it possible that Adobe Media Encoder is so much inferior to libx264? Did I miss some key encoding parameter? (There do not seem to exist many in AME, nor they look like those of libx264.)
Any help would be much appreciated!
p.

Adobe licenses its H.264 encoder from Mainconcept, which doesn't do that well at low bitrates. x264 is pretty much the frontier when it comes at low size output for a given quality target, or quality for a given bitrate target. x264 is what's used by platforms like Youtube / Vimeo ..etc to encode user videos.
One thing you could try is to increase the keyframe interval. Default for x264 is 250 frames. Mainconcept will be something around 30-60 frames. If you can get them similar, I expect this to provide a moderate benefit in AME's encoding.
It is possible to use x264 with Adobe tools via VFW - https://sourceforge.net/projects/x264vfw/files/. But I don't recommend it. It's not maintained and there were stability issues.
My recommendation is to export a lighly compressed 1080p encode from AME - possibly DNxHD/HR codec in MOV or MXF container format, and then run the following ffmpeg command:
ffmpeg -i input.mov -c:v libx264 -crf 20 -movflags +faststart output.mp4

The faststart flag helps with quick playback start for web viewers.

Thanks a lot. Very useful--it is good to know that it is likely a waste of time to try to get AME to match the output of x264. I will definitely try you suggestion pretty soon.

You're now ahead of a lot of professionals who still use AME to do h.264 encoding, congratulations. The other advantage of exporting a master in an intermediate format like DNxHR or ProRes is that you can get the compression right without having to re-render. It's usually much quicker to compress than to render and compress.

I avoid AME and use x264 via ffmpeg for H.264 encoding. From Premiere I prefer to output a temporary lossless compressed format as the intermediate, such as the free and open-source Ut video, instead of DNxHD/DNxHR/ProRes. This avoids any generation loss (minor as it may be with ProRes/DNxHD, but still technically present as they are not lossless). Also, I'm guessing it is faster to encode but I never benchmarked it.

Save your project and close Premiere Pro.
Install Ut Video.
Open Premiere, select your sequence, and choose File > Export > Media (or press Ctrl+M).
Under Export Settings choose Format: AVI and make sure Export Video and Export Audio are both checked. Then under Video Codec choose Ut Video Codec YUV420. Lastly, check your Basic Video Settings to make sure Premiere did not screw around with the frame size, frame rate, etc, as it is apt to do.
Encode the AVI to MP4 with ffmpeg. Use the highest -crf value that gives you an acceptable quality and the slowest -preset you have patience for.

These instructions were written for CS6, but CC will be similar enough.
More info:

FFmpeg Wiki: Premiere. It's outdated, but the UT video section still applies.
FFmpeg Wiki: H.264
FFmpeg Wiki: H.265/HEVC

Thank you very much. In other situations, I would be very interested in a free open-source lossless intermediate format (in the audio world, I am a keen user of FLAC). In the present situation, I will probably go for something more immediate even if lossy. As a side comment, I did try to install Ut Video and it now has very many codecs available, none whose name is as above; other people reading this question and answer in the future may profit from a recommendation as to what specific codec would be a good choice.

There's probably not much point going for a lossless codec as your intermediate. The quality difference between using something lossless and a purpose-built intermediate codec like ProRes, DNxHR, or Cineform is going to be negligible after you compress to h.264. An intermediate codec will save a lot of hard drive space, and possibly be faster to render.

@stib In my case the intermediate is always temporary, so file size is a non-issue. Doing a quick test run in AME 19 showed that ut video encoding took about the same time as prores and dnxh* using vanilla settings (ut video encoding in ffmpeg is significantly faster, and decoding is somewhat faster). Additionally, I'm guessing ut video would be easier on the editor, and therefore more responsive, but I haven't tested. But my preference is not all based on numbers: I prefer open source.

I've had trouble getting UtVideo to work in the past, but that was a while ago. Another codec you might be interested in is FFV1, we use that at work for archival purposes (thanks to me refusing to let them use a proprietary codec).


text:
Text fading in a clip in Shotcut
I make YouTube videos sometimes and Shotcut has always been my go-to for video editing, but I am working on a video now and can't figure out how to fade text in and out while a clip is playing. Help?

It has been a long time since you asked the question. Maybe you have found your answer to your question in mean time. I am going to answer it anyway for you and for all others that are using this video editor.
I am using Shotcut in version 17.03.02.
There are probably more elegant and simple ways of doing this. The way I like to do it create a SVG file with the text I want (for example in Inkscape). I import this SVG into Shotcut and put in a separate video track above the main track and leave compositing enabled. Then I add fade-in and fade-out video filters to the SVG-Text video and enable the option "Adjust opacity instead of fade with black" for both filters. You can also adjust the duration of the filter/filters.
So to sum up:

create svg file with your text
add a video track with the svg file
leave compositing on
add fade-in/out filters and adjust duration
check "Adjust opacity instead of fade with black" in both fade filters

Enjoy!

Thanks for this answer. One improvement I would suggest is instead of creating a dedicated SVG for each text overlay I found it quicker to create a single fully transparent PNG the same dimensions as the video. Add the PNG to the new video track wherever you want to show text. Add a Text filter with the message you want to display (in addition to Fade-In / Fade-Out). This workflow makes it easier to adjust the text message and styles directly in Shotcut. Also you can reuse the same PNG for all text in the video rather than having to create a dedicated SVG each time.


text:
merge audio and video(having audio) using ffmpeg command
I run below command for this question that is working and give output file in mp4 but that file is not open in QuickTime Player but open in VLC Player and not open in other PC also.
Command:
ffmpeg -i EnergyVideo.mp4 -i EnergyAudio.mp3 -filter_complex \
"[1:a]volume=enable='between(t,27,33)':volume=0, volume=enable='between(t,38,42)':volume=0[1a];[0:a][1a]amerge=inputs=2[a]" \
-map 0:v -map "[a]" -c:v copy -c:a libvorbis -ac 2 -shortest energyvideooutput2.mp4

Output file Log:
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libfreetype --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'EnergyVideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:42.03, start: 0.000000, bitrate: 9889 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 9779 kb/s, 30 fps, 30 tbr, 19200 tbn, 38400 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 101 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mp3, from 'EnergyAudio.mp3':
  Metadata:
    TCM             : Jimmy Tran
    TT1             : This video is about ENERGY Track #1 Clip 1
    title           : ENERGY Track #1 Clip 1
    encoded_by      : iTunes 9.1
  Duration: 00:00:42.27, start: 0.000000, bitrate: 258 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 258 kb/s
Stream mapping:
  Stream #0:1 (aac) -> amerge:in0
  Stream #1:0 (mp3float) -> volume
  Stream #0:0 -> #0:0 (copy)
  amerge -> Stream #0:1 (libvorbis)
Press [q] to stop, [?] for help
[Parsed_amerge_2 @ 0x7fe0db617100] No channel layout for input 1
[Parsed_amerge_2 @ 0x7fe0db617100] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, mp4, to 'energyvideooutput.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 9779 kb/s, 30 fps, 30 tbr, 19200 tbn, 19200 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1: Audio: vorbis (libvorbis) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp (default)
    Metadata:
      encoder         : Lavc58.18.100 libvorbis
frame=  711 fps=0.0 q=-1.0 size=   29696kB time=00:00:23.63 bitrate=10293.5kbitsframe= 1261 fps=0.0 q=-1.0 Lsize=   50650kB time=00:00:41.96 bitrate=9886.9kbits/s speed=45.8x
video:50177kB audio:415kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.114199%

Thank You.

Why libvorbis? What's the video codec? Show log.

I add log to question.

Why libvorbis ?

I don't know more about ffmpeg. I searched from google and run that command but these type of error occured.

Drop the vorbis audio
ffmpeg -i EnergyVideo.mp4 -i EnergyAudio.mp3 -filter_complex \
"[1:a]volume=enable='between(t,27,33)+between(t,38,42)'[1a];[0:a][1a]amerge=inputs=2[a]" \
-map 0:v -map "[a]" -c:v copy -c:a aac -ac 2 -shortest energyvideooutput2.mp4


text:
Clip that plays fine in WMP is cut off in Sony Vegas
I imported a screen recording into Sony Vegas. When I play the original clip with Windows Media Player, it looks the way I expect it, with the whole screen visible. But when I play the clip in Vegas, it's zoomed in on the left side and the right side is just CUT out. Trying to change the crop or resize doesn't have any effect, everything on the rest of the screen is just gone, it's not there.
https://i.sstatic.net/EeG1j.jpg

In the first image, you can see the original clip and everything is visible.
In the second image, you can see the clip inside of Vegas and how it's cut off.
In the third image, you can see that after i crop/pan it doesn't matter the clip is just cut off inside of Vegas.

How can I import the full screen?

Answered at reddit. Reposting answer below.

This isn't a Vegas issue. The recording application has registered the video resolution as 1024x768 in the MP4 global header (../stsd/avc1) but the full 1080p stream is captured and stored.
Vegas is using the header metadata to crop the video stream at the stage of loading the file. So, any Vegas functions/plugins downstream to this stage don't, know of, or have access to the full image data.
However, the full resolution is correctly stored in the metadata (SPS) of the video stream itself. So remuxing the file with ffmpeg will resolve the issue as ffmpeg constructs a new global header, based on reading the stream metadata.
ffmpeg -i recorded.mp4 -c copy fixed.mp4

Get a FFmpeg Windows binary from https://ffmpeg.zeranoe.com/builds/

wow, i cannot explain with words how grateful i am!
you are really clever my man! much love. i have no idea what any of those words mean but it worked, thank you once again <3


text:
I'm using H264 encoding to encode video capture from a webcam. How do I turn of rc lookahead?
I want minimize encoding latency per frame. Right now, there is a high increase in encoding latency on the 46th frame. I think lowering the lookahead value might help with this. How do I do this?
Capture Resolution is 1080p.

If you're using x264 directly, it's --rc-lookahead 20 for 20 frames. If it's via ffmpeg, it's -x264-params rc_lookahead=10.
Although I would suggest to use faster presets. Default is medum.

So I'm using OpenCVs videowrite() function. I know that it uses x264 encoding in the back end. Is there a way to set --rc-lookahead 20 as a parameter through OpenCV?

From what I can see, this is not possible. OpenCV does not accept private parameters for x264. You can raise an issue at https://github.com/opencv/opencv/issues

Would it be possible to change encoder parameters in the OpenCV sourcecode? Or do I have to into the x264 encoder source code?

Not familiar with the OpenCV source but search for the x264 API calls initializing the encoder parameters and change those.

OpenCV does not seem to use x264, See https://github.com/opencv/opencv/blob/master/3rdparty/ffmpeg/readme.txt.


text:
Two videos on image background
I am sort of new to this. I am trying to create an output video using two videos and a background image.
 With a bit of gap around the videos and Video A having a larger scale than Video B. And, it should end at Video A's duration. Therefore, Video B should be cropped to Video A's duration.
This is what I have managed to do so far:

ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" Output.mp4

ffmpeg -i Test1.mp4 -i Test1.mp4 -filter_complex "[0:v][1:v]xstack=inputs=2:layout=0_0|w0_h0[v]" -map "[v]" -map 1:a Output.mp4

What are the resolutions of the image, video A and video B? How long are the videos?

The resolution of both the image and video B is 1280x720 and the resolution of video A is 640x360. Video A is 4min 59sec and video B is 6min 5sec. I only used video A labelled as "Test1.mp4" so far.

I managed to solve this after some pondering.
ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -i Test2.mp4 -filter_complex "[2:v]tpad=stop=-1:stop_mode=clone[v2]; [1:v]scale=640-20:360-20[a]; [v2]scale=320-20:180-20[b]; [0:v][a]overlay=10:(main_h/2)-(overlay_h/2):shortest=1[c]; [c][b]overlay=main_w-overlay_w-10:(main_h/2)-(overlay_h/2)[video]" -shortest -map "[video]" -map 1:a -vsync 2 Output.mp4


text:
Compiling x264 in MinGW
I'm trying to do a minimal build of ffmpeg in MinGW including x264.  For some reason the x264 package depends on ffms2 which depends on ffmpeg which itself has a huge list of dependencies.  I will try installing x264 from git instead, but I'm wondering why pacman has this circular dependency loop.
$ pacman -Si mingw-w64-x86_64-x264-git
Repository      : mingw64
Name            : mingw-w64-x86_64-x264-git
Version         : r2991.1771b556-1
Description     : Library for encoding H264/AVC video streams (mingw-w64)
Architecture    : any
URL             : https://www.videolan.org/developers/x264.html
Licenses        : custom
Groups          : None
Provides        : mingw-w64-x86_64-x264
Depends On      : mingw-w64-x86_64-libwinpthread  mingw-w64-x86_64-l-smash  mingw-w64-x86_64-ffms2
Optional Deps   : None
Conflicts With  : mingw-w64-x86_64-x264
Replaces        : mingw-w64-x86_64-x264
Download Size   : 810.45 KiB
Installed Size  : 6823.71 KiB
Packager        : Alexey Pavlov <alexpux@gmail.com>
Build Date      : Fri Jan 17 03:22:53 2020
Validated By    : MD5 Sum  SHA-256 Sum  Signature

$ pacman -Su mingw-w64-x86_64-x264-git
:: Starting core system upgrade...
 there is nothing to do
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: mingw-w64-x86_64-ffmpeg will be installed before its mingw-w64-x86_64-x264-git dependency
warning: dependency cycle detected:
warning: mingw-w64-x86_64-harfbuzz will be installed before its mingw-w64-x86_64-freetype dependency
warning: dependency cycle detected:
warning: mingw-w64-x86_64-libwebp will be installed before its mingw-w64-x86_64-libtiff dependency

Packages (100) mingw-w64-x86_64-SDL2-2.0.12-8  mingw-w64-x86_64-aom-2.0.1-1
               mingw-w64-x86_64-boost-1.75.0-2  mingw-w64-x86_64-brotli-1.0.9-2
               mingw-w64-x86_64-c-ares-1.16.1-1  mingw-w64-x86_64-cairo-1.17.4-1
               mingw-w64-x86_64-celt-0.11.3-4  mingw-w64-x86_64-ceres-solver-2.0.0-2
               mingw-w64-x86_64-cppunit-1.15.1-1  mingw-w64-x86_64-curl-7.74.0-2
               mingw-w64-x86_64-dav1d-0.7.1-2  mingw-w64-x86_64-eigen3-3.3.9-1
               mingw-w64-x86_64-ffmpeg-4.3.1-7  mingw-w64-x86_64-ffms2-2.23.1-1
               mingw-w64-x86_64-fontconfig-2.13.93-1  mingw-w64-x86_64-freeimage-3.18.0-5
               mingw-w64-x86_64-freetype-2.10.4-1  mingw-w64-x86_64-frei0r-plugins-1.7.0-2
               mingw-w64-x86_64-fribidi-1.0.10-2  mingw-w64-x86_64-gavl-1.4.0-1
               mingw-w64-x86_64-gflags-2.2.2-2  mingw-w64-x86_64-giflib-5.2.1-1
               mingw-w64-x86_64-glib2-2.66.4-1  mingw-w64-x86_64-glog-0.4.0-2
               mingw-w64-x86_64-glsl-optimizer-git-r66914.9a2852138d-1
               mingw-w64-x86_64-gnutls-3.7.0-1  mingw-w64-x86_64-graphite2-1.3.14-2
               mingw-w64-x86_64-gsm-1.0.19-1  mingw-w64-x86_64-harfbuzz-2.7.4-1
               mingw-w64-x86_64-hdf5-1.12.0-2  mingw-w64-x86_64-hlsl2glsl-git-r848.957cd20-1
               mingw-w64-x86_64-icu-68.2-2  mingw-w64-x86_64-ilmbase-2.5.4-4
               mingw-w64-x86_64-intel-tbb-1~2020.2-2  mingw-w64-x86_64-jansson-2.13.1-1
               mingw-w64-x86_64-jasper-2.0.22-2  mingw-w64-x86_64-jemalloc-5.2.1-1
               mingw-w64-x86_64-jxrlib-1.1-3  mingw-w64-x86_64-lame-3.100-1
               mingw-w64-x86_64-lcms2-2.11-1  mingw-w64-x86_64-leptonica-1.80.0-1
               mingw-w64-x86_64-libarchive-3.5.1-1  mingw-w64-x86_64-libass-0.15.0-1
               mingw-w64-x86_64-libbluray-1.2.1-1  mingw-w64-x86_64-libcaca-0.99.beta19-5
               mingw-w64-x86_64-libdatrie-0.2.12-1  mingw-w64-x86_64-libdeflate-1.7-1
               mingw-w64-x86_64-libexif-0.6.22-1  mingw-w64-x86_64-libidn2-2.3.0-1
               mingw-w64-x86_64-libjpeg-turbo-2.0.5-1  mingw-w64-x86_64-libmetalink-0.1.3-3
               mingw-w64-x86_64-libmfx-1.25-1  mingw-w64-x86_64-libmodplug-0.8.9.0-1
               mingw-w64-x86_64-libmysofa-1.1-1  mingw-w64-x86_64-libogg-1.3.4-3
               mingw-w64-x86_64-libpng-1.6.37-3  mingw-w64-x86_64-libpsl-0.21.1-2
               mingw-w64-x86_64-libraw-0.20.2-1  mingw-w64-x86_64-libssh2-1.9.0-2
               mingw-w64-x86_64-libthai-0.1.28-2  mingw-w64-x86_64-libtheora-1.1.1-4
               mingw-w64-x86_64-libtiff-4.2.0-1  mingw-w64-x86_64-libunistring-0.9.10-2
               mingw-w64-x86_64-libunwind-11.0.0-5  mingw-w64-x86_64-libvorbis-1.3.7-1
               mingw-w64-x86_64-libvpx-1.9.0-1  mingw-w64-x86_64-libwebp-1.1.0-1
               mingw-w64-x86_64-libxml2-2.9.10-5  mingw-w64-x86_64-lz4-1.9.3-1
               mingw-w64-x86_64-lzo2-2.10-1  mingw-w64-x86_64-metis-5.1.0-3
               mingw-w64-x86_64-nettle-3.7-1  mingw-w64-x86_64-nghttp2-1.41.0-1
               mingw-w64-x86_64-ogre3d-1.12.6-1  mingw-w64-x86_64-openal-1.20.1-2
               mingw-w64-x86_64-openblas-0.3.13-1  mingw-w64-x86_64-opencore-amr-0.1.5-1
               mingw-w64-x86_64-opencv-4.5.1-2  mingw-w64-x86_64-openexr-2.5.4-4
               mingw-w64-x86_64-openjpeg2-2.3.1-1  mingw-w64-x86_64-pango-1.48.0-1
               mingw-w64-x86_64-pcre-8.44-2  mingw-w64-x86_64-pixman-0.40.0-2
               mingw-w64-x86_64-protobuf-3.12.4-1  mingw-w64-x86_64-pugixml-1.11.4-1
               mingw-w64-x86_64-rtmpdump-git-r514.c5f04a5-3  mingw-w64-x86_64-speex-1.2.0-1
               mingw-w64-x86_64-speexdsp-1.2.0-1  mingw-w64-x86_64-srt-1.4.2-1
               mingw-w64-x86_64-suitesparse-5.8.1-1  mingw-w64-x86_64-szip-2.1.1-2
               mingw-w64-x86_64-tesseract-ocr-4.1.1-6  mingw-w64-x86_64-tinyxml-2.6.2-4
               mingw-w64-x86_64-vulkan-headers-1.2.158-1  mingw-w64-x86_64-vulkan-loader-1.2.158-1
               mingw-w64-x86_64-wavpack-5.3.0-1  mingw-w64-x86_64-wineditline-2.205-3
               mingw-w64-x86_64-xvidcore-1.3.7-1  mingw-w64-x86_64-zziplib-0.13.71-1
               mingw-w64-x86_64-x264-git-r2991.1771b556-1

Total Download Size:    269.17 MiB
Total Installed Size:  1332.63 MiB

:: Proceed with installation? [Y/n]

The included x264 cli app may depend on libavformat and libswscale, which is where the ffmpeg dependency comes in.
The libx264 wrapper in libavcodec depends on x264.


text:
YouTube multiple audio tracks
I have a problem. I want to do YouTube videos with two voice-overs. And i know that it is possible because Assassin's Creed: Valhala's first trailer has it. But i can't find any way how to do it. Any suggestions?
Situation:
-I tried to add multiple songs in the youtube studio if this will work, it didn't work.
-I tried to upload video that had 3 audio tracks: 1. video audio,2. song, 3. song. On pc i could switch it. But on youtube it didn't worked. It didn't showed me the option of choosing the audio track. And it played the first audiotrack

We need more information: what is your problem - meaning what exactly does not work? Have you tried to upload a video with multiple audio tracks and it didn't work? Was there any error message?

Does this answer your question? What happens when I upload a multi-audio video to YouTube?

Please note that the question @Gyan has linked may have obsolete answers, since YouTube started to support multiple audio tracks in autumn 2020 (whether this applies to all users or only to a selected group I don't know). So those answers may need to be updated.

I've searched myself a bit but haven't found out anything in the documentation or elsewhere about the new feature so far. I think what you can do is to use YouTube's feedback system to send a bug report and hope they'll fix it or clarify whether multi-track audio is available for all users or not. If you find out anything new, add an answer to the question that Gyan has linked.


text:
ffmpeg mysteriously not recording audio in a video
I recently upgraded my MacBook Early 2015 2.9 i5 8gb ram computer to BigSur 11.3.1.
My previous command that would record a video with audio no longer works. The video is recording, but there is no audio. Here is the output. Does anybody have any thoughts on what may be the cause of this or how to troubleshoot. I've been trying different solutions all day! Here is the output when I run the command and hit control-C to stop recording:
ffmpeg -y -thread_queue_size 512 -f avfoundation -framerate 30 -async 1 -i "1" -thread_queue_size 512 -f avfoundation -framerate 30 -video_size 640x480 -i "0":"0" -c:v libopenh264  -crf 30 -preset ultrafast -filter_complex "[0]scale=iw/16:ih/16 [pip]; [1][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10" -r 30 -movflags +faststart "/Users/research/Desktop/1_1_MorGen_May-18th-2021-1-47-08-pm.mp4"
ffmpeg version N-102535-g6ff2aba088-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.100 / 59.  2.100
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[AVFoundation indev @ 0x7f8ef8f04ac0] Configuration of video device failed, falling back to default.
[avfoundation @ 0x7f8ef8f04640] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7f8ef8f04640] Supported pixel formats:
[avfoundation @ 0x7f8ef8f04640]   uyvy422
[avfoundation @ 0x7f8ef8f04640]   yuyv422
[avfoundation @ 0x7f8ef8f04640]   nv12
[avfoundation @ 0x7f8ef8f04640]   0rgb
[avfoundation @ 0x7f8ef8f04640]   bgr0
[avfoundation @ 0x7f8ef8f04640] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7f8ef8f04640] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '1':
  Duration: N/A, start: 7316.562000, bitrate: N/A
  Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 2560x1600, 1000k tbr, 1000k tbn
[avfoundation @ 0x7f8ef8c11580] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7f8ef8c11580] Supported pixel formats:
[avfoundation @ 0x7f8ef8c11580]   uyvy422
[avfoundation @ 0x7f8ef8c11580]   yuyv422
[avfoundation @ 0x7f8ef8c11580]   nv12
[avfoundation @ 0x7f8ef8c11580]   0rgb
[avfoundation @ 0x7f8ef8c11580]   bgr0
[avfoundation @ 0x7f8ef8c11580] Overriding selected pixel format to use uyvy422 instead.
Input #1, avfoundation, from '0:0':
  Duration: N/A, start: 7317.372133, bitrate: N/A
  Stream #1:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 640x480, 30 tbr, 1000k tbn
  Stream #1:1: Audio: pcm_f32le, 48000 Hz, stereo, flt, 3072 kb/s
Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (/Users/research/Desktop/1_1_MorGen_May-18th-2021-1-47-08-pm.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption preset (Configuration preset) specified for output file #0 (/Users/research/Desktop/1_1_MorGen_May-18th-2021-1-47-08-pm.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 (rawvideo) -> scale (graph 0)
  Stream #1:0 (rawvideo) -> overlay:main (graph 0)
  overlay (graph 0) -> Stream #0:0 (libopenh264)
  Stream #1:1 -> #0:1 (pcm_f32le (native) -> aac (native))
Press [q] to stop, [?] for help
[libopenh264 @ 0x7f8ef8e63880] Slice count will be set automatically
[libopenh264 @ 0x7f8ef8e63880] [OpenH264] this = 0x0x7f8ef8f16110, Warning:SliceArgumentValidationFixedSliceMode(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to 6!
[libopenh264 @ 0x7f8ef8e63880] [OpenH264] this = 0x0x7f8ef8f16110, Warning:bEnableFrameSkip = 0,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame.
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
Output #0, mp4, to '/Users/research/Desktop/1_1_MorGen_May-18th-2021-1-47-08-pm.mp4':
  Metadata:
    encoder         : Lavf59.2.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 640x480, q=2-31, 30 fps, 15360 tbn (default)
    Metadata:
      encoder         : Lavc59.1.100 libopenh264
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc59.1.100 aac
[mp4 @ 0x7f8ef8e0e300] Starting second pass: moving the moov atom to the beginning of the file speed=1.12x
frame=   62 fps= 32 q=-0.0 Lsize=     464kB time=00:00:02.06 bitrate=1836.1kbits/s dup=10 drop=0 speed=1.06x
video:460kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.671077%
[aac @ 0x7f8ef8e64800] Qavg: 65536.000
Exiting normally, received signal 2.

I figured it out; I hope my solution will help others.
For some reason ZoomAudioDevice the '0' slot in my devices. Why in the world wouldn't that be reserved for the Built-in Microphone, ALWAYS? To make matters works, the ZoomAudioDevice was not in the Settings Panel in BigSur, so it couldn't be removed manually. I had to Uninstall Zoom, then do a command-alt-P-R (20 second) reboot to free it up. Now Zoom is gone, avfoundation has only one audio input (0 = built in microphone) and everything is working as before. I guess the lesson is 'Beware of Zoom'?


text:
FFMPEG - MAC OS Cannot Capture from Black Magic UltraStudio (Thunderbolt)
I have Black magic UltraStudio Express that captures SDI or HDMI and Connected to MacBook via Thunderbolt when I list devices I get the Audio but not the video :
$ ffmpeg -f avfoundation -list_devices true -i ""

ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100

[AVFoundation input device @ 0x7fa261600d80] AVFoundation video devices:

[AVFoundation input device @ 0x7fa261600d80] [0] FaceTime HD Camera

[AVFoundation input device @ 0x7fa261600d80] [1] Capture screen 0

[AVFoundation input device @ 0x7fa261600d80] [2] Capture screen 1

[AVFoundation input device @ 0x7fa261600d80] AVFoundation audio devices:

[AVFoundation input device @ 0x7fa261600d80] [0] Blackmagic Audio

[AVFoundation input device @ 0x7fa261600d80] [1] Built-in Microphone

: Input/output error

Any Idea why my FFMPEG does not see the device, Btw, other application sees the video just fine.
Thanks

You'll want to try the decklink device - ffmpeg.org/ffmpeg-devices.html#decklink

Thanks Mulvya, I am trying that at the moment but still having an issue to include the SDK packages into FFMPEG, do you have the instruction for that ? is there an FFMPEG version built --with-decklink ?

Manaf-2:~ manaf$ ffmpeg -f -format_code Hi50 -f decklink -i 'UltraStudio Express' -c:a copy -c:v copy output.avi
ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-decklink --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[decklink @ 0x7f893a801200] Cannot enable video input
Segmentation fault: 11

Upgrade. Use this script to build a new binary: https://github.com/jb-alvarado/compile-ffmpeg-osx-linux

I tried the script, it seems its old and am getting lots of errors specially with the OS, the library was build for Mac OS10.10 and I have 10.13. Would you be able to help me with building my own FFMPEG with decklink ? Thanks for your support :)

authors: Манаф Иракский


text:
Chrome renders WebM Video "darker" than other browsers / media players
Not sure if this is the correct community, but I have a question about video encoding and decoding.
I have a video that gets served in MP4 or WebM formats, depending on browser support. I noticed that in chrome, the WebM is noticeably darker than when viewing the files locally in VLC, or even another browser such as Firefox:
Chrome

Firefox

The original issue was with videos that I was re-encoding myself with ffmpeg:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M output.webm

I thought it might be related to the CLI options I was passing in, so I tried playing around with some other encoding option (such as using Constant Quality (CQ) mode and two-pass encoding) but still saw the brightness differences in Chrome. After that, I noticed these same issues on media that was automatically encoded from cloudinary, and I figured if I am seeing the differences there, it probably doesn't have anything to do with my encoding option flags.
Before I go too much down the rabbit hole here, is there anything I can control with this? Or is this just an issue with the decoder Chrome happens to be using (which is different that what VLC or Firefox is using).

If you disable hardware video decode in Chrome, is the rendering still different?

Huh, that does fix it! Navigating to chrome://flags/#disable-accelerated-video-decode, the option was set to Enable (which I think means it was using hardware video decoding, the option name is a bit confusing...). Setting that to Disable and then relaunching Chrome, and the WebM video displays the same as the MP4. So it seems like a bug with GPU decoding?

Yes, either the decoder isn't passing along the colorimetry info or the renderer in that pipeline isn't acting on it. See existing issue at https://bugs.chromium.org/p/chromium/issues/detail?id=851216

I tried lookup up a relevant chromium bug earlier but didn't come across that one. That looks to be exactly the issue I'm seeing! Thanks for all your help.


text:
Problem with audio sync when concatenating multiple mp4(s)
I am trying to concatenate up to 4 (appx.  800MB) mp4/mkv videos at a time, losslessly, and preferably with little or no re-encoding.  All have similar,  but not identical, properties. The issue I am having is when I am able to concate any files, the audio of the latter videos becomes gradually more and more out of sync.
It seems I am having a fps and/or timestamp asyncronicity, but I am unsure.  I've been able to looslessly remux from mp4 with differing resolutions- to ts files,  then concate the ts files successfully into a new mp4, alas the audio sync issue.
I am relitively new to the concate scene and am limited to ONLY an android device,  therefor I am limited to FFmpeg CLI, and the FFmpeg media encoder apps for android.  All signs point to needing mkvmerge at the very least,  but I cannot find a comparable app for Android.
Can anyone suggest a solution exclusively for android?  And can anyone please explain how the fps and timestamp function/relate/can be modified,  in layman terms? I keep reading command switches (TBN, PTS,  etc...)  that I don't understand,  not to mention the syntax switches used to manipulate them.

This happens when some of the files have no audio or audio shorter than the video.

The problem exists with even only two, which both definitely have audio from start to finish:

Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder         : Lavf58.2.103
Duration: 01:39:34.04, start: 0.000000, bitrate: 1140 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 801:800 DAR 12:5], 1049 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name    : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 83 kb/s (default)
Metadata:

Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder         : Lavf58.9.100
Duration: 01:48:04.04, start: 0.000000, bitrate: 1175 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 801:800 DAR 12:5], 1049 kb/s, 23.98 fps, 23.98 tbr, 27021 tbn, 47.95 tbc (default)
Metadata:
handler_name    : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)

Same resolution,  different fps, tbn?,  and tbc? This is just one example of my conundrum. Any thoughts on how to proceed?

If it is merely a difference in lengths obetween audio and video,  how's would I go about matching them appropriately, without re-encoding? (Android friendly only)


text:
How to make particle systems look more natural and realistic in Fusion?
I have recently downloaded Fusion and have seen some preloaded uses of fire and smoke in reference to particle systems. However, no matter how much I try recreating something like that, it always looks fake as either the particles is too thick or it simply doesn't flow or doesn't look realistic. This applies to other concepts as well such as snow, fireworks, etc. What makes the particle systems look so natural in those cases? How can I achieve a natural more realistic look from them?

FWIW, BorisFX has a particle-system toolset that added fluid dynamics support in this year's release and is available as an OFX plugin compatible with Resolve. Caveat is that I'm unclear which subset of functionality is available in their freebie product and which parts are paying-customers-only; it may be that the free one is strictly a standalone tool and not OFX-compatible at all.

Jason isn't incorrect, however it is absolutely possible to achieve a realistic effect without fluids. I've done major FX in 3DS Max for years and yet many times I've been able to solve some pretty cool simulations in Trapcode Particular alone. The key is usually to get the turbulence right, which is what gives it that "fluid" effect. (also called voritcity, or wind in some applications). I don't know fusion well but one trick I've used many times is to combine 2 different turbulence's - one which is large and gives you the random shape, and one which is smaller and gives you detail. If you think of a campfire you can see big loopy curls of fire, which often fork off into 3-4 small jagged edges so to speak.
Another good tip is to find footage of your desired effect and study it's motion. Finding a good fire/snow/smoke reference online and watching it over and over you will learn things you never knew about how it moves and reacts.
And lastly as a compositor I HIGHLY suggest getting some real elements to layer into your effect any way you can. For fire you're going to want to find some sparks to put over the flames, etc. Don't underestimate this one! It's easy to find free footage online (mitchmartinez.com) and layering a few of these on top of your simulation is how the pros do it.
All that said check out the new Trapcode Particular. It has a "fluid effects" system which is kind of blowing my mind. For someone relatively new to CG effects it is a dream come true. It took me weeks to fully understand FumeFX (which has been an industry standard for fire/smoke) to where I could use it efficiently, so I don't really suggest going down that route unless you want to make it your job. Particular however you can pick up in a few hours and it is relatively cheap. Only downside is you'll need to also buy/learn After Effects.

2022 update: check out TyFlow if you're a 3DS Max user and somehow haven't heard of it yet. It's an incredible particle system that I've almost entirely switched over to and I can't recommend it enough! Also, since writing this, I've completely dropped FumeFX in preference for PhoenixFD from Chaos group (makers of Vray). It's better in pretty much every way and if I'm doing fluids (smoke, fire or water) that's what I use. Just did a cool shot for this superbowl ad using Phoenix, the paint bucket at 1:00 was sim'd https://www.youtube.com/watch?v=InDTLp63G7c

Fusion doesn't have fluid dynamics simulation built in.  To get a realistic particle flow of a natural system, you'll need to use software specifically built for that task, import the results into Fusion, then use Fusion for compositing the smoke by adjusting the way each particle appears on screen and how they blend with the other scene elements.  SideFX Houdini with pyro, or Cinema 4D with X-particles are two pieces of software which might be better suited to fluid particle simulation.
Most people don't think of fire or smoke as fluid because they're gaseous and aren't wet.  However, in the context of particle VFX, fire and smoke are fluids and require decent fluid dynamic simulation to appear natural.

Partial:
The other answers are absolutely right, and will put you on the right path.
I used to do this stuff decades ago (for broadcast/film) and for every day, quick and dirty, particle stuff I had a standalone program called Particle Illusion.
I had not thought of it for years till I saw this question.
Quick search beings up this: Boris FX Particle Illusion Standalone.
So i guess it got sold off.
But the point was, yes, this is a great product, but when you're using this you'll end up compositing anyway, and as the other answer says, you gotta comp the real thing in  - its the only way to throw off the uncanny-valley side effect of a computer generated elements.
So, yes, get yourself real footage, or even shoot it yourself if you know what you're after and you're good to go on cleaning it up and making it comp-ready.
Heres a guide as something to think about:


text:
How to loop .TS files from Folder with FFMPEG
I am using the code below as a batch file. The issue i am currently having is only one video in the folder keeps looping. How can i make all the videos play and loop?
@echo off

set FFMPEGDIR=E:\ffmpeg\bin
set BARKERDIR=E:\slatewithsound
:start
for /F %%x in ('dir /b /d %BARKERDIR%\*.ts') do (
    @echo %BARKERDIR%\%%x
    %FFMPEGDIR%\ffmpeg.exe -re -fflags +genpts -stream_loop -1 -i %BARKERDIR%\%%x -acodec ac3 -ac 2 -ar 48000 -b:a 192K -vcodec mpeg2video -s 1920x1080 -b:v 4.5M -mpegts_start_pid 0x101 -mpegts_pmt_start_pid 0x100 -f mpegts udp://239.203.1.61:4000?pkt_size=1316
)
goto start

Have you tried using ffmpeg concatenation? https://trac.ffmpeg.org/wiki/Concatenate

Edit both videos into one video.

The folder contains 50 video files, each about 90MB. I would like to have all the videos playing in a seamless loop. when i take out -fflags +genpts -stream_loop -1 from the code it loops with the (:start, goto start command) however this generates continuity errors. How can i make all the videos loop seamlessly?


text:
How does the h.264 encoder determine where to put i-frames?
I'm reading a bit on I-frames and their counterparts, P-frames and B-frames. I understand the usage. I-frames are the key to the compression and following P and B-frames can use the data in I-frames to save on bits.
However, what I would find interesting is knowing how the encoder determines which frames should be I-frames and which should be P's and B's and pull their data from them. How does the encoder decide which frames will be I-frames?

Side thoughts (you don't have to answer, but these are interesting and useful to me in the future): Are I-frames easier, as in faster, to find and extract than say extracting every 30th frame? If a video is a slide show with audio and no slide animations, are I-frames likely to coincide with slide changes? Would compression be better on a video made from slides images rather than the same images taken in via stream in real time?

Should I have used the [tag:keyframes] tag? Should there be an [tag:i-frames] tag or should it be a synonym?

In addition to @Mulvya's fine answer, there is the case of older codecs and encoders that place I-frames at fixed intervals regardless of need. This was the era of the 'fixed-length GOP'.

'keyframe' is used in After Effects and other animation apps to describe a point on a timeline where a value is set. 'I-Frame' is more specific

The same term is used within ffmpeg and x264 code, and I suspect, most/all other codecs.

This is a complex topic, with the exact algorithm unique to each encoder.
Below is a pseudocode explanation from a x264 developer. B-frames aren't accounted for, but basic logic should be similar.
encode current frame as (a really fast approximation of) a P-frame and an I-frame.

if ((distance from previous keyframe) > keyint) then
    set IDR-frame
else if (1 - (bit size of P-frame) / (bit size of I-frame) < (scenecut / 100) * (distance from previous keyframe) / keyint) then
    if ((distance from previous keyframe) >= minkeyint) then
        set IDR-frame
    else
        set I-frame
else
    set P-frame

encode frame for real.

scenecut is the scene change threshold value. 0 means current frame is identical to previous frame, and 100 means it is completely different.
keyint is the maximum permitted distance between two keyframes; minkeyint is the minimum.
IDR (instantaneous decoder refresh) frames are keyframes such that no future frame requires to refer to a frame earlier than the IDR-frame for decoding. Not necessarily true for plain I-frames.


text:
Does iOS 10 Safari support MSE (for MPEG-DASH)?
I am thinking about implementing adaptive video streaming using MPEG-DASH. I have read a lot of articles and found the information that iOS Safari doesn't support MSE, so MPEG-DASH playback is not possible. But all the stuff I have read is deprecated (2015-2016 years).
As of today, could you please point out if I still need to use HLS for iOS and MPEG-DASH for everything else or is there a solution which can cover all platforms?


text:
ffmpeg Multiple Audio Language and Soft- Subtitle
I'm trying to convert a movie, using ffmpeg, from Movie.mkv to Movie.m4v. The Movie has 2 Languages and 1 subtitle stream.
Using
ffmpeg -i inputMovie.mkv outputmovie.m4v

the result is just one audio and no soft subtitles.
What should I use to keep both languages and the subtitle (to toggle On-off on streaming box)
Thank you.
The ffprobe from movie is:
ffprobe version 2.8.5 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'DasParfum.mkv':
  Metadata:
    encoder         : libmakemkv v1.9.9 (1.3.3/1.4.4) darwin(x86-release)
    creation_time   : 2016-01-22 21:40:23
  Duration: 02:21:28.44, start: 0.000000, bitrate: 5414 kb/s
    Chapter #0:0: start 0.000000, end 395.200000
    Metadata:
      title           : Chapter 01
    Chapter #0:1: start 395.200000, end 633.880000
    Metadata:
      title           : Chapter 02
    Chapter #0:2: start 633.880000, end 816.400000
    Metadata:
      title           : Chapter 03
    Chapter #0:3: start 816.400000, end 1031.680000
    Metadata:
      title           : Chapter 04
    Chapter #0:4: start 1031.680000, end 1294.280000
    Metadata:
      title           : Chapter 05
    Chapter #0:5: start 1294.280000, end 1593.800000
    Metadata:
      title           : Chapter 06
    Chapter #0:6: start 1593.800000, end 1928.680000
    Metadata:
      title           : Chapter 07
    Chapter #0:7: start 1928.680000, end 2262.000000
    Metadata:
      title           : Chapter 08
    Chapter #0:8: start 2262.000000, end 2598.960000
    Metadata:
      title           : Chapter 09
    Chapter #0:9: start 2598.960000, end 2845.960000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 2845.960000, end 3193.320000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 3193.320000, end 3427.320000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 3427.320000, end 3652.480000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 3652.480000, end 3966.560000
    Metadata:
      title           : Chapter 14
    Chapter #0:14: start 3966.560000, end 4235.920000
    Metadata:
      title           : Chapter 15
    Chapter #0:15: start 4235.920000, end 4531.280000
    Metadata:
      title           : Chapter 16
    Chapter #0:16: start 4531.280000, end 4796.480000
    Metadata:
      title           : Chapter 17
    Chapter #0:17: start 4796.480000, end 5003.960000
    Metadata:
      title           : Chapter 18
    Chapter #0:18: start 5003.960000, end 5383.040000
    Metadata:
      title           : Chapter 19
    Chapter #0:19: start 5383.040000, end 5708.040000
    Metadata:
      title           : Chapter 20
    Chapter #0:20: start 5708.040000, end 5943.080000
    Metadata:
      title           : Chapter 21
    Chapter #0:21: start 5943.080000, end 6212.960000
    Metadata:
      title           : Chapter 22
    Chapter #0:22: start 6212.960000, end 6488.560000
    Metadata:
      title           : Chapter 23
    Chapter #0:23: start 6488.560000, end 6734.000000
    Metadata:
      title           : Chapter 24
    Chapter #0:24: start 6734.000000, end 6951.880000
    Metadata:
      title           : Chapter 25
    Chapter #0:25: start 6951.880000, end 7214.480000
    Metadata:
      title           : Chapter 26
    Chapter #0:26: start 7214.480000, end 7466.680000
    Metadata:
      title           : Chapter 27
    Chapter #0:27: start 7466.680000, end 7756.840000
    Metadata:
      title           : Chapter 28
    Chapter #0:28: start 7756.840000, end 7935.200000
    Metadata:
      title           : Chapter 29
    Chapter #0:29: start 7935.200000, end 8488.440000
    Metadata:
      title           : Chapter 30
    Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, bt470bg), 720x576 [SAR 64:45 DAR 16:9], max. 7200 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Metadata:
      BPS-eng         : 4572420
      DURATION-eng    : 02:21:28.440000000
      NUMBER_OF_FRAMES-eng: 212211
      NUMBER_OF_BYTES-eng: 4851589546
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:1(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 448000
      DURATION-eng    : 02:21:28.416000000
      NUMBER_OF_FRAMES-eng: 265263
      NUMBER_OF_BYTES-eng: 475351296
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 384000
      DURATION-eng    : 02:21:28.416000000
      NUMBER_OF_FRAMES-eng: 265263
      NUMBER_OF_BYTES-eng: 407443968
      SOURCE_ID-eng   : 0182BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:3(ger): Subtitle: dvd_subtitle, 720x576 (default)
    Metadata:
      BPS-eng         : 2188
      DURATION-eng    : 02:11:22.676977777
      NUMBER_OF_FRAMES-eng: 871
      NUMBER_OF_BYTES-eng: 2156572
      SOURCE_ID-eng   : 0120BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:4(ger): Subtitle: dvd_subtitle, 720x576
    Metadata:
      BPS-eng         : 2079
      DURATION-eng    : 02:10:36.918400000
      NUMBER_OF_FRAMES-eng: 839
      NUMBER_OF_BYTES-eng: 2037440
      SOURCE_ID-eng   : 0122BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID

Try
ffmpeg -i inputMovie.mkv -c copy -map 0 outputmovie.m4v

Depending on the subtitle format, they may not get copied over. In which case,
ffmpeg -i inputMovie.mkv -c copy -c:s mov_text -map 0 outputmovie.m4v

Edit: Once you have a text-based subtitle format like SRT or ASS, you can use
ffmpeg -i inputMovie.mkv -i subtitle.srt -c copy -c:s mov_text -map 0:v -map 0:a -map 1 outputmovie.m4v

Thank you for quick response, but they dont work ! In First one I become error: Could not write header for output file #0 (incorrect codec parameters : invalid argument. And for second i become:Error while opening encoder for output stream #0:3 - maybe incorrect parameters such as bit_rate, rate, width or height !!

Paste the readout of ffprobe inputmovie.mkv into your question.

Your subtitles are image-based and need to be converted to a text-based format like SRT. Once done, you can use the revised 2nd command. Use Subtitle Edit to import from MKV.

i try it to do with 3 code (after the srt was exported - or downloaded) and i become again error message: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Paste the readout of ffprobe srt into your question.

that's the solution: "Edit: Once you have a text-based subtitle format like SRT or ASS, you can use": ffmpeg -i inputMovie.mkv -i subtitle.srt -c copy -c:s mov_text -map 0:v -map 0:a -map 1 outputmovie.m4v

now i do it with h265 and it is work; for i in *.mkv; do ffmpeg -i $i -map 0
-c:v libx265
-preset medium -x265-params crf=20:
qcomp=0.7:
ctu=32:
max-tu-size=16:
aq-mode=1:
aq-strength=1.0:
qg-size=16:
psy-rd=0.7:
psy-rdoq=5.0:
rdoq-level=1:
merange=50:
sao=0:
rect=0:
amp=0:
deblock=-2\:-2
-tag:v hvc1 -vsync 2
-c:a libfdk_aac
-cutoff 18000
-profile:a aac_he
-b:a 128k
-c:s mov_text
$i.mp4; done

I thin MKVtoolnix is better and can help you get the result that you want.
MKVtoolnix is a set of tools to create, alter, split, join and inspect Matroska files(mkv). Use MKVCleaver or gMKVExtractGUI to extract/demultiplex mkv video and audio files.
Supported operating systems: Windows - Mac OS - Linux
Screenshot :

hm i write i need output in m4v and this tool can just mkv output ??

you can extract or add subtitle from/to mkv videos with it and many other things like extracting or creating chapters, extracting audio separately in a few seconds... try it and you'll see


text:
Create time-lapse gif centering point of interest
My wife is currently very pregnant and I have taken a photo every week of her bump. I now want to make a gif or something similar showing the bump growing. I used the first free gif maker I found (gifmaker.me) and realised that I need to somehow make the bump the centre of the image for each frame of the gif for it to look really good. I figure I need to edit/crop the images somehow.
Any ideas out there how best to do this?

You don't necessary need to make it the center of the image but always appear at the exact same point in the frame. The center is usually an easy referencing point for that purpose, so why not use that.
Obviously the easiest would be to make the photographs in a way that they don't need postpcessing. If this chance has passed already, you can get a (free) image editing software like the "gimp" and move & scale alle pictures in a way that they have approx the same size and center.
BTW good luck with the baby, ours is almost 3 months already and it has been quite some experience so far.

thanks for the answer - I've done a lazy version using Gimp, so thanks for the pointer in that direction. My gif definitely looks better than before!

and apparently Return sends the response....


text:
How can i do series command in ffmpeg
I have to issue a series of commands, all in the form as shown below:

ffmpeg -i 1.mp4 -s 640x480 -c:a copy 2.mp4
  ffmpeg -i 2.mp4 -s 640x480 -c:a copy 2_2.mp4
  ffmpeg -i 3.mp4 -s 640x480 -c:a copy 3_2.mp4
  ffmpeg -i 4.mp4 -s 640x480 -c:a copy 4_2.mp4

Please show me how can I issue all commands automatically or do it with one command.

use a loop
If you're a Linux or OS X user then you can use a Bash for loop:
mkdir outputdir
for f in *.mp4; do ffmpeg -i "$f" -c:v libx264 -vf scale=640:-2 -c:a copy "outputdir/${f%.*}.mp4"; done

Maybe a Windows user can add a similar example that works for that OS.
or simply cram it all in one command
ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 \
-map 0 -s 640x480 -c:a copy 1_2.mp4 \
-map 1 -s 640x480 -c:a copy 2_2.mp4 \
-map 2 -s 640x480 -c:a copy 3_2.mp4 \
-map 3 -s 640x480 -c:a copy 4_2.mp4

You have to use -map otherwise the default stream selection will choose the same input for each output.