text:
Render settings for DVD in Vegas Pro
I've been working on a video project and output should be for DVD.
Video from camera:
1920×1080; 50 fps
65 min. after cut
Software: Vegas Pro 12.0
I need to render it in the best quality possible, but on the other hand, I need it to be max. 4 GB big in size (because of DVD limitations).
Could you please give me advice for best render settings and format choice?

What region and final output type do you need? E.g., NTSC or PAL?

I'm located in Central Europe, so I assume that I need PAL?

What settings have you tried so far, and what output sizes have you been getting with those settings?

I've tried using DVD architect - widescreen video stream PAL, output was circa 3 GB large, but quality was awful

are you authoring a DVD or saving a video file on DVD media to be played on a computer?

Hi, thanks for answering, but my problem is now out-of-date. I solved it somehow and after a year, I don't recall how.

Use variable bitrate to cut down on filesize

4 GB / 65 min = 8.2 Mb/s which is in the norm for DVD quality so fixed bitrate should be fine. The max DVD data bitrate is 10.08 Mb/s anyway.

Funny this answer has not been accepted, is the math too complex? Also, DVD does not support 50p, so need to re-encode into 25i. But then again DVD Architect should do it automatically. Not sure how the quality is "awful" - does the OP preview interlaced resulting video on a computer without deinterlacing?

If you captured at 50 fps, stick to 50 fps or 25 fps, otherwise Vegas will have to pulldown / interpolate / invent frames to go to 60 / 30 fps.
If all (most) of your footage is in Full HD (1080p 50fps), leave your Vegas project with this frame size.
If you are authoring a DVD, you should not determine the bitrate, but rather let DVD Architect determine automatic settings.

Your DVD authoring software should do this automatically. If you’ve got DNxHD (cross platform free) use something in the middle or higher range codecs. Take that nice HD file & let the software crunch it into the needed mpeg TS file.
As for the DVD spec it’s mpeg2 either PAL 720x576 interlaced 25fps or NTSC 720x480 interlaced both are upper field first. If your exporting from a lower field first source like dv pal deinterlace befoe export. The bit rate is technically 10mbps but you need to leave 1mbps for audio (. Remember to encode your DVD audio to ac3 to maximise the bit rate available for video. Also use a 2 pass Variable Bit Rate for best results.


text:
High cpu usage with FFMPEG copying video codec from HLS
Reposted from superuser: https://superuser.com/questions/1340574/ffmpeg-copy-hls-high-cpu-usage
I have a set of batch scripts (Windows 10) to create an "instant replay" for some (11) HLS streams using FFMPEG. When everything is working each instance uses less than 1% CPU. The problem I have is that FFMPEG regularly hangs and does not continue looping. When this happens, the instance jumps to 10-15% CPU usage.
The first time I had this problem, I updated my graphics card drivers and FFMPEG version and that worked for a while but the problem came back. I assumed that it was the graphics card going bad. I now have a brand new computer (Precision 7520 with Xeon E3-1535M v6, Quadro M2200, and 32GB ECC RAM) and the problem persists. I have no idea what the cause is. I have tried updating FFMPEG again to no avail.
If anybody has a fix that would be the best; however, if you know a way to monitor the processor usage and automatically kill ffmpeg when it spikes for more than 10s that would be an acceptable solution.
The recorder script is as follows:
Set Event=%1
Set CamName=%4
::SegLength is normally 30 to 60 seconds
Set SegLength=%2
Set BasePath=%3
mkdir "%BasePath%\%Event%\%CamName%\"
for /f %%i in ('yt-dl PATH_TO_master.m3u8 -f best --get-url') do set url="%%i"
:beg
Set "FileName=%CamName%.%TIME::=-%.mp4"
ffmpeg -n -i %url% -t %SegLength% -c:v copy -c:a copy -f mp4 "%BasePath%\%Event%\%CamName%\%FileName%"
goto :beg

I switched to a 32-bit binary and the problem has gone away.

source: Stack Exchange

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

sort: votes


text:
How to expand stroke width in one direction
am trying to scale the stroke width of a shape in AE in only one direction instead of all direction equally. Please assist

What have you tried so far? Can you share a sample of what you tried that didn't work the way you wanted it to?

you can't scale the stroke in AE it's fixed. But you can adjust it's stroke thickness.

However the stroke thickness is also fixed. So if you increase the number it will be applied to all sides. So if you want to increase the TOP thickness that's not possible
In addition: By defaul AE allows you to adjust the scale on all sides but you can adjust the scale by not affecting other sides(constrain proportions)
just unclick the link icon(see image below) and adjust

The first value allows you to adjust the length of the shape

The second value allows you to adjust the height of the shape

Adjusting the position of the anchor point has a different result. Positioning the anchor point to the end points allows you to increase or decrease that specific end point
In the picture below the anchor point is positioned at the mid bottom end point. Increasing the second value will increase the TOP HEIGHT without increasing the BOTTOM HEIGHT. Moving the anchor point on top MID end point will have an opposite effect..

Same goes for positioning the anchor point on the side

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


text:
How can I make videos like this? (mostly samples pitched into iconic pop or meme melodies)

Are there any explanations or tutorials? People don't seem to discuss how they're done in the comments at all and google doesn't help either.
I looked up some sheet music and pitched and adapted the horn sample to it in Audacity but 1) it takes unbearably long, 2) it does not help with the video and 3) made mistakes are difficult to correct. So what would be a better and faster way?

I can't think of a quick way to do this. It's probably going to be, as you said, an unbearably long process. I'd create the music separately from the video. That is:

First, compose some the background parts of all the songs you want to use (without the melody line). Sample the car horn.  Include that sample in a musical keyboard. Use that keyboard sample to play the melody line over your background music. Keep a recording of that.
Then bring that track into your video editor. Remove the video's sound and only allow the music you wrote. Then, cut up little tiny clips of your video - like the cat mid-air for a few frames. Pick 1-2 clips per "song". Repeat that same clip every time the sampled horn plays a note from the melody, and occasionally vary the clip a little (zoom in, reverse it, or some other variation).

That's going to be a very tedious project as you suspected. It took me hours to make this video, but I used the 2-step process above (though step 2 was obviously somewhat different).

I don't have After Effects to test it right now, but most probably you can do it like that:

Enable Time-Remapping of original clip
Add background music
Convert music to keyframes
Connect music-keyframes to Time-Remappng keyframes.

Need to wiggle a bit. But theoretically shall work.


text:
How do I make a professional slide show type video?
My wife reads little kid books on YouTube like this. It displays each page in a scrolling pan as she reads it. Our video creator is not longer working with us, so I need to learn how to do it. She had a Mac. I have Windows 10. I'm a software developer, but I don't speak this jargon so I don't even know what to search for.
I need help.

This question is a bit broad. Are you asking what software you need, how to edit or do visual effects, or what the effect is called? The first question can be answered by searching this site for "free video editing software", the second is beyond the scope of a SE answer, and the answer to the third is "Ken Burns Effect".

I know it's broad. I didn't know where else to go. Thank you for your direction.

This video is very simple to do.

Record voice.
Use a proper camera/phone that takes high resolution images (so that when you zoom in the software, it will retain the quality), then take a photo of each page of the book.
Import images and sound into the software.
Do those effects in video which are basically (tilt, pan, zoom-in, zoom-out) mix between them and adjust speed accordingly.

Note: its always better to record sound first, and animate based on that, so that you know how long is each shot and when to cut.
What software: Personally I only use After Effects and Premier Pro, they are not free but there is a Trial. Check this article for PAID and FREE editing software and try some of them: The best video editing software 2018: paid and free

Basically the effects/transitions mentioned above can be done with any of those softwares, a couple of tutorials should make it possible.

I found Filmora for Windows. It seems affordable. The feature therein is called Pan and Zoom. This looks like it will work and be pretty easy.
Thanks.

Oh, I didn't realize that it was you who answered yourself. Kindly mark your answer and good luck.

@MEGA, Yeah, stib's comment helped me narrow my search. This is what I found. But I like your answer too. Thanks.

I am glad i could help somehow. all the best.

@MEGA, I have to say this was a way better experience that I had on stackoverflow the last few years. Thank you.


text:
What is KeyInt and min-keyint and no-scenecut
I am absolutely new to video processing, I am building a video streaming site and worked with ffmpeg to generate the formats I need for ShakaPackager.
Sadly I don't understand some of the options being provided, especially keyInt, min-keyint and no-scenecut.
Below you will find the code I use to generate the required formats for my videos.
ffmpeg -y -i ${1} -c:a aac -ac 2 -ab 256k -ar 48000 -c:v libx264 -x264opts "keyint=24:min-keyint=24:no-scenecut" -b:v 1500k -maxrate 1500k -bufsize 1000k -vf "scale=-2:720" "${2}/${3}720.mp4"

I did a bit of research and they talked about IDR-frames I don't even understand those, maybe my needs go way more than that?

The frames in your H.264 video are grouped into units called GOPs (Group Of Pictures). Inside these GOPs frames are classified into three types:

I-frame: frame that stores the whole picture
P-frame: frame that stores only the changes between the current picture and previous ones
B-frame: frame that stores differences with previous or future pictures

