text:
Adobe After Effects: Keying layers based on other layers
I have 4 video streams:

a color stream A1
a black and white stream A2, representing the distance of objects in the color stream A1
a color stream B1
a black and white stream B2, representing the distance of objects in B1.

Now I want to key between either stream A1 or B1 depending on which is closer to the camera. Being a programmer myself I thought of solving this by running an operation on every individual pixel of the separate streams in order to generate the output video:
if luminosity of A2 is smaller than luminosity of B2, use the color of A1, otherwise use the color of B1

Is it possible to do this kind of operation in After Effects, or is it possible to write expressions like these that run on every pixel?

Expressions aren't low level like that. There's all kinds of values you can pull from but if you want a pixel specific solution, you'll have to write a plugin in C++ with their SDK.

There is a way of doing per-pixel logic such as what you want, by using Blending Modes. Basically the different transfer modes in AE can be though of as Boolean logic operations that go on at the pixel level. The different transfer modes are spelled out here.
So I think I've worked out how you'd do it.
Here are the images I'm using: two depth maps and two colour maps:
Picture 1 and depth matte

Picture 2 and depth matte

As you can see, no expense was spared with the render.
OK so in AE I make a comp with just the depth mattes in it. I set the blending mode of the top layer to Darker Color.

The darker color blending mode does this logic on each pixel:
(luminosity of this layer < luma of layer(s) below)? This layer: lower layer

This means the darker object will appear wherever two objects overlap That gives me this result:

Now we have to turn this into a matte for picture 1, where the black will be opaque and white transparent. To get rid of the parts of the comp that aren't relevant to picture 1 I put this comp into a new comp, along with another copy of depth matte 1, which I put on top.

I set the blending mode of the top one to Difference which can be though of as:
(this layer == lower layer)? 0: abs(this layer - lower layer)

and this is the result:

OK, now I put this comp in a new comp with my colour images. This comp goes above image 1.

In this final comp I set the depth map comp as a Luma inverted matte for picture 1. Note that when you do that it turns off the visibility for that layer (see the eye icon is disabled on the top layer). This is the result:

Obviously there's a bit of a problem in that there are semi-opaque areas. So I need some sort of threshold. I could do this a few ways, but the way I like is with the curves effect. I apply curves to the top layer (the depth matte layer) like so:

I originally set this to be a hard step at 50%, but that makes the edges of the matte super sharp, so I made it slope a bit around the mid-point. You can play with this to get it right. That's the advantage of using Curves instead of say the Threshold effect.
Finally I got this result, with the figures correctly sorted on the "z" axis:

I hope this all makes sense, and that it works in real life. Thanks for the question, it was an interesting exercise.

I can't take the time to write the expression script now, but that would be your best bet. Writing an expression which could, perhaps reference a totally separate composition; which includes a key (color key/chart or luma key) with the values you want it to identify, then have the expression perform the action based on matching results.
You'd have to play with it to get it to work, but definitely possibly with some tinkering.

I'm close to flagging this as "not an answer", but didn't since there is an attempt to answer. Only problem is the answer is wrong: expressions can't do what the OP wants - they can't alter the pixels, only control the properties of a layer.


text:
Merge / Concatenate Video Files in a Lossless Manner (No Encoding / Compression)
I have few video files I'd like to merge.
I'd like to create a single video of them without any compression, just one after another.
How can it be done using FFMPEG?
For the answer we may assume the files are named:
Video001.mp4
Video002.mp4
Video003.mp4
.
.
.
Video030.mp4

If there a way to automate (Something like Video*.mp4) it would be great.

Related https://stackoverflow.com/questions/7333232.

Create a file named FileList.txt with the content:

file full/path/to/Video001.mp4
file full/path/to/Video002.mp4
file full/path/to/Video003.mp4
.
.
.
file full/path/to/Video030.mp4

One could use the full path instead
2. Run ffmpeg -f concat -safe 0 -i FileList.txt -c copy MergedFile.mp4.
3. In case of the error Could not find tag for codec pcm_alaw in stream #1 or something related to PCM audio, know that FFMPEG can't generate an MP4 file with PCM audio. Hence chose another container: ffmpeg -f concat -safe 0 -i FileList.txt -c copy MergedFile.mkv or encode the audio: ffmpeg -f concat -safe 0 -i FileList.txt -c:v copy -c:a aac MergedFile.mkv.
Remark
The answer is based on:

StackOverflow - How to Concatenate Two MP4 Files Using FFMPEG.
Handling PCM Stream in MP4 File in FFMPEG.

source: Stack Exchange

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

sort: votes


text:
Extract multiples images from multiples videos with ffmpeg
I have a MP4 movie filmed with a GoPRO.
The GoPRO split the movie in several files (I believe because of FAT32 size limitation).
What I'm trying to do is extract some specific frames of the FULL MOVIE. I don't need all frames, but I need a list of frames
Because all files is from same movie, I "merged" all files. To do this, I created a file called gopro.txt with the following content:
file 'GOPR0940.MP4'
file 'GP010940.MP4'
file 'GP020940.MP4'
file 'GP030940.MP4'
file 'GP040940.MP4'
file 'GP050940.MP4'

So, to extract a image from a movie, I used this command:
ffmpeg -ss 00:19:00 -f concat -i gopro.txt -qscale:v 2 -vframes 1 frame%d.jpg (where 00:19:00 is the time I want).
Edit: as @Mulvya said, on a demuxed input, the "fast seek" don't work (works, but is very slow). So, I merged all videos on a single file with the following command:
ffmpeg -f concat -safe 0 -i gopro.txt -c copy full_movie.mp4

