text:
After Effects Trim paths offset corner position based on rectangle width and height
I think it would be easier to share an image to show what I'm trying to accomplish.

This will be a mogrt so the actual rectangle size / aspect ratio is determined by variable text size.
But, I think I should still be able to figure out offset angle so the trimmed paths will always be centered on the corners.
Edit: Getting a bit further but still not there. This should make the yellow stroke start directly in the lower right corner, but it doesn't.

# text layer determines width and height
txt=thisComp.layer("quote").sourceRectAtTime();

# padding adding to width and height
p=thisComp.layer("controls").effect("box padding")("Slider");
h=txt.height+p;
w=txt.width+p;

# angle from upper right corner to lower right corner (yay trigonometry)
x=radiansToDegrees(Math.atan(h/w))*2;
[x]

I still haven't figured out how I'm going to account for the length of the line yet (in degrees).
Edit 2: Decided to take a different approach and use a mask with 2 rectangle shapes (controlled with a second slider)

The yellow stroke shape uses the dual rectangle shape layer as a track matte and I'm using these two expressions to determine the width/height of the rectangles.
txt=thisComp.layer("quote").sourceRectAtTime();
h=txt.height;
w=txt.width;
p=thisComp.layer("controls").effect("box padding")("Slider");
sw=thisComp.layer("controls").effect("stroke length")("Slider")
x=w-sw;
y=h+p*2;
[x,y]

txt=thisComp.layer("quote").sourceRectAtTime();
h=txt.height;
w=txt.width;
p=thisComp.layer("controls").effect("box padding")("Slider");
sw=thisComp.layer("controls").effect("stroke length")("Slider")
x=w+p*2;
y=h-sw;
[x,y]

I won't be able to animate the way I had planned, but I should still be able to come up with a cool look by animating the track matte. I'm leaving this question open because I would love to know why my first solution wasn't correct.
Edit3: Thanks for the answer Clif!

In order to align the lines to each corner, I was able to do this:
Bottom left corner:

No offset
Set trim start to 50%
Set trim end to 50%
Set expression on trim end to be 100 minus the trim start or something like 100 - content("Rectangle 1").content("Trim Paths 1").start
Now if you change the value of the trim start, it should stay equidistant with the trim end.

This first corner can be used as a starting point for all of the other corners and we should only have to update the offset to get them to align correctly to each corner.
Top right corner

Set offset to 180 degrees

Bottom right corner

Set expression for offset to be:

// If needed, change your width and height variables to whatever values you
// are using to drive your dimensions.
width = content("Rectangle 1").content("Rectangle Path 1").size[0];
height = content("Rectangle 1").content("Rectangle Path 1").size[1]
perimeter = 2 * width + 2 * height;
perc = width / perimeter;

-perc * 360

Top left corner

Pickwhip the offset of the bottom right corner and add 180.

Then you should be able to hook up each of the trim path's start positions to a 'slider control' effect to have them all animate together.


text:
How to prevent FFmpeg from dropping metadata?
When I am simply copying a.MOV (from my iPhone) to c.MOV, FFmpeg drops a lot of metadata, including the time and location of the video.
I tried -metadata, but FFmpeg still drops the information. It seems that the metadata is not dropped when FFmpeg prints Output #0, but is dropped when I use ffprobe to see metadata of the output file.
What should I do to make FFmpeg preserve these metadata?
$ ffmpeg -i a.MOV -c copy c.MOV -y
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2018-03-...
    com.apple.quicktime.location.ISO6709: .../
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone ...
    com.apple.quicktime.software: 11....
    com.apple.quicktime.creationdate: 2018-03-...
  Duration: 00:00:01.77, start: 0.000000, bitrate: 7868 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 7707 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2018-03-...
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 87 kb/s (default)
    Metadata:
      creation_time   : 2018-03-...
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-03-...
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-03-...
      handler_name    : Core Media Data Handler
Output #0, mov, to 'c.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.creationdate: 2018-03-...
    com.apple.quicktime.location.ISO6709: .../
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone ...
    com.apple.quicktime.software: 11....
    encoder         : Lavf57.71.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, q=2-31, 7707 kb/s, 30 fps, 30 tbr, 19200 tbn, 600 tbc (default)
    Metadata:
      creation_time   : 2018-03-...
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 87 kb/s (default)
    Metadata:
      creation_time   : 2018-03-...
      handler_name    : Core Media Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=   23 fps=0.0 q=-1.0 Lsize=     732kB time=00:00:01.76 bitrate=7827.5kbits/s speed= 971x
video:921kB audio:9kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.291216%
$ ffprobe c.MOV
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf57.71.100
  Duration: 00:00:00.77, start: 0.000000, bitrate: 7819 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 7707 kb/s, 30 fps, 30 tbr, 19200 tbn, 38400 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : H.264
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 92 kb/s (default)
    Metadata:
      handler_name    : DataHandler
$

I have the same problem; the above doesn't work. I am using ffmpeg version
ffmpeg version 3.4.4-1~16.04.york0 Copyright (c) 2000-2018 the FFmpeg developers and this ffmpeg -i a.MOV -map_metadata 0 -c copy c.MOV still causes this to be dropped:-
Writing library : Apple QuickTime
com.apple.quicktime.make : Apple
com.apple.quicktime.model : iPhone 5s
com.apple.quicktime.software : 10.3.3
com.apple.quicktime.creationdate : 2018-06-06T01:15:37+0800 and to be replaced with:-
Writing application : Lavf57.83.100

Other answers here only work with the "known" meta keys, but for custom/arbitrary meta keys, -map_metadata 0 is not sufficient to keep them all.
In my transcoder project, a lot of camera makers like to inject custom meta keys in the MP4/MOV container, and I want to keep them in the transcoded MP4/MOV files. After a lot of head scratching, FFmpeg does seem to have a switch for this purpose:
-movflags use_metadata_tags

Note that this has to go after the input file, as for example in:
ffmpeg -i $input_file -movflags use_metadata_tags -crf 22 $output_file

Credit goes to the author of this thread and Google:
https://superuser.com/questions/1208273/add-new-and-non-defined-metadata-to-a-mp4-file

Nice tip - thanks. One thing I noticed when I converted a bunch of mov files I had recorded on iphones the Rotation tag in the exif data said 180. ffmpeg by default auto rotates the video - but if you also copy the mov tags to the mp4, then it still tells the player to rotate 180 even though ffmpeg auto rotated the mp4 during the conversion. So my videos ended up being upside down when I played them :) - The workaround in my case was to tell ffmpeg to not auto rotate using -noautorotate - a quick workaround is to use Exiftool and set the rotation to 0 - exiftool -Rotation=0 file.mp4

Wow, credits indeed. ffmpeg -h full documents use_metadata_tags as "Use mdta atom for metadata", not the least obfuscated way of saying "just preserve my metadata"!

So do I use -movflags use_metadata_tags in conjunction with -map_metadata 0 or is the first one enough?

@Shayan the first one is enough to "keep all", but with some side effects mentioned in other comments, you need to check if that matters for your cases.

I think you should include a warning in the answer that other apps can't read these tags (Music, Plex, Meta) because they might use ffmpeg to verify tags were added and think all is well.

The -metadata option is for manipulating the metadata. If you just want to copy the metadata from an input file to an output file, you should use the -map_metadata option:
ffmpeg -i a.MOV -map_metadata 0 -c copy c.MOV

The file specifier is a zero-indexed number, so '0' takes the metadata from the first input file.
Note that -map_metadata and -movflags can be used in conjunction to preserve more metadata:
ffmpeg -i in.mp4 -crf 27 -movflags use_metadata_tags -map_metadata 0 out.mp4

-map_metadata 0 or -map_metadata 1?

@evandrix As stated in the answer, 0 selects the first input file as the source. For details, see this section of the ffmpeg docs.

FFmpeg, by default, makes all metadata from the first input file available, to the output file muxer, for writing. -map_metadata allows to override that, by either pointing to a different input, or by telling ffmpeg to discard input global metadata (value of -1).
However, which of the available metadata, is actually written to the output file, depends on the output muxer. The QT/ISOBMFF muxer (for MOV/MP4/3GP..) only considers a limited number of tags, primarily iTunes-related. As @JerryTian noted, with -movflags use_metadata_tags, all other tags are written to the file. However, these are written in an unconventional manner - Quicktime, in particular, does not recognize these additional metadata entries. Other, ffmpeg-based s/w, should read them. Or anyone who's using custom s/w, like @JerryTian, can adapt their s/w to read them.
Note that movflags only applies to output from the QT muxer. Matroska (MKV) will write anything. Other muxers vary.

I\m trying to keep metadata when converting music. I have a custom CATALOGID, but when converting from wav to flac. The field is not preserved. ffmpeg -i bb.wav bb2.flac -movflags use_metadata_tags. Any idea ?

So if I understand you correctly, you're saying that using FFmpeg to encode into an .mkv should preserve all metadata from the source by default, without needing to speciify any additional options?

I haven't found a way to have ffmpeg preserve the data. But I've found that for my needs I wanted the exif metadata and the exiftool was a convenient solution.
You can copy metadata between video files: https://unix.stackexchange.com/a/492338/83370
There's a trick to copy all metadata using the option -all:all>all:all:
http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3440.0
exiftool -TagsFromFile a.MOV "-all:all>all:all" c.MOV

I tried all above on files from Canon 200D and this one is actually most useful. It still makes further exiftool c.MOV much smaller than the output from the original, but it preserves actual creation date (-map_metadata did it too, but not -movflags) and camera name, but lens information is still gone.

OK, this was actually a great starting point - all I had to do is skip that mapping part. Just using exiftool -TagsFromFile in.mp4 out.mp4 did the job!

@virgo47 what should -TagsFromFile look like?

Looking at the ffmpeg source
Which metadata is written is hard-coded. There isn't a normal way to write all metadata --- for mov, mp4, etc. Whereas I can see that a mkv file gets all its metadata.
I can't say why they have it work that way. For other encoders, it could be different.
Now I found the use_metadata_tags option to be a bad idea since it is not standard - for example Plex does not read any of the metadata anymore. Funny that I was trying to get more metadata into Plex, but this option actually did the opposite. In the code above I can see that the MDTA way is to write all keys, then all values, whereas I guess most programs expect key/value pairs in a list, and therefore just don't know how to read MDTA metadata.

From the comment in the answer https://superuser.com/questions/523286/how-to-make-handbrake-preserve-capture-time-creation-time/523696#comment2528176_523696
A full command line adding the option to copy special tags will be:
ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy -movflags use_metadata_tags fixed.mp4