Additionally, I-frames can be classified as IDR frames and non-IDR frames. The difference is that frames following an IDR frame cannot reference any frame that comes before the IDR frame, while in the case of a non-IDR frame there are no limitations.
Every GOP starts with an I-frame, also called a keyframe, but may contain more than one. To create further confusion, a GOP can start with an IDR frame or with a non-IDR frame. This means that frames in the GOP can sometimes refer to previous GOPs (in this case the GOP is said to be "open"), and sometimes not (in this case it's closed).
It's common to see the structure of a GOP represented as in this example: IBBBPBBBPBBBI. Here the length of the the GOP is 12 frames, with 3 B-frames between each P-frame.
Now your questions:

keyint specifies the maximum length of the GOP, so the maximum interval between each keyframe, which remember that can be either an IDR frame or a non-IDR frame. I'm not completely sure but I think that by default ffmpeg will require every I-frame to be an IDR frame, so in practice you can use the terms IDR frame and I-frame interchangeably
min-keyint specifies the minimum length of the GOP. This is because the encoder might decide that it makes sense to add a keyframe before the keyint value, so you can put a limit
no-scenecut. When the encoder determines that there's been a scene cut, it may decide to insert an additional I-frame. The issue is that I-frames are very expensive if compared to other frame types, so when encoding for streaming you want to disable it.

A couple of other related parameters:

bframes specifies the number of consecutive B-frames
ref specifies the number of references frames that are used when encoding. It means that when encoding a picture, ref previous frames are looked at for encoding the current frame

In the OP's command, these are x264 options, so keyint and min-keyint relate to IDR placement, not non-RAP I frames.

Thanks for the amazing response... I have learnt so much.

My question now is how did you learn all of these, how do I learn too?

I wish i could give more votes to this one. Amazing answer and very informative. Thank you.

Most video encoders apply temporal compression i.e. most frames only store the difference in image content relative to other frames, thus saving storage space, while a few frames store the whole image. The frames with whole pictures are called key frames since they are required in order to reconstruct the whole picture of frames which only store differences. IDR frame in H264 stream denotes a keyframe.
Your code tells ffmpeg to generate a H264 video stream using the x264 encoder, and the options below are used by the encoder to decide keyframe placement.
-x264opts "keyint=24:min-keyint=24:no-scenecut"

keyint=24 tells x264 to forcibly generate a keyframe 24 frames after the last keyframe.
min-keyint=24 sets the minimum keyframe distance. The encoder may decide to place a keyframe on its own even if keyint # of frames haven't elapsed if it comes across an image which is more efficient to store as a complete picture rather than as a set of differences. min-keyint tells the encoder to never do this if the distance isn't at least 24. Since in this case keyint is the same value as min-keyint, all KFs will be 24 frames apart.
no-scenecut - scenecut is the value used by the encoder to calculate if it should force a keyframe if min-keyint allows it to. It can range from 0-100. no-scenecut tells the encoder to skip this evaluation.

What is the point of having no-scenecut when keyint = min-keyint? Aren’t they equivalent?

From what I remember, it saves the frame comparison analysis effort.

In my case the command above returns instantly. Any idea?

What is the point of having no-scenecut when keyint = min-keyint

There is the code in x264 (validate_parameters function):
if( h->param.i_keyint_min == X264_KEYINT_MIN_AUTO )
    h->param.i_keyint_min = X264_MIN( h->param.i_keyint_max / 10, (int)fps );

It will disallow equality of the keyint and keyint_min.

That's correct, but the piece of code you copied is not the relevant one. The line that performs the clipping is this one: h->param.i_keyint_min = x264_clip3( h->param.i_keyint_min, 1, h->param.i_keyint_max/2+1 );


text:
What it means "a royalty free alternative" to video/audio (WebM format)
The WebM format says:

WebM is an audiovisual media file format. It is primarily intended to offer a royalty-free alternative to use in the HTML5 video and the HTML5 audio elements.

I am not too familiar with video formats or copyright as related to videos, so wondering what exactly this means (I'm a web developer). Wondering if it means video formats such as mpeg you are supposed to pay royalties to i.e. Microsoft if you use AVI format, or MPEG if you use an mpg, and if so, how that works. Or if the royalty is paid somehow else, or if it means something entirely different.

It's a quite complex topic, but yes, when dealing with non-royalty-free technologies you are in some cases required to pay royalties to the patent holders, depending on your usage. This usually applies when you are the distributor of the video/audio content, but it depends from technology to technology.
Patent pools are groups of companies that claim fees for the usage of a particular technology that includes something protected by patents. An example of a patent pool is the one managed by the popular MPEG LA, which is concerned about technologies developed by the MPEG group (like AVC and HEVC).
It's also important to understand that while royalty-free technologies don't require you to pay, it doesn't mean that they don't include patented technologies. The creator of the technology (Google in this case) is risking for the usage of those technologies. They're basically saying "don't worry, we'll take care for you".

Source: An analysis of WebM and its patent risk.
A perfect example of a royalty-free technology is the new AV1 coding standard, developed by an alliance called AOMedia. For the fact that this alliance is composed of pretty much every important technology company that exists out there, the AV1 codec doesn't require content distributors to pay royalties to them.
John Luther from JW Player says:

AV1 could be different because collectively the AOM membership owns a vast trove of intellectual property. These assets can be used to defend the technology against patent claims from interests who might not want “a next-generation video format that is…interoperable and open.”

In the same way, the existence of a patent pool doesn't mean that companies in the pool are going to ask for money. For example, the HEVC decoding standard is composed of multiple patent pools, but one of the pools has still to decide whether it's going to ask for fees, and how much it's going to ask. Additionally, not all the companies holding patents regarding HEVC are included in the pools. This is one of the main reasons why HEVC hasn't spread so much so far.
Some resources:

Introduction to video compression patents
AVC fees
HEVC fees
About the MPEG disaster:

The Future of HEVC Licensing Is Bleak, Declares MPEG Chairman

To Deploy HEVC, Users Must Choose What Patent Pool To Dive Into
HEVC Advance Cuts Content Fees on Streaming
An Encouraging Development in the HEVC Patent Mess

An analysis of WebM and its patent risk
Google and MPEG LA settle long-running VP8/H.264 patent dispute
Discussione about: "The AV1 format is and will always be royalty-free"

It's worth noting in addition to @mcont's excellent answer, royalties for h.264 (the most popular encoder on the internet) are only applicable if you are charging viewers to watch, and then only when the viewer numbers go over a certain volume, or if you're charging per view only when the video is over a certain length. If your content is free to view then you won't need to pay royalties.
See this answer for more details.


text:
Is there any way to add a time remaining (.e.g. from 30 seconds to 1 second) clock to Premiere Pro 2018?
I'm trying to figure out how to add a time remaining clock to Premiere Pro 2018. My school's TV program recently switched over from AVID to Premiere and - while that's great for students who are editing - none of us can figure out how to find a time remaining function for the control room, which is an issue.
I don't think this is the right place to ask this question, but I can't figure out how to do anything like this on Google myself.
Thanks in advance for any help you guys can provide.
[I know that APP has third-party plugin support, but I wasn't able to find any that serve the purpose I want. If anyone can think of one that adds a reverse-timecode or time remaining clock where the normal sequence timer would be, that would be greatly appreciated.]

If you're looking to have the GUI Timecode display a reverse timecode (time remaining), that feature isn't possible. You can create a positive offset by clicking the timeline panel icon (upper right), and add positive time to the timeline/sequence. But it doesn't allow for negative values.
Burned in/visible on screen reverse timecode is possible.
Simply setup a new sequence. Create a new transparent video clip. Add the timecode filter.
Set the transparent video clip length to the exact countdown length you need for your program time. Adjust the timecode filter for position/opacity/size.
Return to your program sequence. Nest the "timecode" sequence you've just created within your program sequence on the very top track, or better add a few video tracks and hide it a few tracks above (to give you working room).
Right click the nested sequence clip -> click speed -> check reverse speed.
This will give you an on screen burned in timecode that counts down.
You can adjust the position of the TC display using the effects window.
If used only for editing purposes / pacing, you can use this sequence to reference time left within a given program, then simply disable visibility of the track to render out.
But as for a GUI / Worldclock display of TRT, that's not possible.

Damn. That's a shame.
Thanks for the help.

It would be a nice feature. But realistically you're looking for a feature not really intended for post-production editing. I see the point of it, it's it's odd that the sequence value for timecode doesn't allow for a negative offset, considering it allows for a positive one... but the work around I noted above (using a burn in onscreen via a nested sequence) would work for most editing situations where the cutter needs to hit specific countdown marks, either for music cues, breaks, or a program end point. You MIGHT be able to design your own workaround, using the multi-cam setup.

the problem isn't editing, but for broadcast. My school's T.V. program has been forced to move to premiere from AVID by the county, which is super frustrating - Premiere is great and all, but it's not the best for all the things that we need to do in broadcast. The person running audio/video needs to be able to call time remaining for the rest of the control room, and the county CTE director had assured my teacher that Premiere had all functionality of AVID, and nothing would be lost out on - which is definitely not the case, but there's nothing we can do at this point. :/

I would work on a plugin but I don't have nearly the knowledge required to undertake such a project. I've just started learning C++/C#, and Premiere plugins can't be built in Java as far as I'm aware.

I just made a fairly general web-based timer/clock animator that outputs WebP animations which you can then import into Premiere Pro (or Rush or anything else that supports animated WebP). E.g., to display numbers from 30 seconds to 1 seconds, set the start time to 30, the end time to 1, and change the line 1 format dropdown to "SS" to count 30,29,...,02,01, and to "S" to count 30,29,...,2,1. Adjust font, size and color to taste. Set background opacity to 0 if you want a fully transparent background. Click Generate and once it's done, you can download the WebP, and add it to a new track in Premiere.
If you want some text with the number, choose "Custom formatting" instead and then put something like "{S} seconds remaining".


text:
How can I remove an object from a shot?
I’m attempting to remove a head mounted GoPro in a mirror shot, exactly as seen in this video, around the 15 second mark:

I’m using premier pro cc 2018, and I’m just looking for some ideology, or methodology on how to do so. Obviously a clear cut solution would be ideal. Thank you.

Object removal is usually done by masking, tracking and inserting a clean plate into the masked area.
Easier done in After Effects than in Premiere.
It looks like in the above video it is a different shot inserted into the mirror.

Right of course! Just insert & conform a separate shot into the mirrors boundaries. Didn’t think of that haha.


text:
Transcode each stream in a different thread with ffmpeg
Is there a way of forcing ffmpeg to encode each audio stream in a different thread?
ffmpeg
    -i audio1.ac3 -c:a libopus
    -i audio2.ac3 -c:a libopus
    -i audio3.ac3 -c:a libopus
    output.mkv

I mean only ffmpeg's own instruments, without multiple processes and other OS features.
Normally, there is only one core saturated, so encoding a file with many audio streams is very long.
Exact command:
ffmpeg -loglevel verbose
    -i 'Ярость (Fury).mkv'
    -i 'Fury (2014) [Ukr & Eng, Sub Eng] BDRip-AVC [Hurtom & HELLYWOOD].mkv'
    -threads 0 -max_muxing_queue_size 65536 -avoid_negative_ts 1 -metadata title=2014.Fury.BDRip.HEVC.1080p
    -map 0:0 -c:v copy -metadata:s:v:0 title=2014.Fury.BDRip.HEVC.1080p -disposition:v:0 +default-forced
    -map 0:2 -c:a libopus -application audio -vbr on -packet_loss 0 -frame_duration 20 -mapping_family 255 -compression_level 10 -metadata:s:a:0 language=eng -metadata:s:a:0 title=Original -disposition:a:0 +default-forced
    -map 1:1 -c:a libopus -application audio -vbr on -packet_loss 0 -frame_duration 20 -mapping_family 255 -compression_level 10 -metadata:s:a:1 language=ukr -disposition:a:1 -default-forced
    -map 0:1 -c:a libopus -application audio -vbr on -packet_loss 0 -frame_duration 20 -mapping_family 255 -compression_level 10 -metadata:s:a:2 language=rus -metadata:s:a:2 title=Dub -disposition:a:2 -default-forced
    -map 0:10 -c:s copy -metadata:s:s:0 language=eng -metadata:s:s:0 title=Original -disposition:s:0 -default-forced
    -f matroska ./2014.Fury.BDRip.HEVC.1080p.mkv

Log:
... inputs ...
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (dts (dca) -> opus (libopus))
  Stream #1:1 -> #0:2 (ac3 (native) -> opus (libopus))
  Stream #0:1 -> #0:3 (ac3 (native) -> opus (libopus))
  Stream #0:10 -> #0:4 (copy)
Press [q] to stop, [?] for help
[graph_2_in_0_1 @ 0000019ca2cb29c0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
[format_out_0_3 @ 0000019ca2cb20c0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_3'
[auto_resampler_0 @ 0000019ca2cb27c0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:6 chl:5.1(side) fmt:flt r:48000Hz
[libopus @ 0000019ca2c9f3c0] No bit rate set. Defaulting to 384000 bps.
[graph_0_in_0_2 @ 0000019ca2cb1ac0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
[format_out_0_1 @ 0000019ca2cb1bc0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[auto_resampler_0 @ 0000019ca2cb14c0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:6 chl:5.1(side) fmt:flt r:48000Hz
[libopus @ 0000019ca292c980] No bit rate set. Defaulting to 384000 bps.
[graph_1_in_1_1 @ 0000019ca2cb2bc0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
[format_out_0_2 @ 0000019ca2cb26c0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_2'
[auto_resampler_0 @ 0000019ca2cb0dc0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:6 chl:5.1(side) fmt:flt r:48000Hz
[libopus @ 0000019ca292e980] No bit rate set. Defaulting to 384000 bps.
Output #0, matroska, to './2014.Fury.BDRip.HEVC.1080p.mkv':
  Metadata:
    DATE_RELEASED   : 2014
    title           : 2014.Fury.BDRip.HEVC.1080p
    Released by     : Buba5473 for NNM-Club
    Copyright       : Encoded by Goor80
    encoder         : Lavf58.12.100
    Chapter #0:0: start 0.000000, end 478.228000
    Metadata:
      title           : Chapter 01
    ... chapters ...
    Stream #0:0: Video: hevc (Main 10), 1 reference frame, yuv420p10le(tv), 1920x800 (0x0) [SAR 1:1 DAR 12:5], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, 5.1(side), flt, delay 312, 384 kb/s (default)
    Stream #0:2(ukr): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, 5.1(side), flt, delay 312, 384 kb/s
    Stream #0:3(rus): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, 5.1(side), flt, delay 312, 384 kb/s
    Stream #0:4(eng): Subtitle: subrip
[matroska @ 0000019ca2d17f00] Starting new cluster due to timestamp=6175.5kbits/s speed=10.2x
[matroska @ 0000019ca2d17f00] Starting new cluster due to timestamp=7530.8kbits/s speed=8.74x
[matroska @ 0000019ca2d17f00] Starting new cluster due to timestamp=7955.1kbits/s speed=9.02x
frame=156607 fps=205 q=-1.0 size= 8321971kB time=01:48:51.85 bitrate=10437.1kbits/s speed=8.55x
... not finished yet ...

fps is always around 3000/number_of_audio_channels, meaning all audio transcoding is done with the only thread.

Is that your exact command?

No, I removed unrelated options and details for better readability. I have tried to play with -threads, but this option is only about per-stream multithreading.

Share your exact command and log.

Posted the exact command and log above.

fps=205 only represents turnover of video frames.

I know, it is just a hint. Only one core is saturated no matter how many stream I encode.

I checked and don't think this is possible. Audio encoders are single-threaded and ffmpeg manages encoder frame dispatch in its main thread.

Ok. Put it into an answer and I'll give you the bounty.

Most (all ?) audio encoders are single-threaded and afaict, all encoding will occur in the main thread.
Maybe worth filing a feature request at trac.ffmpeg.org

I have already developed a wrapper running an ffmpeg instance for each stream and then mkvmerge'ing them together. Thanks for your help anyway.


text:
Grime-like blocking compression artifacts on the decompressed video (H.264)
During watching H.264 compressed videos one faced several times with an artifacts.
Example 1:
Example 2:
Wikipedia's article [1] tells that the typical reason is «Data errors in the compressed bit-stream, possibly due to transmission errors...». However, in case of local decoding there are no transmission errors. Then I noticed that during viewing the locally decoded video these artifacts appear at the same place in the timeline. The duration of these artifacts is about 0.5-1 seconds. These artifacts appear in the 1.5 hours video only once.
What are the possible reasons of these artifacts?
References:

https://en.wikipedia.org/wiki/Compression_artifact

PS. The question is also copied to dsp.stackexchange.com.

Please don't cross post questions.

Data errors in the compressed bit-stream, possibly due to transmission errors
(emphasis mine).
It may just be corruption in the bitstream. Another possibility is that the level flagged in the bitstream is under-specified. But that shouldn't be an issue in software playback, and it should probably occur more than once during playback, so I lean on the first candidate - corrupt bitstream.

Thanks for the answer, Gyan. Please, have a look at the question below McFlySoHigh's answer.

The data stream is missing sections of data. If the entire image suddenly goes highly blocky (edge to edge), that means the data loss includes the header frame of whatever structure (GOP) / codec was used to encode the file.
If you have small horizontal chunks missing, then there was data loss after the header frame, which can't be filled in by subsequent frames thereafter- as the loss was greater than the "error correction rate" of the encoding algorithm.
My guess is the top example is a case where the data loss included a full or partial loss of the GOP header frame, and the second example provided is one where a small packet of data was either encoded incorrectly, corrupted thereafter, or lost somehow.
The only way to correct this is to fill in the data, which would require recovery volumes (such as PAR files), to re-encode and hope it's not on the master; or 3 paint it out frame by frame in photoshop.

Thanks for the detailed answer. In this case is there any idea of how it was possible to get the corruption in the bitstream (case when the data stream is missing sections of data)? These videos were initially downloaded via the TCP (guaranteed delivery), so no data loss was possible during the transmission. Meaning that somehow at the video producer's side during video compression something has happened, which resulted in the bitstream corruption? If so, any idea (according to the practice/experience) of what exactly could happen? Asking out of curiosity. Thanks.


text:
Setting different resolution for encoding and display when encoding in ffmpeg
I'd like to encode a video, say, in 960 x 720 but have video players automatically play it in 1280 x 720.
I know how to do this in 2 steps, by first encoding in 960 x 720 (ffmpeg with -vf scale=960:720) and then modifying the display ratio with MKVToolNix/mkvmerge, but it would be a lot more convenient if I could do it all directly with a single ffmpeg command. Is it possible?
I don't think that matters, but my current code looks like this:
ffmpeg -i "input.mkv" -vf scale=960:720 -ac 2 -codec:a libopus -b:a 96k -vbr on -compression_level 10 -frame_duration 60 -application audio -codec:v libx265 -preset slow -x265-params crf=21 "output.mkv"

There's the setsar and setdar filters for this purpose
-vf scale=960:720,setdar=16/9

Since you know the output display ratio, it's convenient to use setdar here, although both filters only alter the SAR.


text:
Which software is used to produce this video?
Its an animation video. Can someone specify the software ? LINK

Welcome! That could have been made with almost any animation tool. It is more about technique than software. Is there a particular technique from a section of that video that you are interested in doing in an application you are familiar with?

Thank you! I am just a beginner. Can you tell me about the technique used from 2:20 to 2:30. Also please do recommend some software which can be used to do the same with minimal effort.

I like the do the same... with minimal effort part.

You can do it with minimal effort by hiring an animator.

My guess is maybe ToonBoom.
But regardless what software they used to stitch the final cut together, there were a host of software applications involved.
Illustration, likely Adobe Illustrator and Photoshop, Compositing, Could be ToonBoom, AfterEffects, or others. Audio was done separately, on the tail end. And I jumped over myself, they likely storyboarded all of the animations out in advance, ToonBoom, likely a good choice for that even if it's not what they used for the final mesh.
In addition, they undoubtably used a host of plugins, perhaps some free, some paid, some very expensive to assist with the motion control and character animation. And last, they likely also relied of pre-existing works, templates, which can be purchased.


text:
How can a similar effect to the one seen here be obtained?
I was re-watching for the upteenth time this video.
10 seconds in, when they start performing, the effect I would like to talk about is evident: the band members seem to move as if the video was sped up, yet their movements are in sync with the song (look at the drummer and most noticeably the singer lips).
It does not seem to me that they where filmed at a lower speed (i.e. also the song was being played slowly), so I am wondering, how can such an effect be obtained? Am I mistaken and the method is indeed the one I am discarding, or is there some more clever video editing process at play here?

It looks like a mix of factors to me.  Certainly re-timing (speeding up and jumping frames around) is a part of it, but mostly, I think they had a lot of wind on a green screen and then cut it over an environment where it doesn't make sense.  It's hard to tell how much the excess blinking is the wind and how much is re-timing, but some of it does appear to be retimes.  They vary the retiming of the composited content while keeping the background constant though which gives your brain less to latch on to.
As far as retiming in sync with the music, there is an easy trick to pull that off for songs.  You simply slow down a recording of the music by the desired amount and have them play along.  When sped back up, things match perfectly.


text:
Add image above the video with ffmepg
Apologies for being a ffmpeg noob, but I'm having trouble with modifying the answer to
Add image under the video with ffmepg
to place the image above instead of below the video...
My questions is in regard to modifying the command
ffmpeg -i video.mp4 -i image.png -filter_complex "[1:v]scale=320:-1[bottom];[0:v][bottom]vstack" output.mp4

I tried many different variations of this command to no avail and I think its my misunderstand of filter_complex and the meaning of "[1:v]" "[bottom]" and "[0:v]"
Thanks in advance for your help!

The basic form will be
ffmpeg -i video.mp4 -i image.png -filter_complex "[1:v]scale=320:-1[top];[top][0:v]vstack" output.mp4

A label of the form 1:v, equivalent to 1:v:0 within filters, is a stream specifier - it means use the first video stream of the 2nd input. 0:v refers to the first video stream of the first input.
The bottom in your command and top in mine are arbitrary labels assigned to the result of the scale filter.
Then that resulting stream is fed first to the vstack so that it gets stacked on top.

Thank you for the quick response! Now looking at it it seems so clear but you have no idea how many different orderings of the first command that I tried to no avail!


text:
Is it possible to merge two ffmpeg commands into one?
I'm using ffmpeg to do two things - add a transparent watermark to the whole video, and also add a title intro image. I'm using the following command to add the watermark:
ffmpeg -i original.mp4 -i watermark.png -filter_complex "overlay=W-w-45:H-h-35" watermarked.mp4

And this command to add the intro:
ffmpeg -itsoffset 2 -i watermarked.mp4 -r 25 -loop 1 -i intro.png -filter_complex "[1:v] fade=out:50:10:alpha=1 [intro]; [0:v][intro] overlay=shortest=1 [v]" -map "[v]" -map 0:a output.mp4

I'm concerned that by processing the video twice, I'm losing quality. Is there a way to add the watermark and the intro with just one ffmpeg command / just one pass on the video?
(I understand the first ffmpeg command above, but I'm a bit lost with the second one - I managed to get it working based on code I saw somewhere)

Can't test the below now, but it should be
ffmpeg -itsoffset 2 -i original.mp4 -i watermark.png -loop 1 -t 2.5 -i intro.png -filter_complex "[2:v] fade=out:50:10:alpha=1 [intro]; [0][1]overlay=W-w-45:H-h-35[main];[main][intro] overlay=eof_action=pass [v]" -map "[v]" -map 0:a output.mp4

Where does the watermark image come into that?

Corrected inputs


text:
FFmpeg scale video to desire size
I have an video with this resolution: 1920x1080,
I want to scale it to 480x852, like this video:
https://scontent-frx5-1.cdninstagram.com/vp/d7b76fe78c9ad72016b98dcda320a6ca/5BA532D8/t50.16885-16/10000000_232772710752607_772643665699930112_n.mp4
but it seems it's not working correctly.
here is my command:
-i input.mp4 -vf scale=480x852,setdar=1:009 -c:v libx264 -preset veryfast -profile:v main -crf 18 -c:a copy output.mp4

Where do I wrong?

Use
-vf scale=480:-1,pad=480:852:(ow-iw)/2:(oh-ih)/2,setdar=1


text:
Is MP4 a valid or common container for ProRes?
Is MP4 a valid or common container for ProRes? I've only seen it in MOVs and MXFs.

No, officially, ProRes is not a registered codec for the ISOBMFF family, of which MP4 is a member.


text:
Canon 800d/T7i clean-hdmi?
I've just bought a Canon 800d to use that as live cam recorder (using elgato game capture).
The problem is that the hdmi output has the focus box and I've managed to remove that only in manual focus mode, but I'd really like to have auto focus.
Do you know any solution?
I think that magic lantern is not yet compatible with the 800d.

I have been looking foe the same answer for the US version Rebel T7i. Unfortunately only the Pro versions of Canon have the true Mirroring or Clean HDMI out feature BUT by using Cannon Utilities and the USB connection rather than the HDMI mini a clean signal can be accomplished. Canon customer support agreed that this is possible but warned against an over heat issue while using this camera for streaming this way for longer than 20 minutes. They explained the over heat is in the focusing hardware.

Thank you. In fact I solved using the usb port. I'm using it since august and didn't have any heat issue, for now!

Download Sparkocam and your problem will go away. I am using a T3i and a T6i for the same live steam. Your other option is remove autofocus from the lens and switch it to manual

Canon developed a driver to use with most EOS cameras. Works like charm.
This is available at Canon USA. It is called WebCam Utility.


text:
How can i crop a frame sequence with ffmpeg?
I want to crop a video frame sequence by frame number. For example for 10000 frames  sequence, i want to crop it 750 frame from beginning.

Hi @Gyan - if you post an answer, ideally with an example of syntax as well as the link, we can upvote it. Comments are generally temporary so your comment here will go eventually.

FFmpeg's image sequence demuxer has a start_number option, so if you want to skip img_0749.jpg and start from img_0750.jpg, you would start your command as follows,
ffmpeg -start_number 750 -i img_%04d.jpg ...

See the docs for the image2 demuxer at http://ffmpeg.org/ffmpeg-formats.html#image2-1


text:
Frame capture from videos: I-frame vs P-frames
I'm trying to capture various frames within a x264-encoded video files into png files (in python), and then compare the quality of them:
cap = cv2.VideoCapture(filename);
//get frame_number for saving, and save the frame
cap.set(cv2.CAP_PROP_POS_FRAMES,frame_no);
ret, frame = cap.read()

cv2.imwrite(dir_path+'uniform_frame_'+str(frame_no)+".png", frame);

Now I was wondering if I fetch an I-Frame, does it mean that it has a higher quality than other frames, e.g. P-frames and B-Frames? (inherently, keyframes are not compressed, so they must have higher quality and less noise).

Please don't crosspost Qs.

"I, B and P" don't refer to the viewed frames, they refer to the encoded, stored forms of the frames. However the frame is encoded in the file or stream, when it appears on the screen or is extracted as a still it is a complete frame, reconstructed from the IBP information as needed.

Intra frames (I-frames, keyframes) are independent of other frames - they contain the complete information for reconstructing the frame's image. There is no need for reading other frames and computing from them.
So it's about a speed, not about a quality. On the other hand, more intra frames, grater size of the file. (Known tradeoff speed for space.)
Intra frames are preferably used in most media players for so called fast seek (fast because of skipping the necessity of reading other frames and computing from them) - see for example
View -> Options -> Tweaks -> Fast seek (on keyframe)

in Media Player Classic (from K-Lite Codec Pack):

Adding more intra frames is important for relatively slow devices (e. g. smartphones) because after jump to non-intra frame they played back ugly colored and broken video while they meet the next intra frame - so for common density of 1 intra frame for 250 frames and the 25 fps the user may wait almost 10 second for restoring the image.

Good piece of info. Thanks.

I-frames are uncompressed frames and are what p and b frames reference to for compression. Yes I frames are higher quality.

I-frames aren't uncompressed - they simply rely on intra prediction.

Sorry, tried to answer that with out getting too technical. Yes I-frames are compressed to a degree, but to answer your question Tina they are higher is quality when compared to P and B frames.


text:
Image blocks anything that's underneath it to be shown
Normally, when putting a video clip over another in Davinci Resolve, the latter can be seen where the former ends if you move it out of the way. However, this doesn't seem to be the case when working with images. In the screenshot below, I have a png file on top of a mp4 file. I've shifted the position of the image and the black boarder represents part of the frame which the image no longer cover. However, the video underneath it still doesn't show up, which would be the case if I used two videos. What's going on here?

I've had Resolve behave unpredictably when using PNGs as watermarks.  Does the same thing happen if you turn it into a JPG with the same resolution as your project?

When using JPG as you suggested, everything worked as expected. I'm going to assume this is a bug.

Pretty sure it is.


text:
How to fix video shot vertically on a smartphone?
I recently committed the crime of shooting video vertically, and now when played anywhere except on my phone the video renders sideways. What is the best method to rotate it (using PC software), without losing any pixels?

Vertical video is not a crime! If you're shooting content that will ultimately be viewed on a smartphone, why punish yourself and your viewers by shooting in landscape and forcing them to either turn the phone around (which often involves some fiddling around with settings) or watch the video super small.

@stib Because no streaming platform treats vertically shot video like that. If you want to push new standards, fine, but don't neglect the fact that there'll be a long period before acceptance where it's certainly not better for users.

@stib Even today, very very little content can be guaranteed to be only seen on a mobile device. Casual users may view content on mobile phones, but that isn't an excuse to punish users who still use a dedicated desktop/laptop. Best practice should be to cater to the desktop experience first by shooting video horizontally as has always been the case - a mobile user can pretty easily  rotate a horizontal video being watched on social media, for example (swiping down + pressing a button to change orientation is hardly effort) but the inverse isn't true of a desktop user watching vertical video.

@digvisionmedia yeah, it's just obscure websites like youtube.com https://mashable.com/article/youtube-vertical-video-ads/#iFEA4ViOPaqD

VLC Media player, which is free, allows under it's Tools -> Effects and Filters a Geometry Tab, which you could try for rotation.
Then you could use the Encode/Stream option under File - to try to get a decent output.
However, unless your camera has some sort of ccd/cmos rotation feature, if the video was shot vertically, you shot it using only a fraction of the sensor, discarding the vertical space on the top and bottom to create a letter box version at a lower resolution.
You can up-res it, either simply, or with an expensive plugin, but it's never going to be "full resolution" because the information simply isn't there.

if it's rotated, then it's probably shot 1080 wide and 1920 tall, so if he shoves it into a 1080p video, he'll lose half the quality (technically he'll lose 3/4ths of it) but if it puts it into a 4k video, he'll keep all the quality.

I agree, and as I mentioned I don't know of any camera (phone that is), that has any sort of "rotating camera sensor" built into to maintain full resolution during acquisition. Certainly not impossible for future phones to have built in, but I've yet to see one. Finally, I'd have to only say that even if the sensor is sampled beyond 1920x1080, say 4K, the image even when captured sideways will undoubtably not retain the sharpness of using the sensor in it's native form. RED is a perfect example of this, speaking of say the EPIC, continued..

if you shoot 4K on the 5K sensor, it's less sharp than shooting 5K on the 5K sensor and then scaling down to 4K in post. So capturing 1080 just because there's 1080 "room" worth of pixels doesn't mean the camera will process or debayer the data the same way. I have not even bothered to look into the "whys" as to why this happens, but it does, speaking from experience on my EPIC-X. Shooting 4K at 5:1 Redcode using Arri Master Primes was a quality trade-off, 5K acquisition, simply scaled down to 4K in post, was undoubtedly sharper, even when watching on a smaller monitor.


text:
Which ffmpeg command to use convert pngs to video?
I have pngs starting from temp0000.png and ending at temp7085.png.
After reading the ffmpeg manual I tried the command:

ffmpeg -i temp%d.png -i a.mp3 -framerate 60  -start_number 0000 output.webm

But get the error:

Could find no file with path 'temp%d.png' and index in the range 0-4
temp%d.png: No such file or directory

What must I change please?

temp%d expands to temp0, temp1 ... temp10 ... and so on.
For temp0000, you need temp%04d
and the full command should be
ffmpeg -framerate 60 -i temp%4d.png -i a.mp3 -pix_fmt yuv420p output.webm

Thanks. What does  -pix_fmt yuv420p do please? And ffmpeg ignored my framerate of 60 and used 24 instead, so my video is out of sync with my mp3. What is the right parameter there?

framerate needs to go before -i as shown in my command. yuv420p is the only compatible pixel format for web playback, unlike the pixel format of RGB in the source PNGs.


text:
MJPEG Streaming
in  https://www.cisco.com/c/en/us/td/docs/solutions/Enterprise/Video/pktvideoaag.html
it says:
Another type of video compression is MJPEG … the resulting video stream is larger but the packet sizes are more consistent at 1316 bytes (payload)
is that true?

Probably. Mjpeg has no inter frame compression. Makes data rates more predictable.

@DigiVisionMedia Ok, does that have anything to do with the packet size?

I don't know. I'm just speculating. With a compression scheme like mjpeg, each frame is typically very close in size to the ones just before and after it. A smart stream protocol could use this to its advantage.

See MJPEG wikipedia article. "HTTP [MJPEG] streaming creates packets of a sequence of JPEG images that can be received by clients." Supports my speculation. As for verifying that exact packet size number, I can't find anything. Part of the issue is there's no official standard on MJPEG. It's like the great great grandfather of modern web video, born when the web was still wild.

@DigiVisionMedia I guess.  I think each frame is never going to fit in a Ethernet and IP or RTTY or ATM or X.25 or Ku Band QAM satellite packet anyway.  So whether the frames are similar size doesn't have anything to do with the packets.  You're going to fill a bunch of packets, like thousands upon thousands before you get even a full frame.  Whether you fill that last packet to 1299 or 1305 isn't going to make any difference.

@DigiVisionMedia On a second note, I have seen MJPEG become very variable in Bit rate as well,  it all depends on the complexity of the content.  If you have like a Banner screen like "WORLD TV" and it is all white screen and big black letters, the JPEG quantizer smashes each frames down to like 98 or 200 k.  SO having no intra-frame temporal compress doesn't matter because when you get a frame after the "WORLD TV" frames that is like 400 differnet colors, sixty seventy different silhouetts of animals, people, etc etc you get the idea the bit rate rockets to 1M 2M 3Mbits / sec.

That's true for all compressions. If the video is very active, it takes more data. But meaningful videos are rarely jumping from static 2 bit colors to 16 bit nature scenes with high movement. At least, not more than a few times here and there. Like I said, I was speculating. I understand mjpeg pretty well. I don't understand networking at all. I could be completely off.

@DigiVisionMedia Well, just keep the basics in mind data transmission over a network always occurs in little chunks, like REAL little, like 1316 BYTES.  So even a 320x288 8bit color will be a lot of packets.  This assertion in the CICSO doc seems like someone just mailed it in because there's nothing I can come up with that makes any sense of that.

@DigiVisionMedia I think maybe if you look at like a LEASED LINE or a SAT TRANSPONDER you know you have a certain link speed and if you don't use it at that speed, well you get charged anyway, so if you end up compressing your H264 video down to 800KB/S it's just stupid because you pay for 10MB/S. So you know MJPEG will get it down to 8MB/s and be basically higher than h264. I'm still not sure about your assertion that the data rate is more predictable.

Although MJPEG may have a more stable and higher temporally local average bitrate, it's bitrate can vary widely given the input content.  See MJPEG Compression
; the assertion that the resulting network frames/packets will be more consistent is totally unsubstantiated.  It may be, at a macro level, given, say a 10Mb/s Ku Band spotbeam satellite transponder, MJPEG may actually simulate a HARD MUXRATE function that the MPEG Transport Stream muxer typically would perform, but even this is questionable, given MJPEG's highly variable bitrate given very simple content.
Hard Muxrate: https://stackoverflow.com/questions/44392689/ffmpeg-vbr-cbr-conversion-and-streaming-of-mpeg-2-ts-video-files


text:
Lossless Capture with FFmpeg
I’ve been attempting to do lossless game capture as I’ve been working on a program to do frame rate analysis. I haven’t had much luck finding a program that does lossless capture as AmaRecTV, Dxtory, and Virtualdub all seem to be abandoned.  I’m trying to use FFmpeg and have come up with the following command:
ffmpeg -y -f dshow -rtbufsize 500M -i video="Game Capture 4K60 Pro Video 01" -framerate 60 -vsync 0 -c:v libx264 -preset ultrafast -crf 0 -pix_fmt yuv420p "e:\Captures\out.mkv"
Unfortunately, the file size doesn’t seem large enough to be lossless.  For example, according to MediaInfo, I got an overall bit rate of 132 Mb/s (16.5 MB/s) for a 720p 60 fps capture.  However, I’m pretty sure that a lossless 720p, 60 fps, 4:2:0 file should be closer to 640 Mb/s (80MB/s).
I’m using Windows 10 1809 x64, a nightly build of FFmpeg x64 that is newer than 4.0.2, Nvidia 399.24, and an Elgato 4K60 Pro.
Does this command produce lossless capture?  And how can I improve it?

libx264 is a very efficient encoder, so that bitrate isn't unusual. In fact, it's on the higher side, but since you're capturing a game, I expect there is constant motion involved, and your preset is ultrafast which disables some of the aggressive compression.
When you say 80MB/s, I believe you're thinking of uncompressed full raster i.e. 1280 x 720 x 12 bits/pixel x 60 fps. Lossless does not mean uncompressed, just like there can be a compressed ZIP of a binary program.

BTW, the -framerate 60 goes before -i video="Game Capture 4K60 Pro Video 01" as it's an input option.

Whilst the x264 codec is quite efficient, if you want to make sure x264 does not do as much compression whilst there is lots of motion, you could use use quantization parameter -qp 0. There is a lot of information at the following links:

https://stackoverflow.com/questions/40668616/whats-the-difference-with-crf-and-qp-in-ffmpeg
http://slhck.info/articles/crf

A key part of the article is this:

If you had only simple ways at hand to compare the quality of video
sequences (e.g., based on a per-frame measurement of signal to noise
ratio, PSNR), you may look at a CRF encoding and say it was lower
quality than the CQP variant. But if you’re a human being,
subjectively, the CRF copy will look equal or better to the CQP
version

However, a user on the stackoverflow link above seems to think the -qp 0 was better for their game screenrecordings. This could potentially be a better fit if you're doing frame rate analysis (ie. the compression might be imperceptible to you, but not by your frame rate analyzer).
This will result in higher file sizes you expect.


text:
Original video sharper than editted (PP CS6)
I've notests this for a while now, but it seems Premiere Pro CS6 is making the edited video more soft / less sharp. I'm using a GoPro Hero4 / Session2 in 1080p/60fps and it seems the only way I can get the production video to be as sharp as the original is by encoding it in 4k. If I encode it on 1080p/60fps (same as input) the image gets washed out no matter what encodig settings I use.
I've used FFmpeg for other encoding jobs, and that generates much more sharp video's than PP CS6 does in much smaller formats. So it can't be the encoding.
Could this be some wrong setting? Maybe this is a known "feature" of Premiere? It doesn't matter if I encode the video at 10mbps or 100mbps, the output is just washed out. It's not much, but its enough to get on my nerves.

You are using a version of Premier that is now 5 releases (6 years) behind and you're not comparing apples to apples if you use a recent copy of FFmpeg to CS6.  You are highly unlikely to get any support from anybody here because nobody is using CS6 anymore.

CS6 is still widely used as it was the last release that did not fall under the new Adobe Licensing Model. Copies of the Production Premium Bundle of CS6 still fetch $1500+ because of this.

First, when you create the sequence that you cut on, either use the Match Sequence Settings when dragging one of your clips to a new sequence/timeline, or right click the source file and click Create Sequence from Clip.   Your video shouldn't be softer, especially at 100mbps. What codec are you using for output?

Martin A, I do setup the video in the same format when I drag the first video. Also all video's are the same format so the settings keep being right. I'm using H.264 as output (profile baseline 5.1, NTSC Square Pixels (1.0), VBR 2 pass)

Have you retried a 2 pass VBR and ticked 'render at maximum depth'option?

I tried a subscription for Premiere CC, and it seems to be much better. So TravisO was right, CS6 is just too old.


text:
How do you batch merge many clips in a premiere pro timeline?
I'm sure there are other use cases for this as well, but the major one that I can think of is creating a bin out of the synced sequence pluraleyes creates.
When pluraleyes syncs your footage with audio, it will create a sequence that looks like this:

To get these clips into a bin, one method, (documented here) is for each clip in the timeline, you have to shift click on the footage + the layers of audio underneath. Select merge clips and then it'll create a merged clip in your project.
This can go from tedious to impractical, depending on how many clips you have. Is there a way to speed up this process?

There are at least two ways I have found to do this so far.

Out of the box method
The easiest possible way to speed this process up is to set a few keyboard shortcuts and close the project window.

Open the keyboard shortcut manager. Edit > Keyboard Shortcuts
Search for merge and set Merge Clips to a shortcut. I picked Ctrl+Shift+Y

Search for select next clip and set Select Next Clip to a shortcut. I picked Ctrl+Down

Close the project folder pane. This will make things 10X faster. Without doing this every time you merge a clip, focus will be given to the project pane. If you don't do this, the process will be. ctrl+shift+Y > enter > ctrl+down > click back to timeline. If you do this you never have to leave the keyboard you can just do ctrl+shift+Y > enter > ctrl+down > ctrl+shift+Y until the end of your timeline.

If you do all of that, and close the project pane, the process would look something like this:
https://i.imgur.com/7Yyy1T4.gifv

Super hacky, but I guess it works, method
While the above does work fine, and will probably speed up doing this with a mouse by a factor of ten. If you have a timeline with hundreds of clips, this is going to get really tedious.
So, all we need to automate this, is something to do these keyboard shortcuts for us while we go and... do something else

If you can't find a rocking bird. The next best thing is going to be autohotkey. I don't know what the MacOS equivalent of this is, but at least on windows the process would look something like this.

Estimate how many clips are in your timeline 100ish, 200ish?
Download and install AutoHotkey
Download this Autohotkey script

    ^j::
    Loop, x ; Set x to estimate of clips in timeline, 100, 200, etc.
    {
    Send, ^+y ; Merge clips shortcut
    Sleep, 100 ; Wait for dialogue
    Send, {Enter} ; Press enter
    Sleep, 100 ; Wait for merge
    Send, ^{Down} ; Select next clip shortcut
    Sleep, 100 ; Wait for next clip
    }
    return

Right click on mergeclips.ahk on your desktop > select edit script
Set x to the number of clips you want to merge. Save the file.
Double click on the script on your desktop. This will listen in the background for your keyboard shortcut press.
Go to premiere, make sure your project pane is closed
Make sure your premiere keyboard shortcuts are set to the ones I listed above.
Select the first clip on the timeline you want to merge.
Press ctrl+j to start the script :)

Demo: https://i.imgur.com/N4hD09d.gifv


text:
By how much can video and audio be out of sync?
If I have an interview or lecture style video and the audio is out of sync, by how much can it be out of sync before the average person would easily notice?
I'm currently trying to create an HTML5 player that sometimes has the video and audio in separate elements, meaning the video and the audio buffer and play at separate times. I've developed a decent code that keeps them synced (it's a harder problem then it should be). The current code pauses the video and the audio elements if they are off by 0.1 seconds, adjusts the time of the video element to the audio element, waits for oncanplay event, then plays both. My question is whether 0.1 seconds off in audio/video sync is too much. Would a common user notice a 0.1 seconds sync disparity? What's the highest I can go before the common user might notice the lips don't quite match the voice? Does any large organization have an official standard on this?

There are, in fact, several standards on audio/video or lip sync. The problem is, they can't all agree on what the acceptable error is. What is well understood is that if the audio lags the video it is less noticeable, because that is natural. Something that is further away will be seen before it is heard. In the list below, a negative number is the audio lagging the video and positive is the audio leading the video.

ATSC IS-191: -45ms to 15ms
EBU R37-2007: -60ms to 40ms
ITU BT.1359-1: -125ms to 45ms
ITU BR.265-9: -22ms to 22ms

ITU BT.1359 was based off studies done with average viewers, but relied on significantly older technology. The ATSC and EBU recommendations rely on expert opinions. The methodologies don't give you a hint at which one is right. I've worked at facilities that used -2 frames to 1 frame (roughly -33ms to 16ms at 60fps) as an easy to remember guideline with very few viewer complaints about lip sync.
Even with the disagreement, 0.1s (100ms) of error will almost always be noticeable, unfortunately.

Great, this helps a lot. I think I'll update my margin to -100 ms to 45 ms, per the ITU BT.1359. This conveniently also answers if positive is more noticeable than negative. I'm tentatively giving you the selection, but might change it if a better comes along. Not that your answer isn't good. You've earned the selection. It's just that I don't usually like to give it so early.

given that at 25fps each picture is displayed for 40ms there's a +/- 20ms margin for sync even for sound recorded with the picture. Say the shutter opens at the start of the frame, while audio of course records continuously. At the beginning of the frame the picture will be in sync with audio, and at the end the picture is 40ms behind. So one wonders how you can possibly be 15ms out of sync.

Keep in mind, the ATSC is US-based organization and the recommended practice was developed for a system that is predominantly 30/60 fps. At those frame rates, one field/frame is roughly 16ms. It basically says that if the audio leads the video by even one frame, it is noticeable and that is consistent with what I've run into. The European (EBU) standard matches what you said about a 25 fps world.

The SMPTE handout appears to have been removed from their site - archive.org has a copy at https://web.archive.org/web/20150328054944/https://www.smpte.org/sites/default/files/2013-12-10-Lip-Sync-Briscoe-V2-Handout.pdf

@PeterBarton I edited the link, thanks for finding the archive. SMPTE recently went through a branding refresh, so I guess that swept away a bunch of older stuff.


text:
FFmpeg mosaic with hardware acceleration on Quadro P4000
I'm currently trying to achieve a mosaic including 4 videos using FFmpeg and hardware acceleration.
I'm working on Ubuntu 16.04, I've installed NVIDIA drivers using apt repo aswell as CUDA. I'm using FFmpeg in version 3.3.
I've succeeded to create it without hardware acceleration but I'm stuck. Here is the command line I use :
ffmpeg -hwaccel cuvid -c:v h264_cuvid \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-filter_complex "nullsrc=size=1440x960 [base]; \
[0:v] hwdownload, format=nv12, scale_npp=720x480 [upperleft]; \
[1:v] hwdownload, format=nv12, scale_npp=720x480 [upperright]; \
[2:v] hwdownload, format=nv12, scale_npp=720x480 [lowerleft]; \
[3:v] hwdownload, format=nv12, scale_npp=720x480 [lowerright]; \
[base][upperleft] overlay=shortest=1 [tmp1]; \
[tmp1][upperright] overlay=shortest=1:x=720 [tmp2]; \
[tmp2][lowerleft] overlay=shortest=1:y=480 [tmp3]; \
[tmp3][lowerright] overlay=shortest=1:x=720:y=480; \
hwupload_cuda" \
-c:v h264_nvenc -f matroska pipe:1 | ffplay -i -

It doesn't work and I get :
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_hwupload_cuda_17

I think the issue is about the upload of modified frames by filters into the card but I can't figure how to achieve it. I've tried to add [base] before hwupload_cuda but it doesn't help, and honestly, I'm a bit lost.

Do you mean to decode the same video four times?

I work with the same video 4 times for test purpose, but the goal is to decode 4 differents video and display it in a mosaic.

Ok. You'll need -hwaccel cuvid -c:v h264_cuvid before each -i and and a comma instead of a semi-colon after the last overlay.

I got an error Impossible to convert between the formats supported by the filter 'Parsed_format_2' and the filter 'auto_scaler_0' and Failed to inject frame into filter network: Function not implemented. I may have to specify a hardware compliant format ?

You're scaling on the GPU so you need hwdownload and the format after scale_npp.

Regarding,
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_hwupload_cuda_17

in
[tmp3][lowerright] overlay=shortest=1:x=720:y=480;hwupload_cuda

you have to replace the ; with a , else the overlay filterchain is terminated and the hwupload starts a new chain.
Input options like -hwaccel cuvid -c:v h264_cuvid only apply to the input immediately following them. These options have to be prefixed before each input for which they're intended.
scale_npp is a CUDA scaler, so for a hardware-decoded stream, no filter is required to transfer frames. After scaling, frames will have to be transported to system memory using hwdownload,format=nv12.


text:
ffmpeg merge 3 videos to a single widescreen video
I have three .mp4  files and I want to generate a single widescreen video
For generating the widescreen I've worked out I can use this command assuming I've prepared the individual mp4 files:
ffmpeg -i teacher.mp4 -i student1.mp4 -i student2.mp4 -filter_complex "[0:v:0][1:v:0][2:v:0]hstack=inputs=3" -c:v libx264 -tune film -crf 16 -b:a 256k triple.mp4

Main Question:
1.triple.mp4 only has one audio,But I do need three audio tracks
2.three video playtogether in triple.mp4,can I controll the start time that   I set before?


text:
FFmpeg concat problem
I just want to add black video at the beginning of the video
I have found following commands.
ffmpeg -i s1.mp4 -f lavfi -i color=c=black -t 10 -filter_complex "[1:v][0:v]scale2ref=1*iw/1/sar:ih/1[wm][base];[base][wm]concat=2" output.mp4

MainQuestion:

How can I solve this issue?

concat requires videos to have the same sample aspect ratio as well as the same resolution.
So, in this case,
ffmpeg -i s1.mp4 -f lavfi -i color=c=black -t 10 -filter_complex "[1:v][0:v]scale2ref[wm][base];[wm]setsar=1[wm];[base][wm]concat=2" output.mp4

or
ffmpeg -i s1.mp4 -f lavfi -i color=c=black -t 10 -filter_complex "[1:v][0:v]scale2ref[wm][base];[base][wm]concat=2:unsafe=1" output.mp4

I carried out above command, and the terminal was stuck。 @Gyan

Run command with -report added and share report. Kill ffmpeg after a minute if it doesn't exit.

I found a error:
[Parsed_concat_1 @ 0x7f9d74e086c0] Input link in1:v0 parameters (size 212x160, SAR 160:159) do not match the corresponding output link in0:v0 parameters (212x160, SAR 1:1)

Use the 2nd command.


text:
What is the difference between audio Sampling rate and Frame rate?
I have a video file with audio. ffprobe reports two different numbers: Sampling rate and Frame rate. I understand the 48kHz rate--there are 48,000 audio samples every second. What is the other number, and what is a "frame" in this context?
 Audio
 ID                                       : 2
 Format                                   : AAC
 ...
 Sampling rate                            : 48.0 kHz
 Frame rate                               : 46.875 FPS (1024 SPF)

Audio samples are encapsulated into frames as well. For PCM, the framing is notional, but for DCT-based codecs, it's a basic requirement.
AAC typically bundles 1024 samples per frame, so 1 second of 48000 samples represents 48000/1024 = 46.875 FPS


text:
Long video ffmpeg transcode makes audio go out of sync
I have recorded a 50 minute video, edited it in Hitfilm Express to censor/blur people, and exported it in Hitfilm's high resolution format, generating an 80GB file. When I try to transcode this file into something more manageable, ffmpeg makes the audio drift. In the beginning everything sounds fine, but slowly the audio goes faster than the video. The input file as reported by ffmpeg is:
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/BakaTres/witness.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
  Duration: 00:50:31.42, start: 0.000000, bitrate: 230875 kb/s
    Stream #0:0(eng): Video: cfhd (CFHD / 0x44484643), yuv422p10le, 1920x1080, 229401 kb/s, 59.96 fps, 59.96 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      encoder         : CineForm HD
    Stream #0:1(eng): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default)

After running the following transcode command ffmpeg  -i witness.mov  -filter:v scale=640:-1 mini.mkv which reencodes everything, this is the stats of the output file:
Input #0, matroska,webm, from 'mini.mkv':
  Metadata:
    COMPATIBLE_BRANDS: qt
    MAJOR_BRAND     : qt
    MINOR_VERSION   : 537199360
    ENCODER         : Lavf57.56.100
  Duration: 00:50:30.42, start: 0.000000, bitrate: 785 kb/s
    Stream #0:0(eng): Video: h264 (High 4:2:2), yuv422p(progressive), 640x360, 59.96 fps, 59.96 tbr, 1k tbn, 119.92 tbc (default)
    Metadata:
      ENCODER         : Lavc57.64.101 libx264
      DURATION        : 00:50:30.422000000
    Stream #0:1(eng): Audio: vorbis, 48000 Hz, stereo, fltp (default)
    Metadata:
      ENCODER         : Lavc57.64.101 libvorbis
      DURATION        : 00:50:28.403000000

The first sign that something goes wrong is that the original file specifies a duration of 50:31.42, while the transcode generates a 50:30.42 file. I wouldn't mind the second less if it weren't because the produced audio is 50:28.4, two seconds less than the video, which explains the delay difference. Unfortunately ffmpeg doesn't show the input length, but if I copy the source audio to an aiff file, Audacity tells me it's indeed 50:28.4 long, so is Hitfilm exporting the audio incorrectly with a shorter length than video?
I've seen the following answer for a similar problem but I don't understand how the values are calculated or how to apply these values to my input files. What values should I look for in the information of input/output to compare?
Even if the final transcoded length is slightly different, how can I prevent the audio from going out of sync (or fix Hitfilm's exported difference in video vs audio)?

Add -af aresample=async=1 and check.

@Gyan no difference compared to not using that switch.

After trying a few random things, I managed to make the audio/video sync by changing the rate of the audio:
ffmpeg  -i witness.mov -af asetrate=48018 resampled.mkv

The resampled.mkv has correct sync, but unfortunately the audio is shorter than the remaining video for a few seconds. Which means the problem is really that the frame rate is slightly slower than it should in the input file. According to my calculations, the problem is that the frame rate is set to 59.96, and setting it to exactly 60.0 would make the video match the audio. I tried using:
ffmpeg  -i witness.mov -framerate 60 resampled.mkv

But the video frame rate did not change.

I have webm -> mp4 1h duration, both methods don't work.


text:
How to zoom and pan a video fluidly
I have a video that I would like to zoom in/out and pan to keep my subjects centered. I tried to do this by splitting the video and cropping the individual segments, however that will be too choppy. I know there has to be a feature to move the frame of zoom live, while playing the video so it is smooth and the zooms are fluid. New to this so any suggestions for software would be much appreciated.

Keyframes
Most video editors have some kind of keyframes feature. By using keyframes, you can change the values of the position and scale of the video for a single frame and have different values for another frame. The video editor will then calculate what the values should be for all the frames between these two keyframes so that these change gradually over time. This way you can make subtle and continuous changes to the framing of your video and you could use this to make your subject stay in the center of the frame without it being too distracting.
Tracking
In the case that manually setting all the values is too much work, professional video editing software often have some kind of tracking tool which can track the subject for you. You can then let the position of the video follow the path of the subject. But for just keeping the subject in the center, tracking would most likely be too much of a hassle.
So what kind of software could do this?
This would be possible to do in most modern professional video editors. But for example, you could do this in Premiere Pro. Make sure to check the documentation and help forums of the software for the specifics on how to do this and I also suggest looking up a tutorial. Also bare in mind that cropping part of the video will result in a loss of quality since there will be less pixels to be displayed, no matter what software you use.


text:
Concat two MP4 files (side by side) with FFmpeg
I'm trying to concat two videos, side by side, using ffmpeg. One of them is 1280x720, and the other 1920x1080. One will be left, one will be right side. The higher resolution will be resized to the lower resolution one.
What is the command to do that?
I tried this command (they used 4 videos, I tried to edit it for 2), but somewhere is wrong and it cuts the first video:
ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=720" -c:v libx264 output.mp4

https://unix.stackexchange.com/questions/233832/merge-two-video-clips-into-one-placing-them-next-to-each-other/521878#521878

Use
ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=x=720" -c:v libx264 output.mp4

The shortest should be applied only to the first overlay.
Also, you can skip scale for the video which is already 1280x720. This output will only audio from one of the inputs.

Your command gives me the same output as before! Did you forget to change anything?!

Command corrected.

No still not working. I guess x=1280 for shortest which works now.

Heh. I did not check your co-ordinates.


text:
ffmpeg combine three videos side by side
I have three videos s1.mp4,s2.mp4 s3.mp4 and I need to combine three videos side by side I know use hstack but my three videos has different size?
I've found  following commands.It works,but only support two videos.
ffmpeg -i s1.mp4 -i s2.mp4 -filter_complex "[1:v][0:v]scale2ref[wm][base];[base][wm]hstack=2" final.mp4

Use
ffmpeg -i s1.mp4 -i s2.mp4 -i s3.mp4 -filter_complex "[1:v][0:v]scale2ref=oh*mdar:ih[1v][0v];[2:v][0v]scale2ref=oh*mdar:ih[2v][0v];[0v][1v][2v]hstack=3,scale='2*trunc(iw/2)':'2*trunc(ih/2)'" final.mp4

I tried with this code,strill without any luck
[libx264 @ 0x7f9334838e00] width not divisible by 2 (637x160) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height @Gyan

Added filter at end

Can you tell me How to use "VSTACK" in this case? @Gyan


text:
How to decode the PTS timestamps and extract the video frames
I want to extract the video frames and get the PTS timestamp for each one of them. I have an input MPEG-2 TS file and I prefer to use some open source tool like ffmpeg or something similar. The problem is that when I am using -vf showinfo option it shows me a restamped PTS. This is the command I am using:
ffmpeg -hide_banner -i input.ts -vf showinfo -vsync 0 -start_number 0 fr%05d.jpg &> log.txt

So here my result is something similar to:
[Parsed_showinfo_0 @ 0x5629810a2000] n: 435 pts:1593000 pts_time:17.7    pos: 55729780 fmt:yuv420p sar:1/1 s:1920x1080 i:T iskey:0 type:B checksum:27AB3255 plane_checksum:[B27F2CE8 F1689963 59E56BFB] mean:[142 127 129] stdev:[36.5 2.8 4.1]
[Parsed_showinfo_0 @ 0x5629810a2000] n: 436 pts:1596600 pts_time:17.74   pos: 55690112 fmt:yuv420p sar:1/1 s:1920x1080 i:T iskey:0 type:B checksum:94AD9CBE plane_checksum:[FB0C9721 C477122C 2AA6F362] mean:[142 127 129] stdev:[36.5 2.8 4.1]

While when I execute the ffprobe command:
$ ffprobe -i input.ts -show_frames -select_streams v:0 -print_format flat | grep pkt_pts=

frames.frame.435.pkt_pts=4205067450
frames.frame.436.pkt_pts=4205071050

And I need to find out the pkt_pts timestamp on the extracted files possibly with only one command. On top of that, I was checking the SCTE-35 and there I had an offset with 150 frames between the insert intervals. For example according to the PKT_PTS the start and stop frames are 1650 and 2550 which are signaled over SCTE-35 but the actual frames are 1500 2400 when I look only on the extracted frames.

FFmpeg will, by default, remove the starting offset. To preserve it, add -copyts.
The description of -vsync 0 isn't accurate and was written 8+ years ago: Each frame is passed with its timestamp from the demuxer to the muxer.. Video sync takes effect only once the frame has exited the decoder(+filtergraph) pipeline. But you should keep it to avoid dropping/duplicating frames.

yes, this works great, thanks for the hint! I just didn't understand whether I should use -vsync 0 or not in my command line.


text:
Add multiple mp3 files to an mp4 file with ffmpeg
I would like to add multiple mp3 files to an mp4 file.
For adding a single mp3 to an mp4, I used this command with success:
"-i /path/to/mp4File -i /path/to/soundmp3File -codec copy -shortest path/to/output/fileWithSound"

But I'm stuck with adding another mp3. I tried this, but it didn't work:
"-i /path/to/mp4File -i /path/to/soundmp3File1 -i path/to/soundmp3File2 -codec copy -shortest path/to/output/fileWithSounds"

How can I make it work with multiple audio files?

Use
-i /path/to/mp4File
-i /path/to/soundmp3File1
-i path/to/soundmp3File2
-map 0 -map 1:a -map 2:a
-codec copy -shortest path/to/output/fileWithSounds

FFmpeg will automatically select one video and one audio stream from among all the inputs. -map options are required to include all streams.

For some reason only one audio stream ends up in my output file. Multiple streams only work if I amerge, but that's slow. I use the command you pasted. Unfortunately I accepted before trying.

Share full log.

I think I may have misunderstood multiple things about mp4. So if I add multiple audiotracks, will a player actually play all the tracks included? So I think the reason I only hear one audio in the output is that the player picks one. Does it make sense?

Yes, that's expected. You'll need amix filter if you want to hear all sounds at once - this will produce one track with all tracks mixed. A video player will only play one track at a time.


text:
Noise (from autofocus?) during Video on DSLR
I have a Canon 6D Mark II and am shooting video with a Canon EW-83H lens. The videos come out great but are plagued by audible creaking and clicking sounds during playback. My guess is that this noise is due to autofocus of the lens. I tried two other lenses (one prime and one telephoto) but both basically have the same issue. The camera is brand new but the lenses are not (but in good condition).
Is this an issue with my set up in particular or is the always an issue with shooting a video with a DSLR and a lens with autofocus + IS? What's the recommended solution?

The noise you talk about is usually caused by lens motors related to autofocus and motors, related to image stabilization. The best you can do is to use external microphone and connect it to microphone port of the camera. This will give you better isolation of the recorded sound from camera noises and better sound quality.
Of course you can always use external sound recorder and sync video and sound in post.
EDIT: to avoid the noise from focus motors you can use manual focus. To avoid noise from stabilization motors (if any) you can switch off image stabilization (VR, OS, IS or whatever it is named) and use rig with stabilization or tripod.

Thanks, Romeo. Do you think an external mic that's mounted on top of the camera will solve this issue? Also, is this a typical problem for most people with my general setup?

@Kulluk007, it depends if the microphone will be unidirectional or omnidirectional. In general the first type will be less sensitive to the sound/noise which is not on the direction where mic point. If it's typical: I think yes and that's the reason of extensive usage of external mics or recorders.


text:
Use ffmpeg to extract 15 frames at specific intervals
I'm new to using ffmpeg, but I want to extract 15 consecutive frames (resized to 320x240) at specific time intervals from an existing video.
What I have so far is this:
ffmpeg -ss 30 -i inVideo.mp4 -vframes 15 out%d.png -s 320x240

While this does create 15 frames at the 30 second mark, they are not resized.
Also, if I have this in a loop, the output images will be overwritten.
I want to create a total of 9 time intervals with 15 frames/images each.
Any idea of how I can accomplish that?
Thanks for all your help!

The basic template is
ffmpeg -i inVideo.mp4
  -vf "select='between(t,30,30.5)+between(t,45,45.5)+between(t,73,73.5)'"
  -s 320x240 -vsync 0 out%d.png

The select filter expression selects all frames in each of the three ranges. I've chosen an endpoint 0.5 seconds greater than the start point under the assumption that the video is 30 frames per second. Adjust accordingly.
Frame sizing is an output option so it has to appear before the output it is meant for.


text:
How to take multiple inputs with specific trim times to one output, single command ffmpeg
I'm trying to make a single ffmpeg command that will take multiple inputs, seek specific times within them, then output to a single file.
For example, I have inputA.avi and inputB.avi and each is 1 hour long. I want a single output file that takes inputA.avi from 00:00:00 to 00:20:00 for the beginning and inputB.avi from 00:00:00 to 00:10:00 for the end. The end result should be a 30 minute video file that has the first 20 minutes of inputA then the first 10 minutes of inputB.
I currently can do the following three commands to get the job done:
ffmpeg -ss 00:00:00 -t 00:20:00 -i inputA.avi [rest of command] inputA-trim.avi
ffmpeg -ss 00:00:00 -t 00:10:00 -i inputB.avi [rest of command] inputB-trim.avi
ffmpeg -f concat -i inputList.txt [rest of command] final.mp4

where inputList.txt contains only
file inputA-trim.avi
file inputB-trim.avi

This works, but has unnecessary steps and creates intermediary files. I also have to create a batch file and txt file to get everything to run in succession. I'd like to be able to create a single ffmpeg command that can take multiple inputs with individual -ss and -t commands, then put them in a single output.

This question seemed to be asking for close to the same thing, but the OP accepted a solution that essentially is what I am doing with the three commands in my question.

#1 Using concat filter i.e. without textfile
ffmpeg -ss 0 -t 20:00 -i inputA.avi -ss 0 -t 10:00 -i inputB.avi -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1" out.mp4

--OR--
#2 Using concat demuxer i.e. with textfile
file inputA-trim.avi
inpoint 0
outpoint 20:00
file inputB-trim.avi
inpoint 0
outpoint 10:00

and then your final command
ffmpeg -f concat -i inputList.txt [rest of command] final.mp4

See https://trac.ffmpeg.org/wiki/Concatenate for details.

I have tested the second option listed, with the input txt file. I had to add -safe 0 to avoid an "unsafe filename" error. The final command I used was ffmpeg -f concat -safe 0 -i inputList.txt -vf "scale=1280:720,setsar=1" -crf 30 -an -movflags +faststart final.mp4. I'll test the first option some other time. Thanks.

I guess I had to use -safe 0 because I had absolute full paths in my input txt file.

I've been using the first option for some time now. Just noticed I mentioned I would test it, but never reported back.

Does the concat filter re-encode?

The concat filter will require a re-encode. All frame filters will lead to a re-encode.


text:
ffmpeg "Stream specifier matches no streams", but it exists
In ffmpeg, I have the following filter_complex:
color=c=Chartreuse:s=1920x1080:d=8640.059,setpts=PTS-STARTPTS[t];
[1:v] trim=start=114.149:end=124.149,setpts=PTS-STARTPTS [v0];
[t][v0]overlay=0:0:enable='between(t,0,10)' [o0];
[2:v] trim=start=118.112:end=135.112,setpts=PTS-STARTPTS [v1];
[o0][v1]overlay=0:0:enable='between(t,10,27)' [o1];
[o0][o1]concat=n=2:v=1:a=0 [vout]

But when I run the command with 3 inputs (the first one is an audio file), I get:

Stream specifier 'o0' in filtergraph description
  color=c=Chartreuse:s=1920x1080:d=8640.059,setpts=PTS-STARTPTS[t];
  [1:v] trim=start=114.149:end=124.149,setpts=PTS-STARTPTS [v0];
  [t][v0]overlay=0:0:enable='between(t,0,10)' [o0]; [2:v]
  trim=start=118.112:end=135.112,setpts=PTS-STARTPTS [v1];
  [o0][v1]overlay=0:0:enable='between(t,10,27)' [o1];
  [o0][o1]concat=n=2:v=1:a=0 [vout]  matches no streams.

What am I doing wrong?
Using a git version from ~1 week ago.

For future reference:
as specified, you cannot reuse an intermediate stream more than once so you have 2 options:

either save it, input the saved file and reuse it as many times you need in your filter;

ffmpeg -i file1 -i file2 -i savedStream -filter_complex "..."

use the split filter and create as many outputs you need; default value for split is 2 outputs so:

[o0]split[split1][split2]

would be your case.

It looks like an intermediary stream, as produced by the color filter, cannot be reused more than once, so we have to use the split filter on it:
color=c=Chartreuse:s=1920x1080:d=8640.059,setpts=PTS-STARTPTS[t];
[t] split=2 [s0][s1];
[1:v] trim=start=114.149:end=125.149,setpts=PTS-STARTPTS [v0];
[s0][v0]overlay=0:0:enable='between(t,0,11)' [o0];
[2:v] trim=start=115.629:end=123.629,setpts=PTS-STARTPTS [v1];
[s1][v1]overlay=0:0:enable='between(t,11,19)' [o1];
[o0][o1]concat=n=2:v=1:a=0 [vout]

I couldn't find any explicit documentation on that limitation, altough I'm sure it exists somewhere.

Workaround is to generate it as an input stream alongside other file inputs: -i file -i file -f lavfi -i "color=c=Chartreuse... and then ingest it repeatedly like other files [2:v]...

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


text:
Add timecode information to file
I'm writing a program that interprets LTC timestamps from audio channels in video files. The goal is to remove the LTC track and replace it with some kind of native timestamps directly in the video file--in a way that downstream NLEs can interpret correctly e.g. for multi-camera timelines.
I've got the LTC parsing done, so for each frame of the video, I can tell what its timestamp is. How do I encode that in containers like .MP4 and .MOV? It would be simplest if I could do it with ffmpeg.

What's the framerate?

LTC is fixed at 24 fps; video frame rate can be anything from 23.9 to 60. Curious how this affects the problem.

As a simplification, and making some assumptions about timebases, I'm only using LTC to calculate the timecode for the first video frame. For every other frame in the file, I simply add the frame's offset from the beginning of the file to the first frame's timecode.

MP4s and MOVs store only the TC of the first frame, as a literal frame count, along with the framerate. The consuming app converts that frame count back to a TC string using the framerate. For drop-frame TC, ffmpeg only supports 30 and 60 fps.  I'll add 24/48 when I have time and a SMPTE reference that I can consult. For non-drop TC, any fps is fine. Add -timecode HH:MM:SS:FF to your cmd. Use ; for the final separator if TC is drop frame.

Oh, this is cool! At this stage in the project, this is plenty. If you put this as an answer, I'd like to accept it to close out the original question. But your answer brings up more questions :=)

I gather from your answer that both MP4 and MOV store DF/NDF flag along with the framerate.
I thought DF only existed for 29.98 (and, by extension, for 59.94). I've been using this reference for my LTC code: https://www.itu.int/dms_pubrec/itu-r/rec/br/R-REC-BR.780-2-200504-I!!PDF-E.pdf
I gather from your answer that you are an ffmpeg maintainer. Which parts do you work on?

Which other common containers support -timecode?
Reading up on -timecode in the manual, I see -timestamp parameter. What is the relationship between these? Does -timestamp refer to the first frame, or the last (i.e. when the file finished writing)? If these two parameter write different fields in a file, do NLEs interpret them differently?

@iter, I'd suggest you create new questions for all the ones you asked in comments. You'll get more exposure that way. Comments aren't really meant for asking new questions or extended discussions. If you need to continue the discussion, please move that to chat.

@Gyan gives the answer in comments:

MP4s and MOVs store only the TC of the first frame, as a literal frame count, along with the framerate. The consuming app converts that frame count back to a TC string using the framerate. For drop-frame TC, ffmpeg only supports 30 and 60 fps. I'll add 24/48 when I have time and a SMPTE reference that I can consult. For non-drop TC, any fps is fine. Add -timecode HH:MM:SS:FF to your cmd. Use ; for the final separator if TC is drop frame.


text:
How do I speed up slower video framerates with ffmpeg and get full 240fps and no truncated videos?
I have a whole bunch of sports video clips that range from 6 to 25 seconds each, all recorded at 240fps but slowed down to 23.97, 25, 29.97 and 30fps (so they're in super slow motion).  I need to speed them back up.
I got the following command:
ffmpeg -i input.mov -vf "setpts=(PTS-STARTPTS)/10" -crf 18 output.mov

...from another stackexchange question.
I was able to use this successfully, but I have 3 questions:
1)  How do I preserve all of the frames?  The resulting video is only 30fps, which means the conversion process dropped the vast majority of frames - I'd like it to actually be a full 240fps.
2)  Some of the videos were truncated at the end.  For example, an 11 second video that originally showed an entire tennis forehand swing ends up stopping before the swing is completed.
3)  I read the documentation for probably a good 30 minutes trying to figure out what "-crf 18" does and for the life of me couldn't - would love if someone could explain this!

Use
ffmpeg -i input.mov -vf "setpts=N/240/TB" -r 240 -crf 18 output.mov

The only thing the setpts filter does is retime frames, but the designated frame rate of the stream is still its original framerate, whatever that is (25,30..). Use the fps filter to change that - the fps filter may also drop or duplicate frames, but not in this case. There's a bug in the fps filter which makes it ineffectual for this purpose. Use output -r.
The default encoder for MOV in FFmpeg is libx264. Its default ratecontrol mode is CRF. Lower values retain more of the original quality but produce larger files - 18 to 28 is a decent range. This has no effect on which frames are included in your output.

Thanks so much Gyan!
This works, except the resulting video is the same length as the original video.  You see the 1-second tennis swing, and then 13 more seconds of the last frame frozen.

Does this have audio?

If someone could give just a little more help, I'd be so grateful.  I went through the documentation for a half hour looking for things related to target video length, but I still have no idea how to tell ffmpeg to shorten the video length by the same proportion that it is sped up.
Here is the old video:
link
Here is the new video:
link
This was using this command:
ffmpeg - i inputfile -vf "setpts=(PTS-STARTPTS)/10" -crf 18 outputfile

OMG I just now noticed you asked a question!  No, I purposefully removed audio from the clips because it just isn't needed.  I am hoping that simplifies things even more.
So sorry for my newbieness here... I thought the "Does this have audio?" question was something generated by the StackExchange website asking me if I wanted to verbalize my comment or something.  Sorry, very stupid on my part...

Gyan you are my savior.    I aspire to learn more about ffmpeg, but there appears to be a pretty high learning curve... wasn't possible to get this done any time soon without your help.


text:
Set display time of individual frames in FFmpeg
I have a set of images that I extracted from a GIF animation for the purpose of enhancement (which I have done), but now that it's time to convert the still images into a video (I'm going to use webm for higher quality output) I've run into a problem. The GIF format allows individual frames to be displayed for an artificial amount of time and this specific GIF animation makes use that feature, with most frames being displayed for 125 milliseconds but some remaining on the screen for as long as 3000 milliseconds. So just generating a video with a set frame rate isn't going to work as that would break the flow of the animation; I need a way import the frame duration data from the original GIF file and encode the extracted, modified frames into a video using that data.
Is there a way to do this with FFmpeg or maybe a combination of FFprobe and FFmpeg? I ran the GIF through ffprobe -show_frames and it would seem that the information I need is pkt_duration_time which shows the duration the frame is displayed.

See https://superuser.com/a/1320358/114058

@Gyan Thanks for pointing me in the right direction. I posted an answer to my question below.

It took me quite a while of Googling and trial-and-error but I finally figured out how to actually do this. Thanks to Gyan for pointing me in the right direction.
I tried to do more of the process as one-liners but it always turned into a non-functional, undebuggable mess. If you think you could script this, please do so, test it, and then post it as a new answer.

Print pkt_duration_time line and save it into a file:
ffprobe -show_frames input.gif | grep pkt_duration_time= >frames.txt
Modify the line to the format that FFmpeg's concat filter requires:
sed 's/pkt_duration_time=/duration /g' frametimes.txt >frametimes.txt
Print a list of your input files (frames) located in folder/ and modify the list to be the format FFmpeg's concat filter requires:
ls --quoting-style=shell folder/ >filenames.txt && sed -i -e 's/^/file /' filenames.txt
Combine your frame-time file and filenames file to a concat file that FFmpeg accepts:
paste -d \\n filenames.txt frametimes.txt > folder/concatfile.txt
We saved the concat file to where the input files are located because otherwise FFmpeg won't accept it. One more thing before we can encode the video: the data for the last frame needs to be present in the concat file twice for some reason. I don't have a CLI for that so just copy-paste it manually.
Now we can use FFmpeg to turn the image files to an animated video with correct frame times:
cd folder/
ffmpeg -f concat -safe 0 -i concatfile.txt -pix_fmt yuv420p -c:v libvpx-vp9 -b:v 0 -cpu-used 0 -tile-columns 2 -row-mt 1 -lag-in-frames 25 -threads 16 -crf 35 ../output.webm

The -safe 0 switch is required because otherwise FFmpeg complains about unsafe file names. At least it did in my case, possibly because the file names contained square brackets.
The -pix_fmt yuv420p ensures the correct color space is used. If you omit this, a color space that isn't standard for web video will be used and in the case of VP9 the resulting file will use Profile 1 which doesn't have as wide hardware decoding support as Profile 0. You could use -profile:v 0 to make sure that this doesn't happen without you noticing.

The rest of the parameters are quality and rate control features for libvpx-vp9. Remember to at least use -b:v 0, otherwise CRF won't behave as you'd expect. Also note that setting -tile-columns and -threads manually is required, otherwise encoding is limited to a single thread.