Now, suppose I have a list of times I want to extract (I don't have the frame number, only the time), like:

00:05:32
00:12:49
00:21:10
00:32:23

and so on. My list will have more than 10.000 timestamps, so, if I make a batch file with:
ffmpeg -f concat -i gopro.txt -ss 00:05:32 -vframes 1 frame00001.jpg
ffmpeg -f concat -i gopro.txt -ss 00:12:49 -vframes 1 frame00002.jpg
ffmpeg -f concat -i gopro.txt -ss 00:21:10 -vframes 1 frame00003.jpg
...
ffmpeg -f concat -i gopro.txt -ss 01:38:42 -vframes 1 frame10000.jpg

This will work, but take a really long time, because I think that ffmpeg, at each line of my batch file, will seek from beggining of the file until at desired time.
Edit: after changes proposed by @Mulvya, the extract worked very fast, and I can use the batch file without any problem.
It's possible to pass a list of timestamps to ffmpeg?
I tried with select option, like:
ffmpeg -f concat -i gopro.txt -vf select='eq(t,332)+eq(t,769)+eq(t,1270)+eq(t,1943)' -vsync 0 -vframes 4 frames%d.jpg, (https://ffmpeg.org/ffmpeg-filters.html#Timeline-editing) but got no results.
After several minutes, ffmpeg return a warning message with the following content:
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
And I thinking that solution it's not the best, because, if I have 10000 timestamps, this will generate a huge command.
PS: I'm using Windows

ffmpeg -f concat -i gopro.txt -ss 00:05:32 -vframes 1 frame00001.jpg --< this will take a long time, as this is a slow seek. ffmpeg -f concat -ss 00:05:32 -i gopro.txt -vframes 1 frame00001.jpg should not. Although since you are performing this on a concat demuxed input, it may amount to the same thing. But if you write the the concat to one MP4 and then set a seek time before the input, it's a fast seek and output will be quick. In a fast seek on a container like MP4, ffmpeg queries the index and jumps to the byte offset of the GOP start containing the sample.

@Mulvya, tested again! Yes, you're corrected. On a demuxed input, the results are the same. On a "merged" mp4, the second way is much faster.

After @Mulvya reply, I made the following changes:
First, I must put all in a single file.
According with the Mulvya answer, a "concat demuxed input" don't have a "fast seek", so, first I created a gopro.txt file with the following content:
file 'GOPR0940.MP4'
file 'GP010940.MP4'
file 'GP020940.MP4'
file 'GP030940.MP4'
file 'GP040940.MP4'
file 'GP050940.MP4'

Then, "merged" all MP4 files in a single file, with the following command:
ffmpeg -f concat -i gopro.txt -c copy full_movie.mp4
Source: https://trac.ffmpeg.org/wiki/Concatenate
Now, I can extract in a fast way individual frames, with the following command:
ffmpeg -ss 00:15:00 -i full_movie.mp4 -vframes 1 frame00001.jpg.
Source: https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video (i put the -ss option first, like @Mulvya said).
Initially, I want to pass a list of timestamps to ffmpeg, but now, the extract of individual frames is very fast, that I don't need anymore. A simple batch file worked good.

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


text:
Largest input image size when encoding a video?
I got a bunch of really large 16 bit videos, approaching 65535×65535 pixels in size. These are essentially high quality timelapse panoramas. I want to convert them to a 7680×4320 movie (8K UHD, 8 bit). I'm not too concerned about the format, but I want some kind of compression.
I think I can resize the images using Python to get them down to HEVC (8192×4320)...
Is there anything that will playback (with VLC?) that can do a larger number of pixels than 8192×4320? What are my options?
When I try to use FFmpeg I get errors like:
[mjpeg @ 000000000062eae0] [IMGUTILS @ 000000000023ed40] Picture size 20000x19824 is invalidN/A
Error while decoding stream #0:0: Invalid data found when processing input

Any player based on ffmpeg/libav will likely fail if ffmpeg does. You'll have to downsize the video and then convert. Since your input is MJPEG, you can try to losslessly extract the frames as an image sequence. Downsize with another app (imagemagick?) and then encode that result. ffmpeg -i in.mov -c copy frames%d.jpg

I'd imagine there might be hardware limitations on playing back those files, whatever the software.

FFmpeg is tripping up at this statement in Imgutils.c in function av_image_check_size()
if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) return;  [ else error() ]

where INT_MAX is defined in limits.h as at least 32767 (2^15-1), or greater depending upon your compiler.
Compiling with a 64-bit compiler will permit larger images.

It's tripping up at (int)w<=0 || (int)h<=0 || stride >= INT_MAX || stride*(uint64_t)(h+128) >= INT_MAX  And INT_MAX is fixed to 2^31-1. Which compiler limits.h are you referring to? Mine is GCC 6.3.0.  I've 64-bit ffmpeg compiled using a 64-bit toolchain and I also get the same error for the OP's size.

Actually, the statement you quoted isn't present in the current code. The one I quoted is, and was added there in Dec 2016.

@Mulvya - https://en.m.wikibooks.org/wiki/C_Programming/C_Reference/limits.h - The Standard says a larger value is permitted. That INT_MAX is a minimum value under the Standard (No compliant C Compiler can have a lower value. Further Googling shows that some OS's size is 64 Bit.  I'll accept the newer Source. Plug in his values. Would half the size fit? If he's going to use Python I don't imagine it will accept arbitrarily large values either but it might take 64 Bit values. The size he wants to playback at implies he has an 8K Screen (or is Archiving for the future).

I would surprised if this was a 64bit limit because I'm using a 64bit version of ffmpeg, specifically ffmpeg-20170321-db7a05d-win64-static

Just a comment: why the heck does FFMPEG use (signed) ints for H and W?  If they were unsigned int, then all would be fine and dandy up to 65535 (inclusive).

all_licenses: 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/


text:
wrapping circular black frame for video - What is this effect called?
when using magic bullet looks on a video it applies - alongside color corrections and such - a frame, some sort of wrapping mask thingy - a black outline for the video the gives the center a bit more focus. You can see it pretty clearly here:

I want a png of that. Just that. I am searching Google for all kinds of word combinations but nothing. What is this effect called??

it's a vignette.
Here's a tutorial on how to do it.
If you add a black solid layer to a comp, then feather the edges, and invert the mask, you'll get the basic effect.  Beyond that, some people used coloured solids (e.g. just off-black in one colour or another).  You can also apply a blur or defocus effect towards the edges of the image, if that's the look you're going for.


text:
Premiere .prproj file ticks drift by 1/1000 compared to timecodes
I am a programmer and am processing Adobe Premiere .prproj files. I read the contained XML data to figure out where a <Media> element's video file starts.
I have a video that's been recorded with a timecode starting at 10:00:00:00, i.e. exactly 10 hours, or 36000 seconds. That timecode is what Premiere shows for the start of the file.
The corresponding data in the project file is:
<Media ...>
    ...
    <Start>9153720576000000</Start>
</Media>

That value uses ticks as unit.
Now, I make the assumption that one second equals 254016000000 ticks. That's because, when I have, for example, a sequence with 25 FPS, its FrameRate element in the XML specifies 10160640000 ticks, and that's exactly a 25th of a second.
But when I divide the <Start> value 9153720576000000 by 254016000000, I get 36036 seconds, and not, as expected, 36000 seconds.
So, by reading the XML values, I learn that the video starts at 10:00:36:00.
Curiously, that difference is exactly the 1001/1000 ratio of NTSC drop-frame timing, right?
Now, how do I make sense of the data in the Premiere project file? On one hand, its ticks base of 254016000000 is precisely identifying the used frame rates in the same file, so it must be the correct value for ticks per second. OTOH, it is off for time codes by 1ms per second.
How shall I interpret ticks values in the file? Shall I adjust them all by a factor of 1.001 to get the actual time code, or where's my error in all this?
Or is it a known fact that timecodes are not based on actual seconds but on 1.001 seconds?
In other words, does 10:00:00:00 mean that it's actually starting at 36036 seconds?
Update
It appears that there is indeed a drift with timecodes vs. real time, but only if the recording uses fractional FPS such as 29.97 or 23.976 (= 23.98), according to this article.
And, indeed, the media file in question was recorded at 23.98 FPS.
So, am I right in the assumption that whenever I interpret a time code, I need to also look at the involved FPS, and if it's fractional, I have to add 1ms per second to the calculated time to be more accurate in the long run? (I do not care about single frame accuracy, so it does not matter when I apply the drift correction, it's only a question when to apply it at all.)

First, let me say that I have no idea what Premiere is doing with its values or what a 'tick' means in their terms. I can only speak generally.
The video frame rate should match the timecode rate, but for 'drop frame' timecodes the relationship isn't perfectly linear. There are certain timecode numbers that never show up in the sequence -- the ones that are 'dropped'. So for such codes you can't just perform a simple computation, you have to consider the drops.
Over the course of 1 hour there are 108000 frames at 30fps, but drop frame code will produce only 107892 unique numbers. Both clocks will agree that "the time" is 1:00:00:00.
If you're just using timecodes to label each frame with a unique number then any scheme will do. If you need to match time of day, then you have to take the dropped numbers into account. What do you need to do with your values?

I should have noted that the start time of 10 hours is not a duration, only a marker, so it is treated as a constant or offset. The video didn't start at 36036 seconds, it started at 0 seconds. The first frame is labelled 10:00:00:00 but that's all TCs are: labels.

What I'm trying to do is this: I find comment markers in the Premiere project and then locate the corresponding video clip(s). Then I have to figure out how far into the clip this marker is set, and use that offset to extract a screenshot from the video with a different program (e.g. ffmpeg). For a video with start at 10h, the Premiere XML tells me it's 36036 seconds. I use that value in my marker offset calculation and end up 36s too early in the video file. With a 24 fps video I do not have this problem. I should probably provide more data in my question.

@ThomasTempelmann - I'm sorry I don't know how Premiere notes internal durations etc because this should be easy to solve with that info. You probably need to identify when a video is encoded at a non-integer frame rate and apply the DF correction (1000/1001), but the devil is in the details. If you could provide examples of all the constant values you can extract from both a 30fps and a 29.97 metadata set ('ticks' etc), then also some duration values from each and the codes they indicate, I'm sure we can tease out the info.

I now realized that I left some important info out, and that's also the solution to my problem: The problem is caused because I also read an EDL created by Premiere, and that EDL is missing the information whether a clip is DF or NDF. So, when it tells me that the 23.976 FPS clip starts at 10:00:00:00, and Premiere's project file says it's at 10:00:36:00, I have a mismatch. I was looking for a solution in the wrong place. The solution is to ignore the EDL entirely - then there's no problem.


text:
Show the clip-time in VLC-player, while playing
I'm recording some sports footage, and write down some notes, while the recording is going on.
I would like to be able to, as fast as possible, to link my comment to the passage on the video. I record it with a GoPro, so the 1,5 hour longs video gets chopped up to small pieces.
I thought it would be an idea, if VLC could display the actual time of when the footage was take, on screen. In the same manner of this (opening VLC from a command-line with that comment):
vlc.exe --sub-filter=marq{marquee=$T/$D" Volume:"$V,size=-2,color=16776960}:marq{marquee=Time:%H:%M:%S" Date:"%d/%m/%Y,color=16776960,size=-2,position=6}

That line just shows the current time. I wanted it for example to show something like this:
If the recording was started at 19:39:21, - then three minutes and 7 seconds into the video, the counter should say 19:42:28. Is that achievable somehow?