ffmpeg does not correctly preserve Keys tags in movie metadata. The problem is that the Keys tags are embedded in UserData atom which Apple's apps do not display:
ffmpeg -i input.mp4 -c copy -movflags use_metadata_tags -map_metadata 0 output.mp4

That can be fixed with exiftool:
exiftool -m -overwrite_original -api LargeFileSupport=1 -Keys:All= -tagsFromFile @ -Keys:All output.mp4

https://trac.ffmpeg.org/ticket/4209#comment:26
https://exiftool.org/forum/index.php?topic=15418.msg82847#msg82847

source: Stack Exchange

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

sort: votes


text:
Meaning of ffmpeg output (tbc, tbn, tbr)
I am using ffmpeg to tell me video info. Specifically:
ffmpeg -i video.ext

I get the output:
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 704x576 [PAR 12:11 DAR 4:3], 9578 kb/s, 25 tbr, 90k tbn, 50 tbc

Does anyone know what tbr, tbn and tbc are exactly? I have seen speculation on the Internet but nothing definitive.

Well it's all about time. FFMpeg uses in fact three different timestamps in different bases in order to work.

tbn = the time base in AVStream that has come from the container
tbc = the time base in AVCodecContext for the codec used for a particular stream
tbr = tbr is guessed from the video stream and is the value users
want to see
when they look for the video frame rate

This was also asked on the FFmpeg mailing lists: What does the output of ffmpeg mean? tbr tbn tbc etc?
Original answer: Meaning of ffmpeg output (tbc, tbn, tbr) [closed]

abbrev
full
variable
explanation

fps
frames per second
AVStream.avg_frame_rate
average frame rate = total frames / total seconds. A variable frame rate video may have an fps of 57.16

tbr
time base, real (?)
AVStream.r_frame_rate
user-friendly, target frame rate. The same variable frame rate video above could have a tbr of 60.

tbn
time base number (?)
AVStream.time_base
timescale (ticks per second). This number could be 90000, 15360, etc. It is used to calculate the actual time from a PTS (Presentation Time Stamp). If timescale is 90000, and PTS for a frame is 45000, that frame is displayed at 0.5 seconds.(Note: this abbreviation and variable name is a misnomer because it is actually timescale, not timebase. Timebase should be the reciprocal, such as 1/90000, 1/15360, etc.)

tbc
time base, codec (?)
AVCodecContext.time_base
codec timescale. Same as tbn, but for the codec. This has been deprecated and removed.

There is no mention in the source code explaining the full words for tbr, tbn, tbc. My guess is that tbr, tbn, tbc originally meant something, but the original names no longer apply, and now would be misnomers. For example, tbn is not even a timebase, it's a timescale (the reciprocal). I made a guess at the original full words based on clues from the source code.

References

variable names: https://github.com/FFmpeg/FFmpeg/commit/bb3388fd60e55db0b162dc78409ae495cbc6b64f

fps (AVStream.avg_frame_rate):
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/avformat.h
/**
 * Average framerate
 */
AVRational avg_frame_rate;

tbr (AVStream.r_frame_rate):
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/avformat.h
/**
 * Real base framerate of the stream.
 * This is the lowest framerate with which all timestamps can be
 * represented accurately (it is the least common multiple of all
 * framerates in the stream). Note, this value is just a guess!
 * For example, if the time base is 1/90000 and all frames have either
 * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
 */
AVRational r_frame_rate;

tbn (AVStream.time_base):
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/avformat.h
/**
 * This is the fundamental unit of time (in seconds) in terms
 * of which frame timestamps are represented.
 */
AVRational time_base;

tbc (AVCodecContext.time_base) has been deprecated/removed:
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/avcodec.h
/**
 * This is the fundamental unit of time (in seconds) in terms
 * of which frame timestamps are represented. For fixed-fps content,
 * timebase should be 1/framerate and timestamp increments should be
 * identically 1.
 * This often, but not always is the inverse of the frame rate or field rate
 * for video. 1/time_base is not the average frame rate if the frame rate is not
 * constant.
 */
AVRational time_base;

deprecation commits for tbc:

https://github.com/FFmpeg/FFmpeg/commit/202e06870eb4bbc4636aff5f461c1a0654ec2435
https://github.com/FFmpeg/FFmpeg/commit/3749eede66c3774799766b1f246afae8a6ffc9bb#diff-a48d0f241f423be450908b536b6adec39606ef72847aeeb500cee81e88a19697
https://github.com/FFmpeg/FFmpeg/commit/4796ec5d4ea00a86f9f6732653469e682e5266da
https://github.com/FFmpeg/FFmpeg/commit/2b41463b8706638b9aaf967655f95ddc195c32eb

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


text:
ffmpeg complex filter lowering audio quality
I used some complex filters on a audio file and did some re-encoding.
ffmpeg -f lavfi -t 5 -i anullsrc=channel_layout=stereo:sample_rate=192000 -i file1.mp3 -filter_complex "[1:a][0:a]concat=n=2:v=0:a=1[audio_silence],amovie=file2.mp3:loop=0,asetpts=N/SR/TB,volume=0.1[music];[audio_silence][music]amix=duration=shortest,volume=1" out.mp3

Everytime I do this the audio gets worse. The audio is some speech recording and there are a lot of hisses and high frequency noices in the output.
How can this be prevented or equalized afterwards?
I tried some low pass filters but that doesn't seem to work.
Cheers

Problem found. The input quality was already very bad. I used higher quality input which sounded already better.
Also minimizing the amount of conversions helped to increase output quality. Nothing too special but when I asked the question it was not obvious to me.
Hope it helps. Cheers.


text:
ffmpeg and .srt file with delayed subtitles
I have an .avi file from a miniDV camera and an .srt file with subtitles extracted from it.
I run the avi file through Avisynth. The .srt file starts at 37m48s:
1
00:37:47,840 --> 00:37:48,400
08/13/2011
15:45:36

2
00:37:48,400 --> 00:37:49,400
08/13/2011
15:45:37

I convert it like this:
ffmpeg.exe -avisynth_flags +all -i "input.avs" -i "input.srt" -map 0:v -map 0:a? -map 1:s? -c:v libx264 -crf 17 -c:a aac -b:a 192k -c:s mov_text -metadata:s:s:0 title="Timecode" -disposition:s:0 0 "output.mp4"
But in the resulting file the subtitles start from the very beginning. Is it possible to write a command for ffmpeg so that the subtitles are at their time positions?

Take a look at the answer.


text:
How to stabilize DSLR video shot with a tripod in a car
I have recorded videos driving my car. I have setup a Nikon 3200 camera with the 18-55mm kit lens on a tripod in the rear hatch of my car. The tripod sits flat and level in the rear hatch. The tripod is a relatively cheap Optex TP160 with a basic pan head. I have uploaded a short example clip of one of my videos as an unlisted video on youtube.
My issue is that I have small shakes/tremors in the video. I drive a cheap economy car, you feel all the little bumps in the road as you drive. It seems like every time I go over the slightest crack in the road it is vibrating the tripod and causing the video to shake.
I have placed my tripod like this, both with and withour rubber floot mats underneath:
I have tried basic software methods to stabilize the video, like ffmpeg's "vidstabdetect / vidstabtransform" filter, as well as the "deshake" and "deshake_cl" algorithms. Vidstabtransform did the best job and lessened the biggest shakes in the video, but small shakes were unaffected, especially in the peripherals like the top and sides of my windshield.
Are there any relatively cheap methods to stabilize my videos? I would consider "cheap" to be a solution less than ~$250 Canadian (~190 USD / ~180 Euro).
Here are some ideas I've seen on the internet:

"Better" software solutions, like working in after effects, davinci resolve or similar. I don't know if any software packages would beat the performance of ffmpeg's filters.
Anti-vibration tripod pads: amazon example. Reviews are mixed, could these little pieces of rubber really dampen the vibrations inside a car?
A tripod fluid/video head. It seems like these tripod heads are better for smooth pans and tilts, I don't know if this affects stability.
A tripod gimbal head. I haven't seen someone using these the same way I want to, maybe its an option.
A dash cam. This doesn't allow changeable lenses or the in-car positioning I would like.
A motorized gimbal / steadycam / etc. These solutions are above my budget and would need another operator. I'm hoping for a solution I can setup in my car alone without another person.

Can't really provide an answer as this isn't something I've ever done myself. I'd try DaVinci first - it's good & it's free, & has a stabilisation/anti-shake mode. Rubber feet are for long lens stabilisation on a non-moving surface, not in-car. Gimbals are the way to go, but I wouldn't know what to recommend at your price point, or car-specific. Ronin are what I see on set most often, but even the 'cheap' Ronin hand-helds are £400 or so. The guys I work with use the top-end Ronin 2, which is about £6,500 [& seems to be replacing the steadicam these days, as you can hold or crane-mount it.]

Try a camera/lens with optical image stabilization. Some newer phones have this.  Also I would suggest trying a lower cost DJI gimbal like the Osmo Mobile attached to the phone.  These two combined with some image stabilisation software such as mentioned in the other comment would go a long way.

+1 combine as many methods of stabilization as you can.  The trick is isolating the camera vibration from the car.  I’d imagine spring dampening+gimbal+ois+software stabilization would be the ultimate.  Also, more massive cameras have higher rotational inertia, so the bigger and heavier the whole setup, the more stable, but also more expensive.

I don't know what equipment they use, but if you watch this season of Top Gear & compare to earlier seasons you can see they now employ not just anti-shake, but self-levelling gimbals. You can see it most clearly in the heavy cornering. The only car-mounted gear I ever get close to is usually on 'multi-million-dollar' Hollywood stuff, so I never see how 'the rest of us' do this. [I am not on camera crew either, so this is all second hand knowledge.]


text:
What video container formats are similar to MPEG-TS?
I have been looking to live video streaming where a client can join the stream of bytes and play the video automatically. I have recently found MPEG-TS which seems to work pretty well, and I noticed if I replace the .ts file with another format .mp4 or .mkv it doesn't work. I was just wondering if there are any alternative to MPEG-TS that I could test out, or is this the leading pioneer of this type of streaming?
Thanks
EDIT: Could I use a stream of h.264 bytes?

MPEG-TS is it..

Really wow, would have thought there would be other. Thanks for that.


text:
How can I cut up large videos into clips, then reorder these into a new video?
All I want to do is take large videos, cut them up into small clips, and then reorder those clips into a new video. Yet this seems completely impossible to do with Final Cut Pro X… it can't be impossible because this must be a common need but it won't let me copy the cut clips into the media library and if I can't do that how can I do this? Why is this so hard to do?