text:
Use my own server to stream 360 videos
YouTube seems to limit the quality / resolution / data size of 360 videos that can be uploaded. If I want to serve higher quality content, what do I need to do?
Requirements:

Must work with mobile devices (phones, etc).
I don't want to use youtube.com or facebook.com as the platform.

I will run my own Linux server, so I don't care what protocol would be used, either HTTP or something else more specific to video.

@armin - No sorry I haven't moved forward with any research on this. If you do, please let me know. Eventually I'll look into this. I thought this would be relatively easy - something like get Tomcat + some components and viola! Guess not? We'll see. Cheers friend :)


text:
How to ignore certain type of streams (mjpeg) while encoding videos in ffmpeg
I've several mkv files which have streams similar following. These files may have more than one audio stream and/or subtitles e.t.c. But my problem is mjpeg streams.
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
Stream #0:1 -> #0:1 (ac3 (native) -> vorbis (libvorbis))
Stream #0:2 -> #0:2 (mjpeg (native) -> h264 (h264_nvenc))
Stream #0:3 -> #0:3 (mjpeg (native) -> h264 (h264_nvenc))
Stream #0:4 -> #0:4 (mjpeg (native) -> h264 (h264_nvenc))
Stream #0:5 -> #0:5 (mjpeg (native) -> h264 (h264_nvenc))

when i try to encode my video i get this error

Error while opening encoder for output stream #0:2 - maybe incorrect
  parameters such as bit_rate, rate, width or height

my command is
ffmpeg -i "%%~nf%%~xf" -c:v h264_nvenc -b:v 3000k -minrate 3000k -maxrate 3000k -vf "scale=1280:-2" -acodec libvorbis -ac 6 -c:s copy -map 0 "done/%%~nf.mkv"

how can i ignore mjpeg streams not to be copied to output video, or at least how to properly copy them to output video without getting error.

@LordNeckbeard yes they are cover arts and yes your suggestion did work perfectly. If you post it as an answer i'll be more than happy to accept it. Also if possible can you explain what -map -v -map V does?

You can avoid the MJPEG cover art by using properly ordered selective mapping:
-map 0 -map -v -map V

What this does:

-map 0 Map all streams from input 0 (which is the first input per ffmpeg command).
-map -v Then, ignore all video streams including cover art.
-map V Finally, include all non-cover art video streams.

v matches all video streams, and V only matches video streams which are not attached pictures, video thumbnails or cover arts.
For more info see the documentation on stream specifiers and the -map option.

I should note that the OP's Y problem can't be solved directly by FFmpeg (ignore streams by codec). The X problem (ignore peripheral video streams) can, as shown in this answer.

Thanks for the solution. Somehow ffmpeg still cannot work with this type of streams. I am using this weird version from 2022 (ffmpeg version N-107368-gbe983d2354).

This was helpful. From error output I saw that 0:0 was a data stream not supported in an mkv, and was able to exclude it with -map 0 -map -0:0 . worked like a champ. Your answer pointed me to exactly the syntax I needed

I'm here also playing with ffmpeg and nvdec/nvenc.
I've found that some options is not good.
I've played with nvdec also, and found that it's better to use -filter (ffmpeg documentation says it's a "per-stream filtering option") instead of -vf or -af aliases as those aliases touch "all streams of video or audio". Here is a quote from there:

3.1.1 Simple filtergraphs
  Simple filtergraphs are those that have exactly one input and output, both of the same type. In the above diagram they can be represented by simply inserting an additional step between decoding and encoding:

 _________                        ______________
|         |                      |              |
| decoded |                      | encoded data |
| frames  |\                   _ | packets      |
|_________| \                  /||______________|
             \   __________   /
  simple     _\||          | /  encoder
  filtergraph   | filtered |/
                | frames   |
                |__________|

Simple filtergraphs are configured with the per-stream -filter option (with -vf and -af aliases for video and audio respectively). A simple filtergraph for video can look for example like this:

 _______        _____________        _______        ________
|       |      |             |      |       |      |        |
| input | ---> | deinterlace | ---> | scale | ---> | output |
|_______|      |_____________|      |_______|      |________|

Note that some filters change frame properties but not frame contents. E.g. the fps filter in the example above changes number of frames, but does not touch the frame contents. Another example is the setpts filter, which only sets timestamps and otherwise passes the frames unchanged.

Also, there is a stream_type specifiers for video: v and uppercase V.

’v’ matches all video streams, ’V’ only matches video streams which are not attached pictures, video thumbnails or cover arts.

So, my example of command I have "constructed" to mess with nvdec/nvenc on a nVidia GTX755M SLI:
C:\soft\ffmpeg_cuda\media-autobuild_suite\local64\bin-video\ffmpeg.exe -y -vsync 0 -hwaccel cuvid -hwaccel_device 1 -c:V:0 h264_cuvid -i "C:\torrent\Video\Movies\Love's Enduring Promise (2004) [Amazon] WEB-DL 1080p [Ukr.Eng Sub.Eng] [Hurtom].mkv" -f matroska -map 0 -c copy -c:V:0 h264_nvenc -filter:V:0 "scale_npp=w=-2:h=720" -b:V:0 20M -gpu 1 "C:\torrent\Video\Movies\Love's Enduring Promise (2004) [Amazon] WEB-DL 720p [Ukr.Eng Sub.Eng] [Hurtom].mkv"

I'm using ffmpeg, built with this bundle: "media-autobuild_suite"
-y overwrites output file without asking. Be careful to not to make output path the same as input path, I think you may ERASE input mediafile that way using this option.
-vsync 0 I think says to disable vsync for processing, haven't played with it, so for now I can't say if it is useful or so, may be omitted. You may give opinions in comments to say your findings.
-hwaccel cuvid says to decode input videostream with nVidia's video decoder.
-hwaccel_device 1 says to use GPU 1 (zero-based counting) for video DECODING (I have SLI, but seems that ffmpeg is not in friendship with SLI configurations). I use second videocard as it's mainly doing nothing, so works at lesser temperatures (it's dedicated videodevice, connected to PCI-E in my notebook).
-c:V:0 h264_cuvid says to use h264_cuvid input media decoder for stream 0, a Video (not an embedded picture)
-i "C:\torrent\Video\Movies\Love's Enduring Promise (2004) [Amazon] WEB-DL 1080p [Ukr.Eng Sub.Eng] [Hurtom].mkv" here I give an input filepath.
-f matroska an output container, I choose an MKV as input is in this format too.
-map 0 that says "map all the input streams to output file in the same order".
-c copy works in conjunction with previous option. Says to use copy codec for all streams, so all audio, embedded media will be just copied to output file without reencoding. For video transcoding I do there is nothing to do with audio, I just make "lesser-reolution" video in output file.
-c:V:0 h264_nvenc here is (at last!) I say to apply nvenc encoder to output Video stream 0. See next option!
-filter:V:0 "scale_npp=w=-2:h=720" and here I say to apply a filter to Video stream 0 (exactly one stream in input file). I here use an h=720 to make video in "720p" format. Be careful, as videostream may be more wider as 16:9, and you may need to set "w=1280:h=-2" instead for that case to limit using width instead of height. That will be "720p" too, but videoframe is "wider" than needed. Also, you need to check for an existence of scale_npp filter in your ffmpeg bundle, it is available if you installed CUDA bundle WITH Visual Studio integration.
-b:V:0 20M saying to use bitrate of 20Mbit/s as an upper limit. For VBR it's like an "upper, cut limit", it even can not reach it. You can make it even higher if you will work with higher resolutions. I'm still playing with that parameter and video options, so in this my post I may add some edits comcerning video quality of output stream.
-gpu 1 says to use a GPU 1 (second GPU) too. An video encode and Video decode conveyors in videocard is a different modules, so you can use them seamlessly.
"C:\torrent\Video\Movies\Love's Enduring Promise (2004) [Amazon] WEB-DL 720p [Ukr.Eng Sub.Eng] [Hurtom].mkv" output filepath.
More examples:
C:\soft\ffmpeg_cuda\media-autobuild_suite\local64\bin-video\ffmpeg.exe -y -i "C:\temp\Video\MOVI0004.avi" -f matroska -map 0 -c copy -c:V:0 h264_nvenc 20M -gpu 1 "C:\temp\Video\Reencoded\MOVI0004.mkv"

Fast reencode of video file which makes transcoding of "Airon Simple Full HD" videofile to MKV using h264_nvenc.
C:\soft\ffmpeg_cuda\media-autobuild_suite\local64\bin-video\ffmpeg.exe -i "C:\torrent\Video\Series\Death_Note_[BDRip_720p]\Death Note - 01 [BDRip 1280x720 x264].mkv" -f matroska -map 0 -c copy -codec:v h264_nvenc -pix_fmt yuv420p -b:v 8M -vf pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" -gpu 1 "C:\torrent\Video\Series\Reencoded\DeathNote_ffmpeg_hvenc5_try1\Death Note - 01 [BDRip 1280x720 x264].mkv"

Here all almost the same, but introducing an option to use "older" format of videoframe - -pix_fmt yuv420p, which is supported by osmc@Raspberry Pi 3. Take a look also at -vf pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" (actually, it should be -filter:V:0 pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2"). I've found a recommendation to use "pad" filter instead of scale filter, as with scale you may obtain bad video (bloated, lapped image) in output file. Those maths is a workaround for an error about "not 2-based number in width or height of a video stream". NVENC can complain on width or height of output stream, and this is a workaround: using pad as a video container for "not changing video contents", but adding one line to width or height to make it dividable by 2.
Also, there I'm not using NVDEC as my input video is an anime wiht Hi10P profile, which is niot supported by my GTX755M, unfortunately. :(


text:
ffmpeg - two videos having same video length but different file size
I'm new to this compression thing. I use following command with the latest ffmpeg version to compress and downscale my 1080p videos.
ffmpeg -i input.mkv -af "aresample=async=1:first_pts=0" -c:v libx264 -crf 18 -preset medium -b:v 3000k -maxrate 3000k -bufsize 10000k -acodec aac -c:s copy -map 0 -vf scale=1280:-2 output.mkv

what i don't understand, two videos having same duration, only one audio stream. after compression one has filesize 2GB while other 5GB. Why so much difference?

The -b:v doesn't have effect here since crf was set. Drop crf for similar sizes. CRF varies the bitrate to do justice to the complexity of the video. It aims for keeping quality constant.

The -b:v doesn't have effect here since crf was set. Drop crf for similar sizes. CRF varies the bitrate to do justice to the complexity of the video. It aims for keeping quality constant.
Whether it's bitrate or CRF mode, the maxrate and bufsize do take effect.


text:
What does it mean when encode a yuv422 file to yuv420 by libx264 lossless encoding?
I have an AVI file input.avi encoded in HQ which has yuv422 format according to ffprobe.
Now, if I run the following command
ffmpeg -i input.avi -c:v libx264 -crf 0 -pix_fmt yuv420p out.mp4

Will the out.mp4 be lossless compared with input.avi? or it will be 'lossless' except half of the U and V information is lost?

No. Yes. You pretty much answered your own question in the last line.

BTW you can encode h.264 in yuv422, but not all players will play it

@stib Thanks! I want to calculate the PSNR and SSIM between input.avi and an encoded mp4 file. But the yuv format is different, so I am encoding the input.avi to 'lossless' yuv420p mp4, then calculate the PSNR and SSIM.

Just look at the SSIM score for the luma plane. U and V are not relevant in this case. Or you could downsample the AVI to 4:2:0 before passing it to the quality compare filters i.e. [1]format=yuv420p[a];[0][a]psnr..

@Mulvya Thanks! Would you please give a full command sample? I am new to ffmpeg, I am not sure how to add [1]format=yuv420p[a];[0][a]psnr.. to my command

To directly compare the YUV422P AVI and YUV420P MP4,
ffmpeg -i input.avi -i out.mp4
   -filter_complex
      "[0]format=yuv420p,split[avi-p][avi-s];
       [1][avi-p]psnr;[1][avi-s]ssim" -f null -

It gives an average value on the terminal, how can we output a log file with values of each frame?  I tried -lavfi psnr="stats_file=psnr.log" but no luck.


text:
Stream desktop (linux) with FFMPEG to VLC
Hey guys how can I stream my desktop to vlc I did found some examples but they do not work;First I need to start ffserver with some configs example here https://www.organicdesign.co.nz/Simple_video_streaming_with_ffserver then when I start stream with
ffmpeg -f video4linux2 -i /dev/video0 127.0.0.1/cam1.ffm

I got an error /dev/video0: No such file or directory

No need to use ffmpeg here:
Open VLC, go to Media > Open Capture Device and set Capture Mode to Desktop
Also see:

https://wiki.videolan.org/Documentation:Modules/screen/
https://wiki.videolan.org/Documentation:Command_line/#Desktop.2FScreen_grab_options


text:
Blending images together to form a single exposure
I am trying to create a hyperlapse and I'm following a certain method that is mentioned in this post:
http://blog.planet5d.com/2016/03/time-warp-saigon-with-the-dji-osmo/

So if you
  now want it to look like you shot an image every 4 seconds, you have
  to take 2 seconds of video and blend the frames to form a single
  exposure.

I created a script that extracts out the images from each frame of the video via ffmpeg. Now, I'm trying to create a single blended image from each 2 seconds of video which was shot at 30fps. I have tried imagemagick but the results are ok. There is quite a bit of ghosting going on along with some other artifacts.
Here is the command I used:
convert frame*.jpg -evaluate-sequence mean output_file

I've also tried the median option but it came out even worse. Not sure if it works well if the camera is not fixed in one position.
I'm wondering if there are other options out there for blending images together. Am I on the right track with imagemagick?
Here is an example of a blended photo that has the green lights (from people carrying light sticks) that stays consistent throughout much of the video and ghosting on the left hand side.
Note: I am using the same gimbal as shown in the video.

Can you post some images to show what you mean by 'ghosting' and 'other artefacts'?

Since the ghosts must have been walking towards you they're moving relatively fast in the frame, so they're only in one frame in each position. That's kinda the nature of timelapse. You could remove them if there was some way of doing a statistical analysis of the pixels in the combined images and discarding the outliers, or you could avoid them by shooting at a much higher frame rate so that there are enough frames of the fast moving people to blend into a smooth blur. How high the frame rate would need to be would depend on the situation.

'Not sure if it works well if the camera is not fixed in one
  position.'

Correct. If you're doing time-lapse you need to have the camera stabilised somehow, or it's going to look wobbly AF. If the camera is moving in real time, then when you speed it up it will be moving 30 times as fast, so something that might look like a slow pan turns into a whip pan.
If you average out 30 frames then you're going to see partial exposures of everything in those frames, which means if something is moving rapidly you'll get a semi transparent 'ghost' of it - the less frames it is in, the more transparent it will appear.
The reason that video works well is that they're using an electronic gimbal to stabilise the camera—that's what they're showing off. Even though the frame is constantly moving there's enough that is consistent across the whole second to achieve a sharp frame, and the camera motion is stable enough that when it's sped up it's still fluid.

I should have added that I have the same gimbal. I guess I could improve the stability. I just wanted to make sure that my process is ok.

As a still image that looks all right to me. Given that you're doing timelapse people expect things like the ghosts. It's the content that makes timelapse interesting.


text:
Android - Media Encoder HEVC Plays, FFMPEG HEVC Won't
The Problem
I've been fighting with this for days. I'm writing a video application for Android to be used on an Odroid C2. I've been simultaneously developing some scripts that utilize ffmpeg to produce files to be played on the Odroid.
My issue is that videos encoded with FFMPEG won't play. At first I thought it was my application, but they won't play from a jump drive, either. Videos produced by Adobe's Media Encoder work fine.
Both are encoding the same tiff image sequence. I've attached the MediaInfo screenshots below. If anyone could shed some light on something I don't know, it would be greatly appreciated.
Media Encoder

FFMPEG

Console Output
Here are some related console messages from Android. It looks like Android can't identify the codec for some reason. =/
12-19 22:14:56.216 16588-16602/? V/AmThumbnail: vp_open=amthumb:AmlogicPlayer=[f68dfff0:972000f],AmlogicPlayer_fd=[f68e0008:971fff7]
12-19 22:14:56.216 16588-16602/? V/AmThumbnail: android_open amthumb:AmlogicPlayer=[f68dfff0:972000f],AmlogicPlayer_fd=[f68e0008:971fff7] OK,h->priv_data=0xf68e0008
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: No profile indication! (4)
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error decoding profile tier level.
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: No profile indication! (4)
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: error decoding profile tier level
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: SPS does not exist
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.

...