FCPX is nondestructive to the source video.  It does let you select portions of source video, put them on a timeline, and trim them as necessary, but it will not reduce your original media in any way, even if that's what you're trying to do.  All other NLE's support media management to reduce file footprint..  So, if you want to permanently delete the unused portions, you'll have to manually export the used portions, and then delete the originals.  See my question here: https://video.stackexchange.com/questions/7455/is-is-possible-to-trim-portions-of-clips-in-fcpx-to-save-disk-space

The clips you cut in your timeline can’t be copied into the media pool because technically these aren’t individual clips yet. Just references to the original media. You can rearrange these easily in your timeline. Just drag and drop clips in your timeline. Everything will move around the clip you change position.

Sure. But let's say I have a clip, and I've used the first half of that, edited it, etc. And now I want to put a different clip after this first half. So, I delete the second half. And add the second clip in instead. Now of course I can retrieve the video from that second half again, but 1. it will take me a minute or two to find the right place. 2. There are two clips stuck together, and I don't want to have to realign them again. I mean, for the second issue I can create a compound clip. But it'd be nice to be able to somehow 'store' a reference to the the second half of each of these clips.

When you cut a clip in two parts you can add a different clip “into” this cut and the second half of your initial clip will move out of the way. There is no need to delete the second half and then later add it again.

Sure, one could do that. But I don't really want it cluttering my timeline. You can say that's because I have a tiny brain, and I'll agree. I actually came up with some ways to handle this issue. But I've put them in a new question https://video.stackexchange.com/questions/35494/ive-got-half-way-through-editing-a-clip-on-the-timeline-now-i-want-to-delete-t I also describe them in a youtube video https://www.youtube.com/watch?v=D8vvWpBSTy4

Thanks Hugh, these are good solutions. It probably depends on the workflow and how long this “rest” would remain in the timeline. If it is just a short time, I would insert a larger Gap to move the “rest” out of my view and do the changes in front of the Gab. When I’m done, I delete the Gab, and the “rest” is back. For lengthier or more complicated work, your methods are admittedly better.

Calm down. Final Cut Pro X is a software for professionals and as such requires a certain investment of time until you can work with it. If you are not willing to do this you should look for a simpler tool.
Yes, of course it's possible to do what you want, but to me it sounds like you don't know the basics of how to operate the software. To get you started, these videos might help you:
Introduction
Blade Tool

It's certainly possible to drag all of your clips to the timeline, then chop out the parts you don't want, and then drag-and-drop the remaining pieces into the order you want. I used to do that with the old-school version of FCP (prior to FCPX), and it still works. (In fact, as you do this, it closes gaps where you delete parts of clips, which is very convenient.)
Or, you can play the clips in the bin using J/K/L to control playback, I/O to mark in and out points, and E to take that part of the clip and throw it into the timeline at the end. So you could hop around in the clips in the bin, throwing pieces you want into a rough cut in the timeline without ever touching the timeline.
Or, you can play through the clips in the bin and use markers to remind you where you're hearing/seeing things you really want to use, then go back and do the I/O/E thing to throw them the timeline. (You can be a little loose and fast with your I/O since you can always expand your clips in the timeline to reveal parts you missed with your I or O.
And you have options other than E to put pieces of clips in the timeline at places other than the end. (And you can drag-n-drop highlighted pieces of clips into the timeline.) For example W will insert the currently selected piece of a clip into the timeline at the current playhead or if you move your cursor down into the timeline it creates a red line where the insertion will occur. You could literally jump to 5 places in your timeline and insert your clip 5 times in about a second if you wanted to.
If you're envisioning cutting clips up and arranging them in the bin, FCPX doesn't work that way as far as I can tell. If you're troubled by the pieces of clips sliding around in the timeline to close gaps, that's the storyline concept of FCPX: you have a main storyline that closes gaps and to which you link supporting elements, above, that move with the part of the storyline they're attached to but that do not close gaps when edited/deleted.
FCPX is different from most editors and from prior versions of FCP. It's relatively affordable, but it's very much for professionals who expect to use keyboard shortcuts, want to work super-efficiently, and don't mind learning the foundational concepts that FCPX is designed around.

When you import clips into Final Cut Pro and make a project, they should all show up in that project. If you want to put specific clips in the timeline, then you need to select the specific part in the window that includes all your imported media. None of the imported media will go away if you do this. Once you import the media, it doesn't matter how much you cut it up when editing, the media will still be there.

Just for clarification, when you cut out a specific piece from one long clip to use in your timeline, the original clip remains intact. Don't think of it as cutting out that specific bit, think of more as copying it into the timeline. It doesn't disappear, you are just making a replica.


text:
Can someone please help me understand Adobe After Effects Roto Brush 2 Propagation?
I am new to the Roto Brush (saw it on Corridor Crew!) and for the most part have it working.
As I understand it, you roto out your first frame, then go through frame by frame tidying it up as required.
What I don't understand, is why on every subsequent frame, when I make a change, it propagates EVERY frame from my original frame forward to the one I just changed. Surely nothing should be changing in the earlier frames as I was happy with those?
Every change propagating every frame since frame 1 is taking aaages as I progress.
I don't actually have to make any changes for the propagation to go through every frame again. I only have to go back one or two frames to check something and it goes off on its little propagation run again.
Am I doing something wrong?


text:
FFMpeg Encoding and Core Usage
We have developed an application to transcode source .mov files into .ogg, .mp4 and .webm output. It is currently running on AWS EC2 instance g2.8xlarge. It is working (yay!).
My question: Even though I am passing in -threads 0 to the ffmpeg command (actually setting ffmpeg.threads configuration in php-ffmpeg),  the running process is sometimes only being executed on a single core. Why is this happening?  See below output from htop command:

As you can see, Core #21 is maxed out.  In a few seconds, it's going to switch to another one, rather than max out all of them like I would like and greatly speed up my encoding process.  The situation is transient; during some runs all of the processors are maxed out, but during others they are not and we only get use of the one processor.  A colleague mentioned that perhaps the codec we're using for some of the formats don't support multi-threaded execution during encoding, though I can't verify that is the behavior I'm observing yet.
Is this the case?  If so, what codecs for the formats above will allow us to transcode into these target formats while taking advantage of all of our available hardware?  The default codecs set for php-ffmpeg are below;
         Video        Audio
Ogg    libtheora    libvorbis
WebM   libvpx       libvorbis
X264   libx264      libfaac

Update
Looking at the running processes, below is what winds up being the ffmpeg command that is run for an MP4 (currently saturating all 32 cores):
ffmpeg -y \
  -i my-video.mov \
  -async 1 \
  -metadata:s:v:0 start_time=0 \
  -async 1 \
  -metadata:s:v:0 \
  -async 1 \
  -metadata:s:v:0 start_time=0 \
  -async 1 \
  -metadata:s:v:0 start_time=0 \
  -s 1920x1080 \
  -s 1920x1080 \
  -s 1280x720 \
  -threads 0 \
  -vcodec libx264 \
  -acodec libfaac \
  -b:v 1200k \
  -refs 6 \
  -coder 1 \
  -sc_threshold 40 \
  -flags +loop \
  -me_range 16 \
  -subq 7 \
  -i_qfactor 0.71 \
  -qcomp 0.6 \
  -qdiff 4 \
  -trellis 1 \
  -b:a 128k \
  -pass 2 \
  -passlogfile /tmp-ffmpeg-passes55ad0d0233f711zdrg/pass-44ad0d02340a8 \
  my-video-1200.mp4

I'm not actually building this command directly, php-ffmpeg is, though I do believe I have at least a modest amount of control over what goes in to it (for instance, I have no idea why there's multiple -metadata:s:v:0 entries at the beginning)