12-19 22:14:56.336 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.336 16588-16602/? I/exffmpeg: PPS id out of range: 0
12-19 22:14:56.336 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800]
12-19 22:14:56.336 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.
12-19 22:14:56.336 16588-16602/? I/exffmpeg: [mov,mp4,m4a,3gp,3g2,mj2 @ 0xf6887c00]
12-19 22:14:56.336 16588-16602/? I/exffmpeg: decoding for stream 0 failed
12-19 22:14:56.337 16588-16602/? I/exffmpeg: [mov,mp4,m4a,3gp,3g2,mj2 @ 0xf6887c00]
12-19 22:14:56.337 16588-16602/? I/exffmpeg: Could not find codec parameters for stream 0 (Video: hevc (hev1 / 0x31766568), 3840x2160, 33528 kb/s): unspecified pixel format
                                             Consider increasing the value for the 'analyzeduration' and 'probesize' options

Edit
This is the ffmpeg command being used. I'm encoding a test sequence of 300 frames.
ffmpeg -framerate 29.97 -start_number 2000 -i example_%05d.tif -c:v libx265 -preset ultrafast -crf 18 -vf "colormatrix=fcc:bt709" -pix_fmt yuv420p -color_range 2 output.mp4

FFMPEG Console Output
ffmpeg -y -framerate 29.97 -start_number 2000 -i attd_1p_%05d.tif -c:v libx265 -preset ultrafast -crf 18 -vf "colormatrix=fcc:bt709" -pix_fmt yuv420p -color_range 2 ../H265_TEST.mp4
ffmpeg version 3.1.5-1~xenial Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 20160609
  configuration: --prefix=/usr --extra-version='1~xenial' --libdir=/usr/lib/ffmpeg --shlibdir=/usr/lib/ffmpeg --disable-static --disable-debug --toolchain=hardened --enable-pthreads --enable-runtime-cpudetect --enable-gpl --enable-shared --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-libkvazaar --enable-libopenh264 --enable-nonfree --enable-libfdk-aac --enable-libfaac
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'attd_1p_%05d.tif':
  Duration: 00:00:10.01, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 29.97 tbr, 29.97 tbn, 29.97 tbc