There's a lot of yuck-factor in that command line, apart from the duplicated options (-s three times, the final one with a different size).  Explicitly setting a bunch of args to their current default values (e.g. -i_qfactor, -subq, -qcomp) is weird, and could give bad results with future libx264.  (Probably not, but only because libx264 is pretty much done, and stable, not under heavy development.  If it did stuff like this for x265, that would be bad.)  Anyway, 2-pass 1200k is fine, but you might prefer target-quality crf.  It doesn't specify a -preset. :(

libfaac isn't as good as libfdk_aac.  If you're using this in a for-pay service, you'd need to check on the licensing of libfdk_aac, though.  Also, this cmdline is missing -movflags +faststart

It's also possible to have ffmpeg produce multiple outputs from the same input.  Just have multiple sequences of output-options output-filename on the commandline.  So all in all, I'm not super impressed with php-ffmpeg, if that's the kind of cmdline it comes up with.  Maybe you could use it differently to get it to generate multiple outputs at once, so there wouldn't be a single-threaded theora step.  Anyway, if it works, then great, but beware of changes to encoder defaults, and the meaning of x264 subme levels changing, in ways that mean your cmdline hurts quality.

@Peter thanks so much. I think the answer here really is I need to debug how that cmd is being built. If I really can stuff multiple outputs into that command, I think that would probably give me the better shot of maximizing the load on the hardware

https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs.  And yeah, I agree that's probably best.  Otherwise you have task that's single-threaded for some of its time, and loading all your cores for some other part of the time.  Hard to schedule jobs that behave that way.

BTW, this question might be better on stackoverflow, or maybe unix.stackexchange, or maybe serverfault.  This site is I think less focused on questions that don't involve decisions based on creative merit or at least perceptual video / audio quality.  However, I'm all about the tech details, so I'll answer.
FFmpeg uses multi-threading by default, so you prob. don't need -threads 0.  If your encode is bottlenecked on a single-threaded filter or decoder, you'll see full load on one core, and light load on many other cores.
One thing you can do is check mediainfo of your output video.  x264 leaves its settings in an ASCII string in the h.264 header.  So either strings -n20 or mediainfo to get:
...
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.051
Stream size                              : 455 MiB (89%)
Writing library                          : x264 core 146 r2538+1 d48ec67
Encoding settings                        : cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=0.70:0.10 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=4 / lookahead_threads=1 / sliced_threads=0 / nr=50 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=5 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=22.5 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=3:0.60
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Note the "threads=4" in there.  I think I manually set that on my quad core i5 2500k, instead of letting x264 use the default CPUs * 1.5, since I had a CPU-intensive filters (hqdn3d and lanczos-downscale) running.
Anyway, libx264 with a preset like slower should have no trouble keeping a lot of cores busy.  There are some parts of encoding that are inherently serial (e.g. the CABAC encode of the final bitstream), so a high-bitrate video that doesn't spend a lot of CPU-time refining references (high subme) to multiple frames (high ref) might show a load pattern like yours (one thread using 100% CPU, others not).
I'm not 100% sure about faster presets being less parallel, but I know CABAC is serial.
To get massively parallel, libx264 could use a boatload of RAM to keep frames around, and keep doing lookahead for 2 or more GOPs, and encode those independently.  It doesn't have an option to operate that way, though.
One way to make use of MANY cores is to run multiple separate encodes in parallel, instead of just a series of single encode using all cores.  This only works if you have multiple input files that you want encoded separately.  You're trading off threading overhead vs. more memory capacity and bandwidth (with an impact on caching, unless this is on a multi-socket system with separate L3 and DRAM for each cluster of CPUs, and you have the processes pinned to cores so one encode is using the cores in one socket, and the other the other).

Thanks for the insight.  I asked here mainly because I don't have any questions at all regarding "code" and more about whats going on behind the scenes and thought this would be a better fit.  I'll flag for moderator attention to migrate and then they can make the call.

Right now we're sticking a message on an AWS SQS queue that has a link to each file.  This instance has a job running that listens for those messages, downloads the file, transcodes it, and uploads the output files out once each completes. If I am reading this correctly, you're saying that it would probably make more sense for us to go ahead and launch a few of these worker processes and transcode multiple files in parallel rather than attempt to focus all cores on a single process?

Yeah, if you're having problems saturating more cores, it's fine to run an encode or 3 in parallel.  I think x264 should be able to saturate most of your 32 cores, but maybe only with a slower preset.  Post your ffmpeg cmdline options, and console output, in your question.  IDK if you're using something silly and low-quality like -preset veryfast.  If so, then decode of the input might be the single-thread bottleneck.  Or like I said, maybe a slow filter.

You're certainly going to want to overlap the download/upload of one xcode with the CPU usage of another xcode, if you're not planning to stream to/from ffmpeg on the fly for production use.  (It may be possible to get the equivalent of -movflags +faststart on the fly, with a different muxer.  I think I read something about that.  Otherwise, if you're outputting mp4, you kinda need to output to a file so ffmpeg can put the moov atom at the front and shuffle the data over when the encode is done.)

Oh, I just read your Q in more detail.  If you're outputting all 3 formats in one go (with the same ffmpeg command line, so the decode of the input only has to happen once), then if one of the 3 encoders is single-threaded, it will bottleneck the whole process.  I think libtheora is not multi-threaded.   https://wiki.xiph.org/TheoraEncoders says there was a multi-thread fork, but it died. (maybe never worked well, or wasn't compatible with other encoder improvements?  Could be many reasons it didn't get merged.)  http://lists.xiph.org/pipermail//theora-dev/2015-February/004374.html

Is Theora still useful?  I thought webm VP8 filled the patent-free niche now, and was compatible with a lot of stuff.  It's only VP9 that's not well supported.  Anyway, unless you expect many people to actually use your theora streams, you might want to set your theora encoder to use less CPU, if you can, to avoid delaying the whole job.  (But yes, you will have to run lots more encodes in parallel to saturate your cores with theora bottlenecking you.  Reduce the thread-count for x264 and libvpx, since they'll be a bit more efficient.  Or crank up the quality: -preset veryslow :)

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

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


text:
Sony PXW-Z280V AVC strange Long GOP pattern
I have video shot using a Sony PXW-Z280V using AVC_3840_2160_HP@L51 with 29.97 frame rate. Upon analyzing the MXF file structure, I notice that the Index Entry Array seems incorrect. In particular the KeyFrameOffset values for the first two B-frames in every GOP points back two prior I-frames. But that doesn't make any sense, since the previous I-frame has all the information needed, so why go back to the one before that?
See the following entries (especially #16, #17). To me it looks like the frame offset values for these two frames should be -1, -2 instead of -16, -17. Is this a problem with the Sony codec implementation, or something I'm not understanding correctly?
              #  TempOffs  KeyOffs                 Flags       StreamOffs  Sl.Offs# 0
              0         1        0    0xC4 R S . . . 1 I   0x000000000000     2357760
              1         1       -1    0x13 . . . Bp. . B   0x000000244E00      162816
              2        -2       -2    0x13 . . . Bp. . B   0x000000271E00      278528
              3         1       -3    0x22 . . Fp. . . P   0x0000002BB200      488448
              4         1       -4    0x33 . . FpBp. . B   0x000000337A00      211456
              5        -2       -5    0x33 . . FpBp. . B   0x000000370800      297472
              6         1       -6    0x22 . . Fp. . . P   0x0000003BE600      553984
              7         1       -7    0x33 . . FpBp. . B   0x00000044AE00      315392
              8        -2       -8    0x33 . . FpBp. . B   0x00000049D200      293888
              9         1       -9    0x22 . . Fp. . . P   0x0000004EA200      612864
             10         1      -10    0x33 . . FpBp. . B   0x000000585000      305152
             11        -2      -11    0x33 . . FpBp. . B   0x0000005D4C00      306688
             12         1      -12    0x22 . . Fp. . . P   0x000000624E00      585216
             13         1      -13    0x33 . . FpBp. . B   0x0000006B9000      316928
             14        -2      -14    0x33 . . FpBp. . B   0x00000070BA00      299008
             15         1        0    0x40 . S . . . . I   0x000000759E00      582656
             16         1      -16    0x33 . . FpBp. . B   0x0000007ED600      302080
             17        -2      -17    0x33 . . FpBp. . B   0x00000083C600      236032
             18         1       -3    0x22 . . Fp. . . P   0x00000087B400      650240
             19         1       -4    0x33 . . FpBp. . B   0x00000091F400      246784
             20        -2       -5    0x33 . . FpBp. . B   0x000000960C00      252416
             21         1       -6    0x22 . . Fp. . . P   0x0000009A3A00      649216
             22         1       -7    0x33 . . FpBp. . B   0x000000A47600      251904
             23        -2       -8    0x33 . . FpBp. . B   0x000000A8A200      249856
             24         1       -9    0x22 . . Fp. . . P   0x000000ACC600      649216
             25         1      -10    0x33 . . FpBp. . B   0x000000B70200      252928
             26        -2      -11    0x33 . . FpBp. . B   0x000000BB3200      250368
             27         1      -12    0x22 . . Fp. . . P   0x000000BF5800      643584
             28         1      -13    0x33 . . FpBp. . B   0x000000C97E00      249856
             29        -2      -14    0x33 . . FpBp. . B   0x000000CDA200      247808
             30         1        0    0x40 . S . . . . I   0x000000D1BE00      951808
             31         1      -16    0x33 . . FpBp. . B   0x000000E09800      246272
             32        -2      -17    0x33 . . FpBp. . B   0x000000E4AE00      235520
             33         1       -3    0x22 . . Fp. . . P   0x000000E89A00      663552
             34         1       -4    0x33 . . FpBp. . B   0x000000F30E00      239104

Welcome! Are you having problems playing or working with the files or are you going through validation testing? Have you asked Sony about this? They tend to have their own interpretation of some of the standards.

I'm trying to implement partial file restore from tape (the essence rewrapping part). My files are importable in FCP, Premiere Pro, but not Resolve. When I ran the file through some validation tools, I came across this issue. I don't know who to contact in Sony about this.

If you are an end user, I'd start with sales or support. If you are vendor, you probably need to work through who ever handles channel partners. If you don't know who that is, and you are working with a specific client, I'd ask them to make the introduction.


text:
How can I easily shrink over-large MP4s where high quality is not relevant?
I have some smartphone video that is absurdly large for what is low-quality casual video: 100MB per minute. What is the easiest way to compress this (on Mac) using command-line or GUI, given that I don't want to optimize settings for this casual video -- just some sort of default?
I have found answers online (often quite outdated) to use  ffmpeg -i in.mp4 -vf scale=1280:720 -preset slow -crf 18 out.mp4 or the like, but I am none too sure about  what might be an acceptable default.
I also tried  ffmpeg -i in.mp4  -fs 100M out.mp4, which gives decent results -- I am interested in any further good ideas.

I'd recommend a simple GUI app, such as Smart Converter [can't remember if it's free or paid, App Store won't tell you once you own it] or Handbrake (freeware) which is a lot like ffmpeg, but without all the typing.
In both you can set up, or choose from existing, presets.

This bash script may be useful. It simply uses ffmpeg to compress  all large (>150MB) mp4 files in a directory to half the size.
#!/usr/bin/env bash
set -x
set -u
set -e

for fn in *.mp4 ; do
  filesize=$( ls  -l "$fn" | awk '{print $5}')
  if [ "$filesize" -gt "150000000" ]; then
    new_filesize=$(($filesize / 2 ))
    new_filesize_MB=$(($new_filesize / 1000000 ))
    fn_base="${fn%%.*}"
    fn_ext="${fn#*.}"
    ffmpeg -i "${fn}"  -fs $new_filesize "${fn_base}.${new_filesize_MB}M.${fn_ext}"
  fi
done


text:
Cryptic FFmpeg + Python error: "Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_crop_1"
I want to use ffmpeg with Python in a Jupyter notebook to create a video from 2000 PNG image files generated by matplotlib. I'm on a Windows 7 machine.
The frames are very narrow and high, so I'd like to cut them vertically into seven equal-sized "tiles" using crop and stacked those "tiles" horizontally using hstack, but I'm getting only getting cryptic error messages:
ffmpeg_path = notebook_directory    # Make sure ffmpeg.exe is in notebook directory!

frames_path = 'C:\\Users\\Username\\Desktop'
frames_renamed_path = os.path.join(frames_path, 'renamed')
os.chdir(frames_renamed_path)    # Temporarily change current working directory

check_call(
    [
        os.path.join(ffmpeg_path, 'ffmpeg'),
        '-y',    # Overwrite output files without asking
        '-report',    # Write logfile to current working directory
        '-hwaccel', 'cuda',    # Use GPU acceleration
        '-framerate', '60',    # Input frame rate
        '-i', os.path.join(frames_renamed_path, 'frame%05d.png'),    # Path to input frames
        #'-r', '60',    # Output frame rate
        '-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2',    # Pad frames to even pixel numbers (required by many codecs)
        #'-pix_fmt', 'yuv420p',
        '-pix_fmt', 'rgb32',    # Use RGB32 pixel format matching MatPlotLib image output
        '-filter_complex',    # Cut frames into tiles and rearrange (here: 7 horizontal tiles)
            'crop=in_w:in_h/7:0:0[tile_1],'    # 1st tile from top
            + 'crop=in_w:in_h/7:0:in_h*1/7[tile_2],'    # 2nd tile from top
            + 'crop=in_w:in_h/7:0:in_h*2/7[tile_3],'    # 3rd tile from top
            + 'crop=in_w:in_h/7:0:in_h*3/7[tile_4],'    # 4th tile from top
            + 'crop=in_w:in_h/7:0:in_h*4/7[tile_5],'    # 5th tile from top
            + 'crop=in_w:in_h/7:0:in_h*5/7[tile_6],'    # 6th tile from top
            + 'crop=in_w:in_h/7:0:in_h*6/7[tile_7],'    # 7th tile from top
            + '[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7',    # Stack tiles horizontally
        os.path.join(frames_renamed_path, 'video.mp4')    # Path to store output video
    ]
)

os.chdir(notebook_directory)    # Reset current working directory to notebook directory

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Input In [10], in <cell line: 9>()
      6 frames_renamed_path = os.path.join(frames_path, 'renamed')
      7 os.chdir(frames_renamed_path)    # Temporarily change current working directory
----> 9 check_call(
     10     [
     11         os.path.join(ffmpeg_path, 'ffmpeg'),
     12         '-y',    # Overwrite output files without asking
     13         '-report',    # Write logfile to current working directory
     14         '-hwaccel', 'cuda',    # Use GPU acceleration
     15         '-framerate', '60',    # Input frame rate
     16         '-i', os.path.join(frames_renamed_path, 'frame%05d.png'),    # Path to input frames
     17         #'-pattern_type', 'glob', '-i', os.path.join(frames_renamed_path, '*.png'),    # glob not available in Windows by default
     18         #'-r', '60',    # Output frame rate
     19         '-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2',    # Pad frames to even pixel numbers (required by many codecs)
     20         #'-pix_fmt', 'yuv420p',
     21         '-pix_fmt', 'rgb32',    # Use RGB32 pixel format matching MatPlotLib image output
     22         '-filter_complex',    # Cut frames into tiles and rearrange (here: 7 horizontal tiles)
     23             'crop=in_w:in_h/7:0:0[tile_1],'    # 1st tile from top
     24             + 'crop=in_w:in_h/7:0:in_h*1/7[tile_2],'    # 2nd tile from top
     25             + 'crop=in_w:in_h/7:0:in_h*2/7[tile_3],'    # 3rd tile from top
     26             + 'crop=in_w:in_h/7:0:in_h*3/7[tile_4],'    # 4th tile from top
     27             + 'crop=in_w:in_h/7:0:in_h*4/7[tile_5],'    # 5th tile from top
     28             + 'crop=in_w:in_h/7:0:in_h*5/7[tile_6],'    # 6th tile from top
     29             + 'crop=in_w:in_h/7:0:in_h*6/7[tile_7],'    # 7th tile from top
     30             + '[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7',    # Stack tiles horizontally
     31         os.path.join(frames_renamed_path, 'video.mp4')    # Path to store output video
     32     ]
     33 )
     35 os.chdir(notebook_directory)

File C:\Program Files\Python38\lib\subprocess.py:364, in check_call(*popenargs, **kwargs)
    362     if cmd is None:
    363         cmd = popenargs[0]
--> 364     raise CalledProcessError(retcode, cmd)
    365 return 0

CalledProcessError: Command '['C:\\Users\\Username\\Desktop\\ffmpeg\\ffmpeg', '-y', '-report', '-hwaccel', 'cuda', '-framerate', '60', '-i', 'C:\\Users\\Username\\Desktop\\renamed\\frame%05d.png', '-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2', '-pix_fmt', 'rgb32', '-filter_complex', 'crop=in_w:in_h/7:0:0[tile_1],crop=in_w:in_h/7:0:in_h*1/7[tile_2],crop=in_w:in_h/7:0:in_h*2/7[tile_3],crop=in_w:in_h/7:0:in_h*3/7[tile_4],crop=in_w:in_h/7:0:in_h*4/7[tile_5],crop=in_w:in_h/7:0:in_h*5/7[tile_6],crop=in_w:in_h/7:0:in_h*6/7[tile_7],[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7', 'C:\\Users\\Username\\Desktop\\renamed\\video.mp4']' returned non-zero exit status 1.

This is the ffmpeg log output (cropped):
ffmpeg started on 2022-08-04 at 01:17:19
Report written to "ffmpeg-20220804-011719.log"
Log level: 48
Command line:
"C:\\Users\\Username\\Desktop\\ffmpeg\\ffmpeg" -y -report -hwaccel cuda -framerate 60 -i "C:\\Users\\Username\\Desktop\\renamed\\frame%05d.png" -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt rgb32 -filter_complex "crop=in_w:in_h/7:0:0[tile_1],crop=in_w:in_h/7:0:in_h*1/7[tile_2],crop=in_w:in_h/7:0:in_h*2/7[tile_3],crop=in_w:in_h/7:0:in_h*3/7[tile_4],crop=in_w:in_h/7:0:in_h*4/7[tile_5],crop=in_w:in_h/7:0:in_h*5/7[tile_6],crop=in_w:in_h/7:0:in_h*6/7[tile_7],[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7" "C:\\Users\\Username\\Desktop\\renamed\\video.mp4"
ffmpeg version 2022-07-14-git-882aac99d2-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --ena  libavutil      57. 29.100 / 57. 29.100
  libavcodec     59. 38.100 / 59. 38.100
  libavformat    59. 28.100 / 59. 28.100
  libavdevice    59.  8.100 / 59.  8.100
  libavfilter     8. 45.100 /  8. 45.100
  libswscale      6.  8.100 /  6.  8.100
  libswresample   4.  8.100 /  4.  8.100
  libpostproc    56.  7.100 / 56.  7.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'cuda'.
Reading option '-framerate' ... matched as AVOption 'framerate' with argument '60'.
Reading option '-i' ... matched as input url with argument 'C:\Users\Username\Desktop\renamed\frame%05d.png'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'pad=ceil(iw/2)*2:ceil(ih/2)*2'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'rgb32'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument 'crop=in_w:in_h/7:0:0[tile_1],crop=in_w:in_h/7:0:in_h*1/7[tile_2],crop=in_w:in_h/7:0:in_h*2/7[tile_3],crop=in_w:in_h/7:0:in_h*3/7[tile_4],crop=in_w:in_h/7:0:in_h*4/7[tile_5],crop=in_w:in_h/7:0:in_h*5/7[tile_6],crop=in_w:in_h/7:0:in_h*6/7[tile_7],[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7'.
Reading option 'C:\Users\Username\Desktop\renamed\video.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option report (generate a report) with argument 1.
Applying option filter_complex (create a complex filtergraph) with argument crop=in_w:in_h/7:0:0[tile_1],crop=in_w:in_h/7:0:in_h*1/7[tile_2],crop=in_w:in_h/7:0:in_h*2/7[tile_3],crop=in_w:in_h/7:0:in_h*3/7[tile_4],crop=in_w:in_h/7:0:in_h*4/7[tile_5],crop=in_w:in_h/7:0:in_h*5/7[tile_6],crop=in_w:in_h/7:0:in_h*6/7[tile_7],[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7.
Successfully parsed a group of options.
Parsing a group of options: input url C:\Users\Username\Desktop\renamed\frame%05d.png.
Applying option hwaccel (use HW accelerated decoding) with argument cuda.
Successfully parsed a group of options.
Opening an input file: C:\Users\Username\Desktop\renamed\frame%05d.png.
[image2 @ 00000000005db0c0] Opening 'C:\Users\Username\Desktop\renamed\frame00000.png' for reading
[file @ 00000000005f6c00] Setting default whitelist 'file,crypto,data'
[AVIOContext @ 00000000005fed40] Statistics: 28860 bytes read, 0 seeks

<...>

[AVIOContext @ 00000000005fda00] Statistics: 67659 bytes read, 0 seeks
[image2 @ 00000000005db0c0] Probe buffer size limit of 5000000 bytes reached
Input #0, image2, from 'C:\Users\Username\Desktop\renamed\frame%05d.png':
  Duration: 00:00:25.00, start: 0.000000, bitrate: N/A
  Stream #0:0, 80, 1/60: Video: png, rgba(pc), 1200x1857 [SAR 3937:3937 DAR 400:619], 60 fps, 60 tbr, 60 tbn
Successfully opened the file.
[Parsed_crop_0 @ 00000000005fdc40] Setting 'out_w' to value 'in_w'
[Parsed_crop_0 @ 00000000005fdc40] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_0 @ 00000000005fdc40] Setting 'x' to value '0'
[Parsed_crop_0 @ 00000000005fdc40] Setting 'y' to value '0'
[Parsed_crop_1 @ 0000000000607500] Setting 'out_w' to value 'in_w'
[Parsed_crop_1 @ 0000000000607500] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_1 @ 0000000000607500] Setting 'x' to value '0'
[Parsed_crop_1 @ 0000000000607500] Setting 'y' to value 'in_h*1/7'
[Parsed_crop_2 @ 0000000000607880] Setting 'out_w' to value 'in_w'
[Parsed_crop_2 @ 0000000000607880] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_2 @ 0000000000607880] Setting 'x' to value '0'
[Parsed_crop_2 @ 0000000000607880] Setting 'y' to value 'in_h*2/7'
[Parsed_crop_3 @ 0000000000607c00] Setting 'out_w' to value 'in_w'
[Parsed_crop_3 @ 0000000000607c00] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_3 @ 0000000000607c00] Setting 'x' to value '0'
[Parsed_crop_3 @ 0000000000607c00] Setting 'y' to value 'in_h*3/7'
[Parsed_crop_4 @ 00000000005fda00] Setting 'out_w' to value 'in_w'
[Parsed_crop_4 @ 00000000005fda00] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_4 @ 00000000005fda00] Setting 'x' to value '0'
[Parsed_crop_4 @ 00000000005fda00] Setting 'y' to value 'in_h*4/7'
[Parsed_crop_5 @ 0000000002b8f800] Setting 'out_w' to value 'in_w'
[Parsed_crop_5 @ 0000000002b8f800] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_5 @ 0000000002b8f800] Setting 'x' to value '0'
[Parsed_crop_5 @ 0000000002b8f800] Setting 'y' to value 'in_h*5/7'
[Parsed_crop_6 @ 0000000000607d00] Setting 'out_w' to value 'in_w'
[Parsed_crop_6 @ 0000000000607d00] Setting 'out_h' to value 'in_h/7'
[Parsed_crop_6 @ 0000000000607d00] Setting 'x' to value '0'
[Parsed_crop_6 @ 0000000000607d00] Setting 'y' to value 'in_h*6/7'
[Parsed_hstack_7 @ 0000000002b8fb80] Setting 'inputs' to value '7'
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_crop_1