x265 [info]: HEVC encoder version 1.9
x265 [info]: build info [Linux][GCC 5.3.1][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main profile, Level-5 (Main tier)
x265 [info]: Thread pool created using 16 threads
x265 [info]: frame threads / pool features       : 5 / wpp(68 rows)
x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 0
x265 [info]: Lookahead / bframes / badapt        : 5 / 3 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 0 / 0
x265 [info]: References / ref-limit  cu / depth  : 1 / 0 / 0
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-18.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=8 deblock
[mp4 @ 0x17c7d00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to '../H265_TEST.mp4':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: hevc (libx265) ([35][0][0][0] / 0x0023), yuv420p(pc), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 11988 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.48.101 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (tiff (native) -> hevc (libx265))
Press [q] to stop, [?] for help
frame=  300 fps= 12 q=-0.0 Lsize=  224166kB time=00:00:09.90 bitrate=185304.4kbits/s speed=0.389x    x
video:224158kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 0.003441%
x265 [info]: frame I:      2, Avg QP:20.61  kb/s: 544482.73
x265 [info]: frame P:     75, Avg QP:22.74  kb/s: 341028.20
x265 [info]: frame B:    223, Avg QP:25.66  kb/s: 127208.97
x265 [info]: consecutive B-frames: 2.6% 1.3% 0.0% 96.1%

encoded 300 frames in 25.62s (11.71 fps), 183445.62 kb/s, Avg QP:24.90

Show your ffmpeg command and full console output. Offhand, it looks like different codec tags are used, which indicate difference in where the player looks for stream parameter sets.

ffmpeg -framerate 29.97 -i example_%05d.tif -c:v libx265 -preset ultrafast -vf colormatrix=fcc:bt709 output.mp4

I'm going to post the console output when I get back to work tomorrow. Thanks for the response.

I edited the question to include the ffmpeg command and the console output. I modified the command because I was typing it from memory last night and forgot a couple arguments.

Ok, try your command with -vtag hvc1 -strict -2 Check that the tag has changed in the output. Strange thing is that on Android, the decoder is ffmpeg!

Is there a specific place in the command that it needs to go? I tried it at the end right before output.mp4, but MediaInfo still shows that it's hev1 instead of hvc1.
Also, I've previously tried adding -vtag hvc1 without the -strict -2 and it gave the error Tag hvc1/0x31637668 incompatible with output codec id '174' ([35][0][0][0]).
Thoughts? I'm new to these lower level codec particulars.

Ok. Looks like ffmpeg will use hvc1 for MOV, but not for MP4. You can use mp4box on  the ffmpeg output:  mp4box -add out.mp4 -new final.mp4

It still says hev1. I'm trying a suggestion made [here] (http://stackoverflow.com/questions/32152090/encode-h265-to-hvc1-codec)

Lol at my link attempt. Never put one in a comment.

With Mulvya's help, I figured out the issue. FFMPEG was using a codec tag of hev1, while Media Encoder was using hvc1. Nothing I tried in FFMPEG would change this.
Mulvya suggested I use mp4box to repackage. mp4box -add out.mp4 -new final.mp4 didn't work. But, after a little more searching, I ended up following the suggestion here and used mp4box to extract the raw .hvc file from the file that FFMPEG gave me, and repackaged it into a new mp4 file. That seemed to fix it.

Note
Something that doesn't make sense is the fact that I ran a Media Encoder file through FFMPEG with -c copy, and the resulting file had a codec tag of hev1, but it still played on the Odroid players. Based on that, I wouldn't have expected the solution above to work, but it did.
Edit - As pointed out by Mulvya, the explanation for the above note is that even with the tag hev1, the stream from Media Encoder has the PS where the player expects it.

The tag signals where the parameter sets can be found. Even with a tag of hev1, the Media Encoder stream has the PS where your player expects it.

That makes sense. Thanks so much for your help. Do you have a good resource suggestion for me to learn all of these lower level details?

No single source, really. Trial/error and research as the issues arise.


text:
How to make an animation of light in After effects?
I need such a result, as in this image: https://i.sstatic.net/3LshT.gif
I want to animate the light in the hand of the girl. I was looking for a video on this topic on the Internet, but found nothing. Please help in this matter.

Well, there's a lot that would go into that effect, especially if the girl's hand is moving. Here's the basics so that you can better know what kinds of tutorials to search for.
To create the light you'd probably use what's called a "particle generator" combined with a star glow or shine effect (e.g., Trapcode Starglow.) If you don't want to shell out for that plugin, search for how to do "light streaks effect" or "shine effects" in AE "without plugins."
To make it look like it's within her hand (i.e., sandwiched between her fingers and her palm) you'd need to understand how to "animate mask paths" (in order to mask her fingers into their own separate layer.)
To make the light follow her hand around you'd need to learn about "motion tracking."


text:
Error while trying to set ffmpeg profile
Ok, I have a feeling this might be a silly question, but I can't see what I am doing wrong. This is my command:
ffmpeg -i input.mov -c:v libx264 -profile:v baseline output.mp4
and the error it returns is: "Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height"
I tried specifying the audio codec and using the other profiles, all to no avail... But the command works if I drop the -profile
Here is the log:
ffmpeg version N-78758-g5156578 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.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-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 27.100 / 57. 27.100
  libavformat    57. 26.100 / 57. 26.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 37.100 /  6. 37.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Guessed Channel Layout for  Input Stream #0.0 : 7.1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '16BL3.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2016-12-16 09:39:01
    timecode        : 00:16:02;15
  Duration: 00:00:53.95, start: 0.557267, bitrate: 59879 kb/s
    Stream #0:0(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 8 channels, s32 (24 bit), 9216 kb/s (default)
    Metadata:
      creation_time   : 2016-12-16 09:39:01
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2016-12-16 09:39:01
      handler_name    : Apple Alias Data Handler
      timecode        : 00:16:02;15
    Stream #0:2(eng): Video: mpeg2video (4:2:2) (xd5b / 0x62356478), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2016-12-16 10:23:54
      handler_name    : Apple Alias Data Handler
      timecode        : 00:16:02;15
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
x264 [error]: baseline profile doesn't support 4:2:2
[libx264 @ 0371fa00] Error setting profile baseline.
[libx264 @ 0371fa00] Possible profiles: baseline main high high10 high422 high444
Output #0, mp4, to 'bloco3.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    timecode        : 00:16:02;15
    Stream #0:0(eng): Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 29.97 fps (default)
    Metadata:
      creation_time   : 2016-12-16 10:23:54
      handler_name    : Apple Alias Data Handler
      timecode        : 00:16:02;15
      encoder         : Lavc57.27.100 libx264
    Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-12-16 09:39:01
      handler_name    : Apple Alias Data Handler
      encoder         : Lavc57.27.100 aac
Stream mapping:
  Stream #0:2 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (pcm_s24le (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Any clue on what might be going on?

Great question and I'm surprised ffmpeg doesn't use a default pixel format for the baseline profile like it does with the high444 profile.

Forget it. Posting this question made me pay more attention to the log: if anyone is interested the answer is that you have to specify the colour space - "-pix_fmt yuv420p" in my case. Sorry guys.

What's the default profile and colour space that's used if you don't specify either -profile:v or -pix_fmt ?

In my case, i did this:
ffmpeg -loop 1 -i background.jpg -i input.mp3  -y -pix_fmt yuv420p -shortest -c:v libx264 -c:a aac -c:s mov_text -strict experimental -vprofile baseline -level 2  -threads 0 out4.mp4


text:
Is one able to "override" the terms of the Youtube Standard Licence with a slightly stricter Creative Commons than is allowed by the interface?
I'm creating my first YouTube video and am a bit disappointed with the licensing options. Ideally, I would want to use a CC BY-NC license because I don't really want others profiting off of my work, but that is not an option in the interface. If I select the standard license, but put something like "Licensed under CC BY-NC, despite what the interface says" in the video, is that able to override the standard license? If not, is there any other way to license my video how I want to?
Edit: Just for the sake of clarity, I mean selecting the Youtube Standard License for my video, NOT the default provided CC license.

There's also the option of using something other than youtube, eg. Vimeo, which offers CC-BY-NC as an option.

@JonasCz I know, but they aren't quite as popular and I didn't want to have to deal with a completely new interface.

Don't do it
As @Mulvya mentioned, it is not a good idea to attempt to 'overwrite' the CC licence set in the video settings by putting a disclaimer in your video or video description. Apart from the legal implications and ambiguity, there's another problem: You're only changing the human-readable layer of the licence, while the machine-readable layer stays the same (an explanation on the three layers of the CC licences can be found here). What that means is that even though a human watching your video will be able to understand your intent to apply a more restrictive licence, a machine (e.g. an automated web crawler) will not. So your video will still show up in the search results when somebody searches for content licenced under the CC-BY licence. So by setting your video to CC-BY and disputing that claim in your video or video description, you are creating ambiguity for the user. I also doubt a disclaimer that the licence set by you in the YouTute interface does not apply would hold up in court, but IANAL.
Alternative
Hosting your video on YouTube with the intent to share it for others to adapt, remix and reuse is not a good idea in the first place. The stark compression applied by YouTube will significantly lower the quality of your video. The quality loss will only increase as others download your video, import it into their own projects, reencode it again and upload it to YouTube, where it's reencoded once more. On top of that, YouTube doesn't even offer a convenient way to download user-uploaded videos (though you can use them in YouTube's own video editor, but hardly anyone uses that anyway ...). For more information on YouTube's video compression, read my answers here and here.
Instead, I suggest you upload a high-quality version of your video to a dedicated file hosting service and put your licence terms there. You can also bundle your video file with a text-file containing a description of your licence terms and a link to the online licence. This eliminates all ambiguity and allows everyone to use your video under clearly-defined terms.
If you do this, put a link to the downloadable version of your video in your video description. Also, make sure to select the YouTube Standard Licence for this video. This allows users access for only private, non-commercial viewing purposes (see YouTube terms section 6). This way, you can make sure there's no ambiguity regarding your licence terms. As a sideeffect, this will point people towards the high-quality version, meaning nobody will use a low-quality version ripped from YouTube, in case you care about that.

This is kind of what I did. I only really stated that it was under CC BY-NC in the description next to the link, and at the end of the video (on YouTube and on the other version) it states that the version in the description is under CC BY-NC. I kind of hope that YouTube will actually add more CC licenses.

The University of Edinburgh seems to think that one can override the default CC license by noting it in the description.
See Option C.

Alternately text can be added to the description of your YouTube video
  stating additional licensing information you may want to provide.
For example, a number of the videos created for Edinburgh University
  MOOCs which are placed on YouTube have been notated with the CC BY-NC
  licence and include a link to the licence details.


text:
ffmpeg trim filter renders the same length output as input with trimmed out frames as static
I am using the trim filter to cut out portions of my input pad that I do not want. I cannot use the -ss or -t option because I have to do trimming inside the filter-graph.
Here is my trim usage
trim=start=4:duration=4

The source is 10 seconds long, I just want to retrieve the portion starting at 4th second till 8th second. I get it with the above filter usage, but the output is still 10 seconds long with the trimmed out portions at the start and the end shown as "static" or paused frames. How do I get rid of those?
Edit: I was able to cut out the static frames at the start by using setpts=PTS-STARTPTS but what it did was, it added that extra duration at the end.
Here is my full command with output
C:\Temp\del>c:\temp\ffmpeg\bin\ffmpeg.exe -y -i source\6.MOV -vf "trim=start=4:end=8:duration=4,setpts=PTS-STARTPTS" out\ test.mov ffmpeg version N-82151-g1e660fe Copyright (c) 2000-2016 the FFmpeg developers   built with gcc 5.4.0 (GCC)   configuration: --enable-gpl
--enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --en able-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --en able-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3la me --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --en able-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --e nable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-l ibxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib   libavutil      55. 35.100 / 55. 35.100   libavcodec     57. 65.100 / 57. 65.100   libavformat    57. 57.100 / 57. 57.100   libavdevice    57.  2.100 / 57.  2.100   libavfilter     6. 66.100 /  6. 66.100   libswscale      4.  3.100 /
4.  3.100   libswresample   2.  4.100 /  2.  4.100   libpostproc    54.  2.100 / 54.  2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source\6.MOV':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2016-12-24T03:18:57.000000Z
    com.apple.quicktime.location.ISO6709: +30.1993-081.6121+005.747/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.software: 10.2
    com.apple.quicktime.creationdate: 2016-12-23T22:18:57-0500   Duration: 00:00:10.58, start: 0.000000, bitrate: 15407 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 15316 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1 200 tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -180.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 83 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler [libx264 @ 00000000007cc900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 00000000007cc900] profile High, level 4.0 [libx264 @ 00000000007cc900] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.ht ml - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 tre llis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 int erlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250  keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq
=1:1.00 Output #0, mov, to 'out\test.mov':   Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.creationdate: 2016-12-23T22:18:57-0500
    com.apple.quicktime.location.ISO6709: +30.1993-081.6121+005.747/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6s
    com.apple.quicktime.software: 10.2
    encoder         : Lavf57.57.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : Core Media Data Handler
      creation_time   : 2016-12-24T03:18:57.000000Z
      encoder         : Lavc57.65.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      creation_time   : 2016-12-24T03:18:57.000000Z
      handler_name    : Core Media Data Handler
      encoder         : Lavc57.65.100 aac Stream mapping:   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))   Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help frame=  120 fps= 18 q=-1.0 Lsize=    3030kB time=00:00:10.58 bitrate=2344.3kbits/s speed=1.63x video:2934kB audio:90kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214492% [libx264 @ 00000000007cc900] frame I:8     Avg QP:20.11  size: 39494 [libx264 @ 00000000007cc900] frame P:52    Avg QP:22.77  size: 28036 [libx264 @ 00000000007cc900] frame B:60    Avg QP:22.78  size: 20490 [libx264 @ 00000000007cc900] consecutive B-frames: 31.7%  3.3%  5.0%
60.0% [libx264 @ 00000000007cc900] mb I  I16..4: 21.2% 77.3%  1.4% [libx264 @ 00000000007cc900] mb P  I16..4: 17.2% 45.0%  0.2%  P16..4:
30.2%  2.8%  1.0%  0.0%  0.0%    skip: 3.6% [libx264 @ 00000000007cc900] mb B  I16..4:  4.8%  6.5%  0.0%  B16..8: 34.5%  4.1%
0.6%  direct:25.4%  skip:24.2%  L0:48.4% L1:49.0% BI:
2.6% [libx264 @ 00000000007cc900] 8x8 transform intra:71.0% inter:91.1% [libx264 @ 00000000007cc900] coded y,uvDC,uvAC intra:
34.3% 68.7% 0.9% inter: 24.4% 66.3% 0.0% [libx264 @ 00000000007cc900] i16 v,h,dc,p: 26% 23% 17% 34% [libx264 @ 00000000007cc900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 33%  4%  3%  3%  3%  3%  3% [libx264 @ 00000000007cc900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 23% 19%  4%  6%  4%  4%  3%  2% [libx264 @ 00000000007cc900] i8c dc,h,v,p: 54% 25% 20%  1% [libx264 @ 00000000007cc900] Weighted P-Frames: Y:1.9% UV:0.0% [libx264 @ 00000000007cc900] ref P L0: 63.9%  6.5% 19.8%  9.9% [libx264 @ 00000000007cc900] ref B L0: 83.2% 13.5%  3.4% [libx264 @ 00000000007cc900] ref B L1: 92.5%  7.5% [libx264 @ 00000000007cc900] kb/s:6000.51 [aac @ 000000000075e020] Qavg: 699.398

Edit 2: My question was simplified for better understanding of the issue, my actual movie making command is as follows
ffmpeg.exe -y -i C:\Temp\del\source\1.mov -i C:\Temp\del\source\2.mov  -i C:\Temp\del\source\3.mov  -filter_complex "[0:v]drawtext=fontfile=/Windows/Fonts/ARLRDBD.ttf:fontsize=80:x=10:y=10:text='Title Goes Here':fontcolor=white@0.8:box=1:boxcolor=black@0.5:enable='between(t,12,18)'[first];[1:v]trim=start=4:duration=4,setpts=PTS-STARTPTS[second];[2:v]drawtext=fontfile=/Windows/Fonts/ARLRDBD.ttf:fontsize=80:x=10:y=10:text='Thank you for watching':fontcolor=white@0.8:box=1:boxcolor=black@0.5:enable='between(t,0,1)'[third]; [first][second][third] concat=n=3:v=1"

Show the full command and console output.

@Mulvya Edited my question.

Since there is an audio stream present which is included in the output, you need to either disable that or trim it as well.
With audio trimmed:
ffmpeg -y -i source\6.MOV -vf "trim=start=4:end=8,setpts=PTS-STARTPTS" -af "atrim=start=4:end=8,asetpts=PTS-STARTPTS"  out\test.mov

Audio disabled:
ffmpeg -y -i source\6.MOV -vf "trim=start=4:end=8,setpts=PTS-STARTPTS" -an out\test.mov

My question is simplified, I have this trim filter in the middle of a filter-graph in my filter_complex script. How can I remove/disable the audio? I don't really need it.

Add -an as in 2nd command.

I have to disable the sound and output the trim output to an output [pad]. My actual ffmpeg command is huge, this trimming is one small part of it. Is there any other filter I have to combine with trim to get rid of the audio?

No, just add -an

I have a huge -filter_complex script dealing with multiple sources. I need to remove audio only from this clip in question. -an is disabling audio from the whole output.

Do you have -map options set?

Not using -map no

Show full command.

Add -shortest. Don't have console output of full command, but looks like audio of 1.mov is longer than the concat output.


text:
ffmpeg adding image overlay to video output
HI i am trying to add image to video and generate output.
Here is my command
ImagesFFMPeg Command is:
-y -i /storage/sdcard/BigBuckBunny_320x180.mp4 -i /sdcard/android.png -filter_complex [0:v][1:v]overlay=10:10[out] -map [out] -map 0:a -vcodec h264 -pix_fmt yuv420p /storage/sdcard/overlay.mp4

EDITED Video that is getting generated in 0 Bytes corrupted is there anything i am doing wrong here.
    ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   built with gcc 4.8 (GCC)
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/i686-linux-android- --arch=x86 --cpu=i686 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/x86 --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -march=i686' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libavutil      55. 17.103 / 55. 17.103
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libavcodec     57. 24.102 / 57. 24.102
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libavformat    57. 25.100 / 57. 25.100
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libavdevice    57.  0.101 / 57.  0.101
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libavfilter     6. 31.100 /  6. 31.100
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libswscale      4.  0.100 /  4.  0.100
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libswresample   2.  0.101 /  2.  0.101
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   libpostproc    54.  0.100 / 54.  0.100
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/sdcard/BigBuckBunny_320x180.mp4':
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Metadata:
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     major_brand     : isom
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     minor_version   : 512
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     compatible_brands: mp41
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     creation_time   : 1970-01-01 00:00:00
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     title           : Big Buck Bunny
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     artist          : Blender Foundation
12-29 01:37:59.926 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     composer        : Blender Foundation
12-29 01:37:59.936 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 478K, 14% free 4653K/5372K, paused 2ms, total 2ms
12-29 01:37:59.936 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     date            : 2008
12-29 01:37:59.936 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     encoder         : Lavf52.14.0
12-29 01:37:59.936 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
12-29 01:37:59.936 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
12-29 01:37:59.936 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Metadata:
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       creation_time   : 1970-01-01 00:00:00
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       handler_name    : VideoHandler
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Metadata:
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       creation_time   : 1970-01-01 00:00:00
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       handler_name    : SoundHandler
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: Input #1, png_pipe, from '/sdcard/android.png':
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Duration: N/A, bitrate: N/A
12-29 01:37:59.946 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Stream #1:0: Video: png, pal8(pc), 429x343, 25 tbr, 25 tbn, 25 tbc
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] using SAR=1/1
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] using cpu capabilities: none!
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] profile High, level 1.2
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: Output #0, mp4, to '/storage/sdcard/overlay.mp4':
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Metadata:
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     major_brand     : isom
12-29 01:37:59.976 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     minor_version   : 512
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     compatible_brands: mp41
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     date            : 2008
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     title           : Big Buck Bunny
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     artist          : Blender Foundation
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     composer        : Blender Foundation
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     encoder         : Lavf57.25.100
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Metadata:
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       encoder         : Lavc57.24.102 libx264
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Side data:
12-29 01:37:59.986 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       unknown side data type 10 (24 bytes)
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:     Metadata:
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       creation_time   : 1970-01-01 00:00:00
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       handler_name    : SoundHandler
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:       encoder         : Lavc57.24.102 aac
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: Stream mapping:
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Stream #0:0 (h264) -> overlay:main (graph 0)
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Stream #1:0 (png) -> overlay:overlay (graph 0)
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   overlay (graph 0) -> Stream #0:0 (libx264)
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress:   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
12-29 01:37:59.996 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: Press [q] to stop, [?] for help
12-29 01:38:00.436 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 491K, 14% free 4648K/5384K, paused 2ms, total 2ms
12-29 01:38:00.436 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=   67 fps=0.0 q=28.0 size=      11kB time=00:00:02.88 bitrate=  32.1kbits/s speed=5.76x
MainActivity: command in progress: frame= 3081 fps=220 q=28.0 size=    2230kB time=00:02:08.51 bitrate= 142.1kbits/s speed=9.16x
n progress: frame= 8419 fps=227 q=28.0 size=    6176kB time=00:05:50.89 bitrate= 144.2kbits/s speed=9.46x
12-29 01:38:37.506 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 479K, 15% free 4610K/5384K, paused 2ms, total 2ms
147.1kbits/s speed=9.25x
12-29 01:39:02.076 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 453K, 14% free 4652K/5384K, paused 2ms, total 2ms
12-29 01:39:02.086 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=13802 fps=222 q=28.0 size=   10320kB time=00:09:35.16 bitrate= 147.0kbits/s speed=9.26x
12-29 01:39:02.586 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=13917 fps=222 q=28.0 size=   10404kB time=00:09:39.96 bitrate= 147.0kbits/s speed=9.26x
12-29 01:39:03.086 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=14033 fps=222 q=28.0 size=   10486kB time=00:09:44.81 bitrate= 146.9kbits/s speed=9.26x
12-29 01:39:03.586 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=14154 fps=222 q=28.0 size=   10571kB time=00:09:49.84 bitrate= 146.8kbits/s speed=9.27x
12-29 01:39:04.076 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 464K, 15% free 4620K/5384K, paused 3ms, total 3ms
12-29 01:39:04.086 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=14265 fps=222 q=28.0 size=   10648kB time=00:09:54.49 bitrate= 146.7kbits/s speed=9.27x
12-29 01:39:04.416 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 471K, 15% free 4622K/5384K, paused 4ms, total 4ms
12-29 01:39:04.416 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 478K, 15% free 4623K/5384K, paused 2ms, total 2ms
12-29 01:39:04.426 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 364K, 14% free 4660K/5384K, paused 4ms, total 4ms
12-29 01:39:04.426 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: frame=14315 fps=222 q=-1.0 Lsize=   11125kB time=00:09:56.37 bitrate= 152.8kbits/s speed=9.25x
12-29 01:39:04.426 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 406K, 14% free 4679K/5384K, paused 3ms, total 3ms
12-29 01:39:04.426 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: video:1266kB audio:9453kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.784636%
12-29 01:39:04.436 26806-26937/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 465K, 15% free 4627K/5424K, paused 2ms, total 2ms
12-29 01:39:04.436 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] frame I:58    Avg QP:11.91  size:  2535
12-29 01:39:04.436 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] frame P:3607  Avg QP:25.51  size:   187
12-29 01:39:04.436 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] frame B:10650 Avg QP:32.15  size:    44
12-29 01:39:04.436 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
12-29 01:39:04.436 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] mb I  I16..4: 68.4% 11.5% 20.1%
12-29 01:39:04.456 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] mb P  I16..4:  0.7%  0.6%  0.6%  P16..4:  4.4%  1.5%  0.7%  0.0%  0.0%    skip:91.5%
12-29 01:39:04.456 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] mb B  I16..4:  0.0%  0.2%  0.0%  B16..8:  2.8%  0.6%  0.1%  direct: 0.1%  skip:96.1%  L0:50.1% L1:42.6% BI: 7.2%
12-29 01:39:04.456 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] 8x8 transform intra:29.0% inter:44.2%
12-29 01:39:04.456 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] coded y,uvDC,uvAC intra: 24.3% 29.8% 22.0% inter: 0.7% 0.6% 0.2%
12-29 01:39:04.456 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] i16 v,h,dc,p: 70% 30%  0%  0%
12-29 01:39:04.456 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13%  7% 80%  0%  0%  0%  0%  0%  0%
12-29 01:39:04.466 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 32% 25%  2%  2%  2%  2%  2%  3%
12-29 01:39:04.466 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] i8c dc,h,v,p: 50% 24% 25%  1%
12-29 01:39:04.466 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] Weighted P-Frames: Y:0.1% UV:0.0%
12-29 01:39:04.466 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] ref P L0: 73.9%  7.2% 13.6%  5.2%  0.0%
12-29 01:39:04.466 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] ref B L0: 71.4% 24.4%  4.3%
12-29 01:39:04.466 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] ref B L1: 94.2%  5.8%
12-29 01:39:04.476 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [libx264 @ 0xb8e776c0] kb/s:17.37
12-29 01:39:04.476 26806-26806/practice.com.ffmpegprac I/MainActivity: command in progress: [aac @ 0xb8e8f280] Qavg: 446.027
12-29 01:39:04.476 26806-26806/practice.com.ffmpegprac D/dalvikvm: GC_FOR_ALLOC freed 571K, 16% free 4599K/5424K, paused 2ms, total 2ms
12-29 01:39:04.476 26806-26806/practice.com.ffmpegprac I/MainActivity: command success: WARNING: linker: /data/data/practice.com.ffmpegprac/files/ffmpeg has text relocations. This is wasting memory and is a security risk. Please fix.
                                                                       ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
                                                                         built with gcc 4.8 (GCC)
                                                                         configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/i686-linux-android- --arch=x86 --cpu=i686 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/x86 --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -march=i686' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
                                                                         libavutil      55. 17.103 / 55. 17.103
                                                                         libavcodec     57. 24.102 / 57. 24.102
                                                                         libavformat    57. 25.100 / 57. 25.100
                                                                         libavdevice    57.  0.101 / 57.  0.101
                                                                         libavfilter     6. 31.100 /  6. 31.100
                                                                         libswscale      4.  0.100 /  4.  0.100
                                                                         libswresample   2.  0.101 /  2.  0.101
                                                                         libpostproc    54.  0.100 / 54.  0.100
                                                                       Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/sdcard/BigBuckBunny_320x180.mp4':
                                                                         Metadata:
                                                                           major_brand     : isom
                                                                           minor_version   : 512
                                                                           compatible_brands: mp41
                                                                           creation_time   : 1970-01-01 00:00:00
                                                                           title           : Big Buck Bunny
                                                                           artist          : Blender Foundation
                                                                           composer        : Blender Foundation
                                                                           date            : 2008
                                                                           encoder         : Lavf52.14.0
                                                                         Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
                                                                           Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
                                                                           Metadata:
                                                                             creation_time   : 1970-01-01 00:00:00
                                                                             handler_name    : VideoHandler
                                                                           Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
                                                                           Metadata:
                                                                             creation_time   : 1970-01-01 00:00:00
                                                                             handler_name    : SoundHandler
                                                                       Input #1, png_pipe, from '/sdcard/android.png':
                                                                         Duration: N/A, bitrate: N/A
                                                                           Stream #1:0: Video: png, pal8(pc), 429x343, 25 tbr, 25 tbn, 25 tbc
                                                                       [libx264 @ 0xb8e776c0] using SAR=1/1
                                                                       [libx264 @ 0xb8e776c0] using cpu capabilities: none!
                                                                       [libx264 @ 0xb8e776c0] profile High, level 1.2
                                                                       [libx264 @ 0xb8e776c0] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
                                                                       Output #0, mp4, to '/storage/sdcard/overlay.mp4':
                                                                         Metadata:
                                                                           major_brand     : isom
                                                                           minor_version   : 512
                                                                           compatible_brands: mp41
                                                                           date            : 2008
                                                                           title           : Big Buck Bunny
                                                                           artist          : Blender Foundation
                                                                           composer        : Blender Foundation
                                                                           encoder         : Lavf57.25.100
                                                                           Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
                                                                           Metadata:
                                                                             encoder         : Lavc57.24.102 libx264
                                                                           Side