What is the problem here? Also, how does one interpret this cryptic error message at the end of the log output:
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_crop_1
E.g. what is input pad 0, why is it unlabeled, and why can't it find a matching stream?
(PS.: Yes, I do have a habit of excessively documenting my code. ^^)

Mmmh...could it be that dividing the input height in_h by 7 is resulting in unequal "tile" sizes, causing hstack to fail? I.e. is it necessary to apply padding to the individual "tiles" after cropping them into pieces?

Both -vf and -filter_complex can't be specified for the same input stream. In any case, you would have to carry out the pad at the end of the stacking, so remove the -vf and use the following.
    '-filter_complex',    # Cut frames into tiles and rearrange (here: 7 horizontal tiles)
        'split=7[i1][i2][i3][i4][i5][i6][i7];'          # 7 clones, 1 for each crop
        + '[i1]crop=in_w:in_h/7:0:0[tile_1];'           # 1st tile from top
        + '[i2]crop=in_w:in_h/7:0:in_h*1/7[tile_2];'    # 2nd tile from top
        + '[i3]crop=in_w:in_h/7:0:in_h*2/7[tile_3];'    # 3rd tile from top
        + '[i4]crop=in_w:in_h/7:0:in_h*3/7[tile_4];'    # 4th tile from top
        + '[i5]crop=in_w:in_h/7:0:in_h*4/7[tile_5];'    # 5th tile from top
        + '[i6]crop=in_w:in_h/7:0:in_h*5/7[tile_6];'    # 6th tile from top
        + '[i7]crop=in_w:in_h/7:0:in_h*6/7[tile_7];'    # 7th tile from top
        + '[tile_1][tile_2][tile_3][tile_4][tile_5][tile_6][tile_7]hstack=7,'
        + 'pad=ceil(iw/2)*2:ceil(ih/2)*2'
    '-pix_fmt', 'rgb32',    # Use RGB32 pixel format matching MatPlotLib image output

Hi Gyan, many thanks. I'll try your suggestion ASAP. By the way, how did you find out that one can only specify either -vf or -filter_complex, but not both? Is this mentioned in the ffmpeg docs? Also, is padding the frame to even pixels actually required in this case (since I'm not using any codec/compression, e.g. yuv420p)?

Sorry, but your solution doesn't work. Same error message even after completely removing both the -vf and pad

...also, using split isn't required here and is, in some cases, known to cause memory saturation

Furthermore, rgb32 isn't a supported option.

rgb32 is what you specified. With libx264, it will get resampled to yuv444p

split is preferred to keep frames in sync. Occasionally, in large filtergraphs, using the same input in many filters has caused frame drops when filtergraphs are reinited. spit avoids that.

Show the report file with my stated solution.


text:
What actually distinguishes various MPEG-4 Part 2 video codecs (divx, xvid, mpeg4, msmpeg4v1, mp4v, etc.)
I recently audited a large folder containing a variety of encoded videos from 2002-2014. Using ffmpeg, I extracted and recorded metadata, including the video codec used on the film. An example command I might run to get this data: ffprobe -show_format -show_streams -print_format json -loglevel quiet <filename>. From there I am extracting the streams -> [first video stream] -> codec_name key from the results.
Many of the files return codecs I recognize (hevc, h264, vp9, mpeg2video, wmv1, etc.) However, confusingly, they also return many codecs that I would think are implementations of MPEG-4 part 2: divx, dx50, fmp4, mp4v, mpeg4, msmpeg4v1, msmpeg4v2, msmpeg4v3, and xvid.
If MPEG-4 part 2 is considered a single video standard, then I would think that although there may be multiple encoders that produce video according to that standard, they'd all be the same "codec". That's clearly an incorrect assumption on my part. But all of the MPEG-4 Part 10 files report as h264 irrespective of which encoder was used. So my first question is what is the distinction between a codec and an encoder, and why do all encoders lead to the same "codec" for MPEG-4 Part 10, but not for MPEG-4 Part 2?
Second, how do all these files differ from one another? I presume there is no generalizable distinction in terms of quality, because quality is a setting of an encode, not an intrinsic feature of an encoder. But how would a video player think of each of these codecs as being separate? What features do each have that the other do not?
Although this previous question overlaps mine, but I do not think it answers it in total. While it provides history, it does not discuss the encoder/codec distinction or bring in all of the codecs I ask about; I am less interested in learning who developed each and more interested in understanding the technical distinction.


text:
YUV420 to losseless
I am using Raspberrypi HiQ camera to capture High Speed(120fps) videos of planets for astronomy purposes.
Using libcamera-vid I can record h264 upto 4.2 but I saw h264 has limitation of 60fps. I wouldn't mind that if I do not loose any frames(video slowed down), but on the other hand I believe that recording in h264 would result in losses? And it is necessary for my purposes that I do not loose any bit of real data. So compression is fine, but lossy is not.
Libcamera-vid can also record in mjpeg, and uncompressed and unformatted YUV420. The latter is interesting to me, but unfortunately I am having trouble decoding it... I learned that ffmpeg can convert it to other formats. As far as I care it even doesn't even have to be a video, series of TIFFs, FITS, SEQ are fine for me. The software I am using is accepts a long list of video and image files, but not yuv.
I tried converting and playing it but I got passing green lines of different saturation on black background... Not planet Saturn :)
I saw there are different types of yuv420, but raspi documentation does not give whole lot information on it:
https://www.raspberrypi.com/documentation/accessories/camera.html
So in short what tool, or command, on linux or windows, can I use to convert this yuv420 to any losseless format from list bellow
https://ibb.co/mXKwqLL

or I can even use h264 without fear of losing data? Any alternative is acceptable from my side I am just interested in having video/images that I can work with.
Command I Used to play video:
ffplay test23.yuv -video_size 256x256 -f rawvideo -pixel_format yuv420p

Command I used to record the video
libcamera-vid --codec yuv420 --qt-preview  --analoggain 24 --shutter 8000 --framerate 120 --frames 2500 --mode 1332:990:10:P --roi 0.1,0.1,0.5,0.5 -o /mnt/ramdisk/test23.yuv --width 256 --height 256

Here is link to video:
https://drive.google.com/file/d/1guvv4x7MuJ15H_g6v9EXuImZ2Xy-lghF/view?usp=sharing

Welcome! Can you share a sample source file and the full ffmpeg command that you used?

Thanks! I have updated question.

I have managed to generate something I can use, now I need to make sure it is losseless this js the command ffmpeg -y -s 256x256 -pix_fmt yuv420p -i  ~/Public/raw/test23.yuv -c:v libx264 -pix_fmt yuv420p -profile:v high444 -crf 0 -preset:v slow tedt23_lossless.avi

So I finally found an answer on stackoverflow.com. Check this answer for detailed parameters explanation:
https://stackoverflow.com/questions/15778774/using-ffmpeg-to-losslessly-convert-yuv-to-another-format-for-editing-in-adobe-pr#15780960
In short use this command to generate lossless x264
ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -r 25 -pix_fmt yuv420p -i inputfile.yuv -c:v libx264 -preset ultrafast -qp 0 output.mp4

To check is it really losseless use this command:
ffmpeg -i input.mp4 -f rawvideo -vcodec rawvideo -pix_fmt yuv420p -s 1920x1080 -r 25 rawvideo.yuv

And then I do:
diff inputfile.yuv rawvideo.yuv

If there is no output, files are the same.


text:
premiere pro exports are corrupt / wont play or upload to YouTube
I have tried 4 times now to export a 16 minute long video consisting only of an image sequence and audio tracks.
The video is a 360/vr video, and on this old machine, takes roughly 2 and a half hours to render every time, only to output a corrupt video that will neither play in vlc nor upload to youtube (youtube abandons processing pretty quickly.)
when I export a significantly shorter video from the timeline it outputs just fine, and other video projects I've rendered have never had this problem. the file just ends up 0 bytes every time

solved: the problem, for whatever reason, was that I was using an image sequence instead of a video. this works for shorter durations, but for long durations its no wonder premier has trouble. to solve it, i followed these steps:

using FFMPEG, turned the image sequence into an .mp4 with ffmpeg -framerate 60 -i %d.png -framerate 60 out.mp4 which ensures the framerate is both interpreted and written as 60fps
replace footage in premier with the newly rendered out.mp4
render from adobe premier- remarkably, the process is also substantially faster. it took me roughly 10 minutes, down from 2 and a half hours.

Don't use Media Encoder for the export, do it in Premiere.
Export a small section first, to see if that works.
If the small section works, expand it - maybe try half the sequence, and see if that half works.  If it does/doesn't, then hone it down until you find where the problem is in the timeline. Purge the cache, keep trying...
How big is the final exported file?  Could it be a file size limit based on the format of the drive you're exporting on to?

none of this is the problem. the entire video is only a singular image sequence clip with songs that all work fine when exporting on their own. i am using just premiere itself to export; not media encoder. and finally, the final exported file is 0 bytes. completely empty- as stated already.


text:
How to calculate lenses parameters to record a pc monitor
I want to make a video audit of my pc screen (4k). The distance would be about 40cm to the centre. Can it be done with much of distortion of the geometry (I cannot place the camera at the centre obviously - this is where my head is) ? How to calculate focus lenght of the lense and other relevant parameters?
Screen size is 40in and it is curved.
P.S. This has to be a separate camera. Software solutions are unacceptable

There is too much information missing to even start to calculate this. We'd need the screen dimensions [4k doesn't tell us anything we need to know] and camera frame size too [crop factor determines focal length compensation].
Anyway… what if your calculation showed you would need a 30mm lens? You can't buy one of those [easily], so you'd have to use a zoom & set it manually… which would be the same as if you hadn't done all the calculations in the first place.
Anyway, a 27" screen from about 40cm on a full-frame camera would need about a 30mm lens [I did this by eye using as zoom lens as above]. You will still get keystoning because you're not square on, possibly some barrel distortion because of the short lens & softness to the edges unless you close the aperture down a fair way.
The 'trick' to flat field capture is actually to use a long lens from much further away, but this wouldn't fix your keystoning.
All in all, it would be far easier to just record with something like OBS

Sorry the screen size is 40in. What kind of lens should I have if I position camera 100cm away (disregard distortion for now)?

Just get a zoom. You still didn't tell us the camera frame size. This really isn't anything I've ever bothered to try calculate. You just hold up the camera & pick a lens. Previous experience will tell you a ballpark figure, the rest is simply empiricism.

I thought to get camera for the lense. I don't even know what frame size is. And I am sure to select a zoom lenses I will have about the same amount of questions or even more. My previous experience is custom cctv system for my house 10 years ago. Also I did photography when I was a child. On film, developing and printing it myself. That was 45 yrs ago.