Looks like an Android issue, permissions maybe?. ffmpeg is reporting an output size of 11125kB

@Mulvya I am running it on KitKat

@Mulvya original video is around 30-35 MB but output video size varies and it says cannot play media.

Your png does not have transparency and it's larger than the base video. As for playback, try adding -profile:v main -movflags +faststart

Is it mandatory to have transparency? I have a use case where i may or may not have transparency for some images.

I even tried movie overlay it also is not working -y -i /storage/sdcard/BigBuckBunny_320x180.mp4 -vf movie=/storage/sdcard/android.png [watermark]; [in][watermark] overlay=main_w-overlay_w-3:main_h-overlay_h-3 [out] /storage/sdcard/overlay.mp4


text:
FFMPEG: Delete chapters
I have a video file, video.mp4. This file has 3 chapters, 'Beginning', 'Middle' and 'End'. I want to delete chapter 'Middle' (the actual video, not just the metadata) and combine chapters 'Beginning' and 'End' back into one file. The chapters appear to be stored as subtitles.
How can I do this with ffmpeg?

Try adding this ffmpeg parameter:
-map_chapters -1

This only removes the chapter ToC, and doesn't affect the actual video stream.

Finally, thank you!!

I'm unaware of a function similar Mkvtoolnix' split before chapters functionality in ffmpeg, so you probably have to use seeking or MP4box as one has suggested in this thread. You are likely to face the same issues as have been reported for mkvmerge/Mkvtoolnix, being that splitting is not accurate for compressed video streams and can only be done at key frame boundaries. There is probably no way around loading the file into a video editor, cutting and re-encoding it for an accurate result… or splitting and re-encoding with ffmpeg instead of just copying the stream data.
I haven't heard of a format for chapters in subtitles, are these just regular subtitles? If so, which format? In this case you probably need to parse the file and extract or reformat the time codes if necessary.


text:
What Animation techniques did Walt Disney Studios came up with?
As far as I know, is Disney (Studios) pushing the envelope in every film they produce.
They allways try to come up with a new technique, with almost every film.
For example the "Multyplane Camera" in Snow White, the "Deep Canvas"-Method in Tarzan, the Snow animation in Frozen or the Hair in Tangled/Brave.
Has there been other technical development?
As far as I know, was the most progress made in the Disney Renaissance (Traditional Animation) or in recent years (3D Animation).
But what exactely(techniques) did they came up with?
Which methods did they invent?

I know Disney first make cartoon movie 60+ minutes (use public domain story) and created list of 12 principles of animation influence animation industry. But Disney Corp probably not first use these principles. 1914 Gertie Dinosaur animation use most principles already. Felix Cat cartoons from 1920s also use repeat background motion like Hanna Barbara, and use correct joint motion for characters instead hose style in later 1920s, animation cycles, and early 1930s (Felix Cat: Stone Age 1922). Fleischer Studio first use sound 1926, two years before Disney. Fleischer Studio also use real people with animation in the Out Of The Inkwell series (1918-29) and this series use limited animation method only redraw changing parts of characters (Hanna Barbara use this method from late 1950s).
Book Illusion Of Life tell about Disney animation invention and experiments with different animation effects (authors two Disney animators, maybe have bias). But I think Disney improve art quality and fluid motion in animation more than other company before.
Disney is probably first and best for cheat public domain (after take much from public domain) prevent their character become domain by buy politician in US Congress for extend their copyright (monopoly) two times.
Some modern methods at Disney Research (research paper):
https://www.disneyresearch.com/publication/

Can you summarize some of the linked material in case it becomes unavailable?