I edited question - took first good looking item from aliexpress. They aren't difficult to find

Honestly, if you're about to throw $1000 at a camera system, you really ought to do some research first. At least visit a camera shop & talk to the staff. You're starting with a difficult goal, one which will probably not give good results & no clue of what equipment you need. This is not a good place to start. The lens you just added seemingly at random would not be even vaguely suitable, even if you can figure out what camera it would fit.


text:
Remove black frames from a videos
Is there any way to remove & replace black frames from a video without losing video quality? There are like just 3-4 frames to be removed.
I tried this method, but the result was nt that great and the video was heavily compressed
This is 2022 and thought may be there any better ways to do it now. :)

The filters will remain the same. You have to add some video encoding parameters. Try adding -c:v libx264 -crf 18

@Gyan I did try that. I used ffv1 instead. But it didn't fix my black screen issue (but the video quality was fine). Even though it got heavily compressed, the one with no video encoding parameters had better results.


text:
After effect position keyframes motion problems
I'm trying to make a motion of position of shape and I'm getting next:

In this frame, position getting automatically lower than I desired to. I mean, I want that the 1st keyframe to be 950 px (for example) and the 2nd ketframe to be 930px. But when I do this, automatically, the curve goes to 900px and then, from this location (circled orange in image), goes to 930px.
That I want to do is a transition from 950px to 930px, and not 950 to 900 and then to 930; but AE automatically creates that type of curve.
Why?

It's because you're not using Linear spatial interpolation on the keyframes.
See this answer:
Object moving to a position I didn't specify

Thank you! It is solved :)


text:
How can I convert a 30FPS video to 50FPS video without affecting the length of the video?
How can I interplote a 30FPS video to a 50 FPS video without affecting the length of the video?
I have used the VSDC video editor to do so. I have set the reframing mode to optical flow.
However, I found that it just inserted a previous frame between the adjacent frames.
I have tried the mkvtoolnix, unfortunately, it just shortened the video duration.
Is there any better solution?

Several commercial solutions seem only to support full integers as multipliers for frame rate conversion. Assuming VSDC works a similar way, thus you might try to go via the LCM of 30 and 50 frames per second and first do a upconversion to 150 frames/sec and afterwards reduce it to 50 frames/sec.
Sadly the official docs do not say anything about that.


text:
Grey overlay when reading mp4 files in WMP
For a few days, when I play a mp4 video in Windows Media Player (WMP), there is something like a grey filter/overlay.
Thus, the whites are greyish and blacks lack depth. This problem is only encountered when playing the video with Windows Media Player. If I use VLC or the Windows movies & TV app, the rendering is as expected.
The picture below illustrates the problem well:

I have been suspecting an issue with the rendering dynamic range: 16-235 vs. 0-255, but:

Video options in WPM are rather poor and there are no such parameters to be set;
In my graphic-card setting panel, I was not able to find any relevant parameters (I am using the Radeon RX Vega 10 graphics of my laptop & AMD software Adrenalin edition. No HDMI cables).

It might be something else related to a Windows update (I am using Windows 10 21H2), but I don't really know what.
Any help is very welcome.

I think I found a solution to my problem.
The issue seemed to be in the Windows HD Color settings.
Thus, I reset the calibration of my built-in display for HDR content in Windows. The option is a bit tricky to find, because it is in a deep Windows graphics menu. However, you may find a comprehensive description of the process to follow at the following link:
https://support.microsoft.com/en-us/windows/calibrate-your-built-in-display-for-hdr-content-in-windows-de1c66fa-6cc0-b327-e73a-1bac6bd46bc0
I hope this is helpful for people facing the same issue.

…which just goes to show what a hokey bag of cr*p Windows HDR is. It's not a video standard it's guesswork on top of guesswork. Avoid like the plague it is for professional applications.   ;))

The bug has come back (from a Windows update?) and the old trick with HDR content no more works. Any ideas (solutions?) are very welcome. This issue makes me crazy...


text:
How do I add (layer) a .wav audio file to a ProRes 422 HQ .mxf video without re-encoding?
Here's the detailed info of the .mxf video
General
Complete name                            : D:\R-2180634-1250074380.jpeg-gigapixel-low_res-scale-2_00x.mxf
Format                                   : MXF
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Closed / Complete
File size                                : 123 GiB
Duration                                 : 45 min 38 s
Overall bit rate                         : 387 Mb/s
Package name                             : Source Package
Encoded date                             : 2022-09-26 15:48:32.968
Writing application                      : Adobe Inc. Adobe Media Encoder 2.0.0.0.1
Writing library                          : win32 5.3.6.0.1

Video
ID                                       : 512
Format                                   : ProRes
Format version                           : Version 0
Format profile                           : 422 HQ
Format settings, wrapping mode           : Frame
Codec ID                                 : 0D010301021C0100-0401020203060400
Duration                                 : 45 min 38 s
Bit rate                                 : 387 Mb/s
Width                                    : 1 200 pixels
Height                                   : 1 078 pixels
Display aspect ratio                     : 1.113
Frame rate                               : 60.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 4.981
Stream size                              : 123 GiB (100%)
Writing library                          : adb0
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

The basic syntax is
ffmpeg -i in.mxf -i in.wav -c copy out.mxf

The audio should be Linear PCM signed 16 or 24 bit at 48000 Hz.

Thank you for helping!


text:
ffmpeg - Too many inputs specified for the "split" filter
So I'm trying to add text and a logo onto all my video qualities with HLS and I am receiving the error Too many inputs specified for the "split" filter. I am not sure how to correct it so that my command is working.
ffmpeg -y -hide_banner -i /var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9.mp4
-i /var/www/area51-process1.example.com/html/includes/assets/watermark_logo.png
-filter_complex "[0:v]drawtext=fontfile=/var/www/area51-process1.example.com/html/includes/helveticaneue/HelveticaNeueMed.ttf:text=@mustsee:fontcolor=white@0.7:fontsize=(h/32):x=w-tw-25:y=h-th-10,format=yuv420p[wm];[1:v]scale2ref=oh*mdar:ih[logo];[logo]overlay=main_w-overlay_w-10:main_h-overlay_h-65;[wm][logo]split=5[s0][s1][s2][s3][s4];[s0]scale=854:450[480p];[s1]scale=640:338[360p];[s2]scale=1280:-2[720p];[s3]scale=1920:-2[1080p];[s4]scale=2560:1350[1440p]"
-map "[480p]" -map "[360p]" -map "[720p]" -map "[1080p]" -map "[1440p]" -maxrate:v:0 4000000 -bufsize:v:0 4000000 -maxrate:v:1 3000000 -bufsize:v:1 3000000 -maxrate:v:2 8000000 -bufsize:v:2 8000000
-maxrate:v:3 14000000 -bufsize:v:3 14000000 -maxrate:v:4 20000000 -bufsize:v:4 20000000 -map 0:a -c:a libfdk_aac -ac 2 -async 1 -ar 48000 -b:a 128k -c:v libx264 -preset superfast -crf:v:0 24
-profile:v:0 high -crf:v:1 25 -profile:v:1 high -crf:v:2 23 -profile:v:2 high -crf:v:3 22 -profile:v:3 high -crf:v:4 21 -profile:v:4 high  -g 100 -keyint_min 100 -force_key_frames "expr:gte(t,n_forced*2)" -sc_threshold 0 -flags +global_header
-movflags +faststart -max_muxing_queue_size 4096 -threads 0 -f tee "[select=\'v:0,a\':f=hls:start_number=0:hls_flags=single_file:hls_playlist_type=vod:hls_segment_type=fmp4:hls_time=4:hls_list_size=0:hls_segment_filename=/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-480p-segment.mp4]/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-480p.m3u8|[select=\'v:1,a\':f=hls:start_number=0:hls_flags=single_file:hls_playlist_type=vod:hls_segment_type=fmp4:hls_time=4:hls_list_size=0:hls_segment_filename=/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-360p-segment.mp4]/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-360p.m3u8|[select=\'v:2,a\':f=hls:start_number=0:hls_flags=single_file:hls_playlist_type=vod:hls_segment_type=fmp4:hls_time=4:hls_list_size=0:hls_segment_filename=/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-720p-segment.mp4]/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-720p.m3u8|[select=\'v:3,a\':f=hls:start_number=0:hls_flags=single_file:hls_playlist_type=vod:hls_segment_type=fmp4:hls_time=4:hls_list_size=0:hls_segment_filename=/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-1080p-segment.mp4]/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-1080p.m3u8|[select=\'v:4,a\':f=hls:start_number=0:hls_flags=single_file:hls_playlist_type=vod:hls_segment_type=fmp4:hls_time=4:hls_list_size=0:hls_segment_filename=/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-1440p-segment.mp4]/var/www/area51-process1.example.com/html/v/he2IqMmhZLG-f205e4f3-2351-447d-a16c-52855da761e9-1440p.m3u8"

update:
After using the new code it works but the image is huge. what could be causing that?

The split filter expects exactly one input. Also, scale2ref requires two, as does overlay. As currently specified, the filters will rely on implicit routing which won't help with debugging or clarity.
Use
[0:v]drawtext=fontfile=/var/www/area51-process1.example.com/html/includes/helveticaneue/HelveticaNeueMed.ttf:text=@mustsee:fontcolor=white@0.7:fontsize=(h/32):x=w-tw-25:y=h-th-10,format=yuv420p[wm];[1:v][wm]scale2ref=oh*mdar:ih[logo][wm];[wm][logo]overlay=main_w-overlay_w-10:main_h-overlay_h-65,split=5[s0][s1][s2][s3][s4];[s0]scale=854:450[480p];[s1]scale=640:338[360p];[s2]scale=1280:-2[720p];[s3]scale=1920:-2[1080p];[s4]scale=2560:1350[1440p]

Thanks for the answer. It was driving me crazy. I just have one problem. The logo is showing very big across the whole screen. Please see image above. What might cause that? It's the same code used here.  Is the scale2ref incorrect?

Never mind. I used code from another answer you provided scale2ref=w=oh*mdar:h=ih/20 and it's working great. thank you.


text:
Do mobile phones really record in these odd framerates?
I received several video files for editing that were recorded on a mobile phone. (Samsung S21, if it matters.)
When I brought the files into VEGAS (still using version 15.0 Platinum), it reports some unusual framerates that are approximately standard, including (in fps): 60.015, 59.722, 31.036, 30.058, 30.022, 30.009, 30.007, and 29.919.
The files are in MP4 format, AVC/AAC compression, with standard 1920 × 1080 resolution.
Are the reported framerates legitimate, or is this more likely an error in the way VEGAS calculates and reports framerate? Something else?
For my purposes, I'm sure the difference in framerate will not be noticeable if I disable resampling on these clips and use them in a 60p or 30p project (except maybe for the one at 31.036).

Yes, most phones record variable frame rate (VFR). Discussion: https://www.dpreview.com/forums/thread/4277721
To check, see https://superuser.com/questions/1487401/how-can-i-tell-if-a-video-has-a-variable-frame-rate


text:
ffmpeg: Changes to FPS only work if I don't include audio in the export, how can I keep audio and choose the FPS value?
How can I export a video to .mjpeg at my selected FPS value (7 FPS for stop motion video) while including audio in the export?
I use the -i input command in ffmpeg to include my .ogg audio file:
ffmpeg -r 7 -i /path/to/audio/file/audioexample.ogg -i "$IMAGEPATH/%06d.jpg" -vcodec mjpeg -shortest "$VIDEOFILE".mov

This doesn't export at 7 fps, it's much faster, looks like about 25 FPS. The -shortest option works and cuts the audio length to the video length, otherwise without -shortest the audio goes on longer than the video, so about 25 FPS either way regardless of -shortest.
The FPS will only correctly export at 7 FPS if I remove the audio from the ffmpeg export like this:
ffmpeg -r 7 -i "$IMAGEPATH/%06d.jpg" -vcodec mjpeg "$VIDEOFILE".mov

I'm using Linux Stopmotion video creation software which uses this ffmpeg command.
How can I include my audio but still have control of the FPS value using ffmpeg?

The location of the audio -i input within the ffmpeg command makes a difference. If the audio is input right after the FPS value, then the FPS value doesn't work and instead uses a default FPS. Put your sound input after your existing images input then the FPS value you input will work.
The working command is:
ffmpeg -r 7 -i "$IMAGEPATH/%06d.jpg" -i /path/to/audio/file/audioexample.ogg -vcodec mjpeg -shortest "$VIDEOFILE".mov


text:
How to optimize Media Composer performance on a MacBook Pro (2021)?
My wife is trying to use Media Composer 2022.10.0 on her rather new MacBook Pro (2021) and compared to her iMac (2019) it seems not to work as smoothly as she expected. Sadly I never worked with MC and/or Premiere myself. Is there a way to optimize its performance on the laptop?
MacBook Pro (14", 2021, M1 Pro, 32 Gb RAM, macOS 12.4), MC 2022.10.0
iMac (21.5", 2019, i7, 16 Gb RAM, Radeon Pro 560 X 4 Gb, macOS 10.15.7), MC 2020.8.0

An update to macOS Ventura (13.0) solved the problem!


text:
What software can I use to make fluid text 3D motion graphic?
I want to be able to do at least this:

Someone told me "Could adobe after effects, if 3D camera mode was used, and then if text was added on path."
I at least I need to know what tools can assuredly do this before I start getting into courses for it.
A suggested workflow like the quote would be much appreciated as well.

This was quite possibly made with After Effects.
You could learn how to make something pretty similar by following this old but good set of tutorials for beginners:
https://www.videocopilot.net/basic/

You could start by making a layer
Make sure the text is left aligned
Make it 3D
Duplicate it several times
Make a null object and place it on the left edge of your text layers
Parent the text layers to the null object
Rotate each of the text layers in 3D space
Then animate the rotation of the null object


text:
How does color management work, fundamentally?
I have watched hours of videos on the subject, but I just can't understand it without a slightly deeper explanation. If it helps you to explain, my production software of choice is DaVinci Resolve.
I understand the need for reference color spaces, but not at all their application. Unless you are on a display using Y'CbCr, it is fundamentally RGB. It's also likely quantized to an integer between 0-255. With that in mind, what are ICC profiles and monitor settings doing to the output signal? For example, you can set the gamma value and relative RGB strengths within most monitors' menus. But with their digital processors, wouldn't messing with these on a 24-bit signal cause significant color degradation? The same question applies to ICC profiles, especially since I watched Taran Van Hemert's video on color calibration, wherein he found that desktop recording software did capture the differences in color brought on by ICC profiles, and some software bypasses color management altogether.
(Bonus question! Online video is typically in limited-range rec.709. Does this mean consumer NLEs are outputting the wrong colors since most computer displays are in full-range sRGB?)

The classic "POYNTON, Charles, 2012. Digital Video and HD. Second Edition. Waltham MA 02451, USA: Morgan Kaufmann. ISBN 978-0-12-391926-7" will answer all the questions you'll ever have on digital video ;-) Of course a lot of mathematics in it. For a quick start you might try Charles Poynton - Color technology.

After months of confusion, I make a post on a forum and hours later find an article that answers (most) of my questions.
The parts I'm most concerned with are in sections 2 and 7. Per the article:

This is where color management comes into play: if applications know the actual gamut of that monitor, they can translate this “0,255,0” sRGB value to another set of RGB values that represent the same color (or fairly close) in a bigger color space: sRGB 0,255,0 (green) -> 144,255,60 AdobeRGB (same sRGB green color)

Since we output discrete RGB numbers to a monitor, usually from 0 to 255 for each channel, and since a monitor accepts a discrete RGB number as input, usually from 0 to 255, then if we modify this one-to-one translation with a calibration curve, we may be introducing “gaps” or “jumps” in that 256 step stair. Such gaps may result in visible jumps between neighbor grey values and even coloration of some grays (red, green or blue tint in them).

So yes, ICC profiles can cause color degradation since they act on 24-bit color most of the time. This also explains why ICC profiles would show up in screen recordings and why you're able to activate color management on a per-app basis since they're just modifying the RGB values to match the standardized color definition with respect to the monitor's gamut/gamma.
TL;DR: ICC profiles are more or less just LUTs that transform RGB values with respect to your monitor's gamut so that the values match the physical scientific definition of each color in the real world. They aren't magic voodoo and are still constrained to the precision of the output signal to your monitor. (but also according to the same article and this Reddit post, some graphics cards have a dithering option that helps)
This doesn't address my questions about monitor settings, but it eliminates the most confusing part for me. If any part of this is wrong, I'd love more information! Until then, I'm marking this as the answer.
Edit: For those wondering how this applies to DaVinci Resolve or Blackmagic Fusion, it kinda doesn't. See this post.

Not a colour expert, but I think:
YCbCr is just a mathematically different way of representing RGB.
Y is luminance, Cb and Cr are mathematically derived ways of representing the other colours.
It is possible to reduce the bandwidth used to send Cb and Cr in order to reduce the overall bandwidth, because your eyes see luminance more precisely than they do colour.
It isn't necessarily true that everything is quantised to 0-255, if you're working with footage that is greater than 8 bit, or in software that allows you to process footage at colour depths greater than 8 bit.
I think Rec.709 more or less fits within the colour space of sRGB?
When you calibrate a monitor, you're trying as best you can to match a desired gamma curve based on the profile your computer thinks it should be displaying to you.  Assigning where black white and mid-grey are along that curve.
I've no idea about where within the chain desktop recording software records video. It's quite possible some more diddling about happens in some monitors after the calibration, and I think that's one of the reasons people use broadcast monitors - because they can trust that there's no additional smoothing, noise reduction, or pumping up of colour just to make things look punchy.

Thanks for the reply!
sRGB and Rec.709 share the same chroma gamut but generally has a different gamma curve. Per the Rec. 709 Wikipedia entry:
"Rec. 709 and sRGB share the same primary chromaticities and white point chromaticity; however, sRGB is explicitly output (display) referred with an equivalent gamma of 2.2"
Also, Y'CbCr isn't perfectly reversible to RGB which was a massive shock to me too, seeing as it's literally defined with RGB values. There is a color format called Y'CoCg that solves this issue.


text:
ffmpeg: video size/quality changes when applying ffmpeg with no filters or other parameters
I've used ffmpeg for years for minor tweaks to sound & video but I know pretty much zero about containers and codecs and whatnot.
I've recently had a need to reduce the physical (disk) size of videos recorded on my phone to meet restrictions for uploads to social media.
Because it's disposable content for social media, best quality isn't that important.
What I really want is to understand what is happening in the following situation:
Source video is from OpenCamera on Android 12, using default settings.
The source video is about 80mb on disk, and the output from ffprobe looks like this:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VID_20221101_101217Z.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2022-11-01T10:13:05.000000Z
    com.android.version: 11
  Duration: 00:00:46.89, start: 0.000000, bitrate: 14227 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1600x900, 14075 kb/s, SAR 1:1 DAR 16:9, 29.95 fps, 29.95 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2022-11-01T10:13:05.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2022-11-01T10:13:05.000000Z
      handler_name    : SoundHandle

If I do nothing else except this:

ffmpeg -i VID_20221101_101217Z.mp4 VID_20221101_101217Z_NO_CHANGE.mp4

The file size drops to 29mb and the output of ffprobe looks like this:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VID_20221101_101217Z_NO_CHANGE.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:46.88, start: 0.000000, bitrate: 5019 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 900x1600 [SAR 1:1 DAR 9:16], 4888 kb/s, 29.95 fps, 29.95 tbr, 18k tbn, 59.90 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 121 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

The subjective quality of the two are barely distinguishable & the second version is easily good enough for social media.
I can see that some numbers are different: kb/s, tbn, tbc are smaller, and I can see that 'yuv420p' no longer has '(tv,bt709)' appended. I also note that the kb/s for the audio stream in the second version is higher.
But I don't understand what these numbers mean and what has been "lost" so that the file size has been reduced by ~64%
It's a bt of a general question for SE I realise, but nevertheless I'd hope for some clarification.
thanks

When you run ffmpeg without specifying any options, its default behavior is to decode the audio and video and then reencode them. In the case of mp4, it chooses its aac encoder for the audio, and libx264 for the video. You can see this change when you run ffmpeg:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (opus (native) -> aac (native))

Here, my video that originally was encoded using an unknown h264 encoder, is now being encoded with libx264, and the opus audio was converted to aac. As in your case the video and audio were already h264 and aac respectively, so there was no change in codec, but the encoder used to encode each stream changed. As for why the size changed, ffmpeg's default parameters for x264 are evidently more aggressive compared to the defaults of OpenCamera, resulting in a smaller file size.
An analogy for this would be like opening a jpeg photo in photoshop or paint, and then saving it as a jpeg again. The resulting photo might be larger or smaller, depending on how the program compresses it.
If you find this behavior undesirable, you can also copy codecs like this:
ffmpeg -i VID_20221101_101217Z.mp4 -c:v copy -c:a copy VID_20221101_101217Z_NO_CHANGE.mp4

This will not reencode either codec, preserving the file size.