text:
How can I choose the correct shutter speed to avoid banding when taking video of projected video?
I need to record video projected onto a wall or screen by an Optoma EP726 digital projector. I need to record it on a Canon EOS 77D at 23.976fps.
I first tested videos of various frame rates, all exported and projected at their native frame rates -- I took a single video, modified its frame rate in Premiere and made sure each sequence matched the video's new frame rate -- and did all the recording at 23.976fps, the frame rate I'll need to use for the real project.
Here are the results of those tests, all 10-20 seconds long, all shot with a shutter speed of 1/100s:
Video projected at 23.976fps, recorded at 23.976fps, 1/100s:

Video projected at 24fps, recorded at 23.976fps, 1/100s:

Video projected at 25fps, recorded at 23.976fps, 1/100s:

Video projected at 60fps, recorded at 23.976fps, 1/100s:

All the videos are black and white, but when I record the projector's output, you can see moving bands of red, green and blue showing up in the camera's footage. Those are visible on the camera's preview screen, but not to the naked eye. The bands remain visible even when the resulting video -- that is, the video out of the camera -- is made black and white.
The following setups were more successful, and I think two of them have no banding at all.
This test was projected at 25fps and recorded at 23.976fps, but with a shutter speed of 1/25s, and the problem is still visible but it's only slight:

This test was projected at 23.976fps and recorded at 23.976fps with a shutter speed of 1/25s, and as far as I can see there is no problem, but please do correct me if I'm wrong:

Finally, this test was projected at 23.976fps and recorded at 23.976fps with a shutter speed of 1/60s. I would have expected bad banding given the high shutter speed, but in fact I don't see any:

This was baffling me at first and I started this question intending to ask how to fix it, but apparently it can be fixed by making sure the projected frame rate, camera frame rate and camera shutter speed align so that the camera preview shows no moving bands. I'm posting this as a question anyway because it might be useful to others.
There is still a less important question, though: I don't know how to determine a priori what combinations will succeed. Practically speaking, I'll just use one of the two successful test setups. But if it could be explained how the interference pattern works, I'd like to know. I imagine it's possibly also connected to the AC frequency. I'm in the UK, so I believe it's 50Hz.

The banding occurs because the projector uses DLP technology  - it rapidly switches between red green and blue output faster than most people can notice.
Your camera has a rolling shutter, and sometimes the different colour bands are caught by the camera if the shutter and projector aren’t perfectly in sync. Ideally you would sync the projector and camera with the same clock, and/or use a projector that uses LCD instead of DLP.

You are correct that is is connected to the AC frequency, the refresh rate on projectors was almost always the same rate. HOWEVER, most projectors (most electronics) at this point have switch mode power supplies, which means the devices are no longer locked to the mains frequency. So most devices at this point operate internally at 60Hz, not sure if that's due to being manufactured in 60Hz countries or some other reason, but that's mostly what you'll find. Which is why your 1/60 shutter speed sync'd up. If you're getting a rolling effect at 1/60, then 1/50 should be the one that works.
1/25 probably looked OK because you were at less than half the refresh rate of the projector, no strobing, but you're catching slightly over 2 exposures from the projector, which may cause other issues.


text:
How are these type of animations done?
The best way to describe it is, off screen animations? Im not sure what its called but i need to learn this animation style!

This was possibly made in After Effects. There are several ways to achieve this.

You could make a canvas that is much larger than your comp size, parent everything together and drag it all around

You could make a large canvas, place objects around it, then add a camera, and pan/track the camera around to move to the objects outside the original screen limits.

You could manually keyframe individual objects without parenting to move the objects around.

From the look of the animation, I'd guess the foreground objects are parented, but the background grid is keyframed manually.
You can learn how to make things like this by following this old (but good) tutorial on learning after effects

source: Stack Exchange

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

sort: votes


text:
Is there a way to convert GOPRO MAX .360 files to .mp4 without using the gopro player app?
I have a gopro max camera that I use to record 360-degree VR footage. Up until now i have been using the official gopro player app to convert my .360 footage to .mp4, however, I am finding that the app really isn't that great, and from the looks of it, it could stop working due to lack of support any day.
I would like a more high-quality alternative, such as an FFMPEG command or an alternative software that supports more options, and generally works better on windows.
I've come across this site, which explains exactly what I ideally want to accomplish, however, all the commands to build the custom ffmpeg are for linux or something I'm not familiar with, and they dont work on windows: https://www.trekview.org/blog/using-ffmpeg-process-gopro-max-360/
Perhaps there is a pre-built binary of that somewhere? If not, maybe theres a way to build that on windows that I wasnt able to find? Or a different software altogether?

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


text:
Is there any workaround to set drawbox color conditionally?
i want to know if it is possible that setting drawbox color conditionally. With drawtext filter there is option -textfile which gets text value from a local file so that i can get dynamic text value with it.
I want to change box color if certain value is higher than specified condition. The below command is what i'm using for drawing text.
ffmpeg -hide_banner -fflags nobuffer -y -i - \
-filter_complex "drawtext=textfile=max_temp.txt: \
reload=16: \
x=640: y=264: fontsize=36: fontcolor=red, \
drawbox=x=640:y=300:w=640:h=480:color=red" \
...


text:
ffmpeg: Apply an expression to dynamically control intensity of lowpass, highpass, aphaser, or aecho
This is an audio question, not a video question, but hope it belongs here. I am constructing complexFilters to procedurally generate audio with ffmpeg via fluent-ffmpeg. The interesting part of my fluent-ffmpeg complex filters look like:
{
   "filter": "volume",
   "options": {
       "volume": "min(1, max(0, ((cos(PI * t * 1 / 13) * 1 + cos(PI * t * 1 / 7) * 0.5 + cos(PI * t * 1 / 3) * 0.25) +
-0.5 ) * 0.75 * -1 + 0.5))",
       "eval": "frame"
    },
    "inputs": "track_1_output",
    "outputs": "track_1_adjusted"
},

Note that I am using an expression to determine the volume dynamically. To simplify my tests, I'm constructing complexFilters on the command line to understand the mysteries of some of the lightly-documented ffmpeg filters. Here's a working CLI test of using the volume filter to fade the sources in and out according to a time-based expresssion:
# working fade in/out
ffmpeg -i knox.mp3 -i static.mp3 -filter_complex \
"[0:a] \
    volume = 'min(1, max(0, 0.5 + 0.5 * cos(PI * t / 5)))': eval=frame \
    [a0]; \
[1:a] \
    volume = 'min(1, max(0, 0.5 - 0.5 * cos(PI * t / 5)))': eval=frame \
    [a1]; \
[a0][a1]
    amix = inputs=2: duration=shortest" \
-c:a libmp3lame -q:a 2 output.mp3

Now I want to apply lowpass, highpass, aphaser, and/or aecho to the transitions using a time-based expression. For instance, looking at lowpasss, according to ffmpeg -filters it says that it has time-based support:
  T.. = Timeline support
 TSC lowpass           A->A       Apply a low-pass filter with 3dB point frequency.

How can I similarly apply a time-based expression to lowpass, highpass, aphaser, or aecho?  I thought the mix option might be the key, but I couldn't construct a working example and couldn't find any examples.
# applying a lowpass filter
ffmpeg -i knox.mp3 -filter_complex \
"[0:a] \
    lowpass=f=3000:mix='0.5 + 0.5 * cos(PI * t / 5)';" \
-c:a libmp3lame -q:a 2 output.mp3

Or if you prefer the fluent-ffmpeg filter:
const ffmpeg = require('fluent-ffmpeg');

ffmpeg('knox.mp3')
    .complexFilter([
        {
            filter: 'lowpass',
            options: {
                f: 3000,
                mix: '0.5 + 0.5 * cos(PI * t / 5)'
            },
            inputs: '[0:a]',
        }
    ])
    .audioCodec('libmp3lame')
    .audioQuality(2)
    .save('output.mp3')
    .on('end', () => {
        console.log('Processing finished successfully');
    })
    .on('error', (err) => {
        console.error('Error: ' + err.message);
    });

With the resultant error:
[Parsed_lowpass_1 @ 0x7f9a72005c00] [Eval @ 0x7ff7bec423d8] Undefined constant or missing '(' in 't/5)'
[Parsed_lowpass_1 @ 0x7f9a72005c00] Unable to parse option value "0.5 + 0.5 * cos(PI * t / 5)"
Error applying option 'mix' to filter 'lowpass': Invalid argument

What complicated fffmpeg faerie magic is needed to make some of the filters other than volume controlled by a time-based expr?


text:
How do I let OBS automatically record the active monitor?
I've got 7 monitors plugged into my computer and I'd like to do a screen recording of my workflow, but I don't want to record just one monitor or manually switch between monitors or even record all monitors at the same time.
Is there a way I can let OBS Studio automatically switch to the active monitor and record that screen?
So let's say I'm clicking and doing things on Monitor 1, then it needs to record Monitor 1... But once I move my cursor over to Monitor 2, then it automatically needs to record Monitor 2 instead of Monitor 1.
Is this possible in OBS Studio? If yes, then how?


text:
Best way to edit a football match from 2 fixed camera/video?
I've 2 camera , each one get half pitch of a football match.
Both Video starts at the same time.
I've to produce a single video taking video from one camera then other camera, based on when "ball" is (right video, or left video).
Which is fastest way to do this ?
Thanks

Best way is probably with a multicam edit. This can be done with most major video editing software, here's instructions for Premiere and DaVinci.
Essentially, it lets you see both cameras at the same time and cut between them just by selecting that camera. You can edit at the speed of the footage, or run it faster if you're comfortable.


text:
How to clean up shot with Photoshop+Davinci Resolve?
I heard about method of clean up in Davinci Resolve, not by masks or fushion, but by exporting frames as stills, cleaning in Photoshop and importing again to Davinci Resolve.
How can i do that, if my footages is .mov with Red Color gamma(it's for color grading).
When im trying to import cleaned stills to Davinci Resolve again, colors not matching
What format i need when exporting still from Davinci?
What format i need whem exporting cleaned still from Photoshop?
How to import cleaned still again to Davinci Resolve?


text:
How to add keyframes to sizing panel in Davinci Resolve?
How to add keyframes to pan, tilt, zoom rotate etc. in sizing panel in Davinci Resolve?
And how to add keyframes to Color wheels?


text:
Adding many scriptures on top of a video
I want to add scriptures embedded on top of a say meditation video like below
example
scripyures i have will be in a text file and I choose a video on youtube downloaded to my local. Now I want to add the scriptures one after the other embeded on top of video like the example above?

I would suggest using Aegisub. It's free and very easy to adjust type font and size.

appearing text, not ideal, but start to try
#!/usr/bin/python3
import random,os
with open('/tmp/1.txt', 'w') as t:
    t.write("""ffmpeg is a universal media converter. It can read a wide variety of
inputs - including live grabbing/recording devices - filter, and transcode them
into a plethora of output formats.
ffmpeg reads from an arbitrary number of input "files" (which can be regular files,
pipes, network streams, grabbing devices, etc.), specified by the -i option, and writes
to an arbitrary number of output "files",
which are specified by a plain output url. Anything found on the command line which
cannot be interpreted as an option is considered to be an output url.
Each input or output url can, in principle,
contain any number of streams of different types (video/audio/subtitle/attachment/data).
The allowed number and/or types of streams may be limited by the container format.
Selecting which streams from which inputs will
go into which output is either done automatically or with the -map option (see the
Stream selection chapter).

""")
# text lines divisible by 3

f=open('/tmp/1.lst', 'w')
d=0
ss=0
with open('/tmp/1.txt', 'r') as t:
    for t1 in t:
        t2=next(t)
        t3=next(t)
        d+=1

        # generate shrinking circles for alphamerge
        r=40 # count of circles
        a=f"""color=black:200x200,format=rgba,
geq=lum='p(X,Y)':a='if(lte(pow(X-W/2,2)+pow(Y-H/2,2),(1-T/3)*100*100),255,0)',
split={r}"""
        b="" # pads for split
        c=f"color=white:1280x300[w];\n" # scale,overlay
        ow=10 # count width of circles
        w=0
        l=40  # middle of the current line of circles
        for i in range(r):
            b=b+f"[c{i}]"
            ow=ow+w+30
            if ow>1280:
                ow=20
                l+=70 # next line of circles
            w=80+random.randint(-50,50) # random width
            h=80+random.randint(-50,50)   # random height
            oh=l+random.randint(-25,25)-h # random deviation from center of line
            c=c+f"[c{i}]scale={w}:{h}[c{i}];\t[w][c{i}]overlay={ow}:{oh}[w];\n"
        b=b+f";\n"
        s=f"""ffmpeg -ss {ss} -i input.mp4 -filter_complex "
{a}{b}{c}
color=fefefe:1280x300,
drawtext=fontcolor=white:fontsize=h/10:x=(w-tw)/2:y=(h/5-th)/2:text='{t1}',
drawtext=fontcolor=white:fontsize=h/10:x=(w-tw)/2:y=h/5+(h/5-th)/2:text='{t2}',
drawtext=fontcolor=white:fontsize=h/10:x=w/2:y=h*2/5+(h/5-th)/2:text='{t3}'[t];
[w]avgblur=10[g];
[t][g]alphamerge,
geq=lum='p(X,Y)'
:a='if(eq(lum(X,Y),234),0,alpha(X,Y))'[t];
[0][t]overlay=(W-w)/2:H-h"""
        s+=""",drawtext=text='%{eif\\\:n+1\\\:d\\\:3}'
:x=(w-tw)/2
:y=h-th
:fontsize=h/20
:fontcolor=red" """
        s+= f"""-c:v h264_nvenc -cq 20 -c:a libopus -t 5 "/tmp/{d}.mkv" -y -hide_banner"""
        print(s)

        # alphamerge text and gray circles
        os.system(s)
        f.write(f"file {d}.mkv\n")
        # os.system(f'mpv --no-config -loop=inf --volume=0 "/tmp/{d}.mkv"')
        # break # for test
        ss += 5

f.close()
os.system('ffmpeg -f concat -i /tmp/1.lst -c copy /tmp/out.mkv -y -hide_banner')
os.system('mpv --no-config -loop=inf --volume=0 /tmp/out.mkv')


text:
How to extract frames from a video using ffmpeg?
Basically I want to extract all frames from the video where the images will be resized to be 720p. All of this I know how to do. But for testing I want to extract every Nth frame. So every 30th image from a 30FPS video or every 10th image, etc. How can I do that?
Also the extracted image filenames should correspond to the frame numbers so not sure if the first frame is 0 or 1?

This is actually pretty trivial:
ffmpeg -i test.mp4 -r 1 -an -c:v mjpeg 'test%03d.jpeg'

This will extract 1 frame per second. Now we want to adjust the numbers to be frame numbers rather than just a sequence, we know that they all have leading zeros, and are 3 digits long (see %03d). Therefore we can do:
for f in test*.jpeg; do num=${f:4:3}; let newnum=$((10#$num))*60; newname="${f/$num/$newnum}"; mv $f $newname;  done

This assumes that the original frame rate was 60, we just multiply every number by that value. If your case has a different original frame rate, change that.


text:
Unreasonably very slow playback of animations in Fusion in Davinci Resolve
I worked quietly in my project, made an effect for the text, copied it to other parts. And then suddenly the Waviness node plays as if I have 4 fps, but the framerate is all 60. Checked with other nodes - everything is the same. Even when rendering, I see that the background goes smoothly, but it is the effects from Fusion are played very slowly and frame by frame. Please help!


text:
FFmpeg padding with different colors
I have the following ffmpeg command:
ffmpeg -f concat -i inputs.txt -vf "scale=iw*min(1920/iw\,1080/ih):ih*min(1920/iw\,1080/ih),pad=1920:1080:(1920-iw)/2:(1080-ih)/2:black" output.mp4

This command collects a bunch of different videos (specified on inputs.txt), scale them to 1920x1080 and pad the empty areas with black. This works perfectly as-is, regardless of the size of my inputs.
Now, I want to have different colors for the padding areas, for example "red" on the left side and "blue" on the right side, instead of full back on both sides. Is that even possible with ffmpeg? How?

overlay on picture → ffmpeg -f concat -safe 0 -i /tmp/1.txt -vf " color=red:640x720[l]; color=blue:640x720[r]; [l][r]hstack[b]; [0]scale=1280:720:force_original_aspect_ratio=decrease, pad=1280:720:-1:-1:black@0, setsar=1[f]; [b][f]overlay=shortest=1 " /tmp/out.mp4

authors: Баяр Гончикжапов


text:
ffmpeg fixed video noise reduction
I have a camera with a fixed noise (video sample). Is it possible to remove this noise completely using ffmpeg?
I tried ffmpeg "-vf" noise reduction but didn't find any way to remove the noise by supplying a noise mask.


text:
How to mute parts of the video without using professional software?
I want to eliminate some of the swearing in the video and leave the rest untouched. I don't want to cover the swearing with other sounds, just mute the swearing. That's the only thing I need, and I'm a novice at video editing.
I only have a laptop with an AMD RYZEN 5600 cpu so I may not be able to run professional software. Online tools or simple software may be better.
Thank you for your patience in reading my question.

are you running windows? You need some video editing software. Capcut, Davinci Resolve, Premiere, or something else


text:
Side of the video got cropped after stabilization. How to tell Davinci Resolve not to do that?
I'm stabilizing a vertical video. Somehow, the side of the video always got cropped. I don't think it should be since the new video is 1080p. If you see the screenshot below, I marked the cropped area yellow. How to tell DaVinci Resolve not to do that? Thanks.


text:
Need to convert Adobe premiere project files from *.ppj to *.prproj, that is can I upgrade the file to open in Adobe PremierePro 2023
I have tried to access an early version of Premiere, but failed. The current file structure (*.ppj) of my older projects (pre-CS6) is not supported in any of the PremierePro suite, but fundamentally the .ppj file is, or appears to be, similar to an xml. Is there a method of changing the file so that it can be read in either PremierePro 2023 or Da Vinci Resolve 18?


text:
kdenlive renders choppy video
I've just started trying out kdenlive and I can't get it to render nice smooth video output to the same quality as my input.  No matter how high I set the quality settings the rendered video I get from kdenlive is really choppy, much less smooth than my input.  Could this be an unavoidable problem with something Melt is doing to the video before it even gets to ffmpeg?

I had the same issue and I simply copied the exported video into a different location (I don't know if the location is important) and it fixed it instantly. No clue why this worked but hey, I'll take the win.


text:
Complex audio mixdowns and mappings with FFmpeg
Looking for a way to use FFmpeg to take a single video file with 10 - 20 audio tracks and generate a series of video copies each with a different configuration of audio mixing and mapping.
For example
Say we have an Input.mxf where audio 1-8 is dialogue (each mono), 9-16 is SFX (each mono), 17-20 is temp music (odds are stereo left, evens are stereo right), 21-24 is final score (again, odds are left, evens are right)
We want to create an Output.mov with 4 audio tracks where a1 = Dialogue, a2 = SFX, a3 = Music (final only, stereo left), a4 = (Music, final only, stereo right), and temp music gets ignored.
Is there an FFmpeg command that could that could generate the Input.mov from the above Output.mxf?
I've tried a few -filter_complex and -map approaches including amix, amerge, join, pan etc etc.  Looking for a logic that can achieve any audio config that can be dreamed up.


text:
How to encode aac_at with variable bit rate
What options are there to encode at variable bit rate with aac_at?
aac_at seems to be the best aac encoder. I have used it to convert opus audio (because macOS older than Sonoma do not support opus) in some movies as CBR aac with something like:
ffmpeg -i movie.mkv -c:v copy -c:a aac_at -b:a 128k movie.mp4

Some sources recommend using VBR for better quality. But there are few examples how to do it.
This seems to work OK:
ffmpeg -i movie.mkv -c:v copy -c:a aac_at -aac_at_mode vbr -q:a 2 movie.mp4

-q:a range is 0-14. With my sample movie according to MediaInfo -q:a 0 and 1 output CBR at 152 kb/s and 132 kb/s, with 2 VBR average 116 kb/s, with 4 VBR average 66 kb/s and with 14 VBR average 27 kb/s (all VBR max at 128 kb/s).
https://wiki.hydrogenaud.io/index.php?title=Apple_AAC


text:
Trimming a video using FFmpeg leads to black screen
I try to figure out how to use FFmpeg to trim videos. I have created a 30 second .mov screen capture using Apple's QuickTime player, and then tried to trim it using three different ways:

Using -copyts, without re-encoding
ffmpeg -copyts -ss 00:00:10 -i input.mov -to 00:00:15 -map 0 -c copy output.mov

Using -copyts, with re-encoding
ffmpeg -copyts -ss 00:00:10 -i input.mov -to 00:00:15 -c:v libx264 -crf 23 -c:a aac -b:a 192k output.mov

Using -trim (with re-encoding, which is the only option):
ffmpeg -i input.mov -vf trim=10:15 output.mov

No matter which approach I tried, the output video is always 15 seconds long and the first 10 seconds of that is just a black screen, whereas what I expected is a 5-second video and without the black screen.
All the three solutions are from here: https://superuser.com/questions/377343/cut-part-from-video-file-from-start-position-to-end-position-with-ffmpeg (answers by @slhck and @malat), and are very high-voted, so I expect they should work without issues, but they don't. Why is that? Is there a problem with the commands, or with the video?
The video is uploaded here: https://github.com/jsx97/test/blob/main/input.mov

from doc: -copyts → Do not process input timestamps, but keep their values without trying to sanitize them. In particular, do not remove the initial start time offset value. If use trim, add setpts -vf trim=10:15,setpts=PTS-STARTPTS

@БаярГончикжапов That is, if using -copyts, this is a natural behavior? Then this is somewhat strange that "how to trim a video using FFmpeg" solutions , which are often based on -copyts, don't mention this "black screen" issue.

maybe, it can be used to syncronize videos from surveillance cameras

@БаярГончикжапов And when you need to trim a video, which approach you use yourself, -trim or something else?

mostly, ffmpeg -ss 5 -to 15 -i in out

authors: Баяр Гончикжапов


text:
Proper timestamps for videos
I am trying to combine a set of videos from different people and therefore from different smartphones into a single folder of files, so that they can be viewed together in a chronological order.
For pictures, this is easy, all pictures I encountered have the DateTimeOriginal timestamp, which works well. For videos, not so much. I used exiftool -G1 -a -s to extract the metadata.
I came to the conclusion, that QuickTime:CreateDate and QuickTime:ModifyDate are the tags I need to investigate. There are also Track1..x:CreateDate and Track1..x:ModifyDate but which all seem to inherit their date from the QuickTime values. My Samsung phone sorts videos by the QuickTime:CreateDate timestamp.
Now the issue: for the android devices, the CreateDate and ModifyDate are identical. Both timestamps reflect the time, when the video recording ended. However both android devices have the record start date in their filenames, which is not present in the metadata.
The iPhone stores the record start time in CreateDate and the record end time in ModifyDate. Honestly, this seems to be the proper way to me.
The question: is there a proper way to set the timestamps in the metadata? I'd say, that the iPhone is doing it right, whereas the android devices don't. I can set the CreateDate for the android videos to the record start date by subtracting the duration of the video.

You can check movie times with:
exiftool -a -G1 -s -fileOrder5 FileName -api LargeFileSupport=1 -api QuickTimeUTC=1 -Time:All .

Usually movie's internal metadata 'QuickTime:CreateDate' sets the date and time. It should be UTC and that commands reports it using the computer's time zone location (standard time New York EST -05:00, Berlin +01:00, for example). DST for that date is also automatically set (daylight saving time New York EDT -04:00, Berlin +02:00, for example).

If present, the following internal metadata tags override previously mentioned time or time zone, and the time zone might affect sorting up to ±12 hours if it happens to be present in some movie (in macOS 14 Sonoma Photos.app, YMMV):

GPS location in 'Keys:GPSCoordinates' or 'UserData:GPSCoordinates' sets the time zone. Keys overrides UserData if both exist (Photos ignores this UserData tag in .mp4 and .m4v).

Date in 'Keys:CreationDate' or 'UserData:DateTimeOriginal' sets the time and time zone, and it overrides all other time and time zone tags above. Keys overrides UserData if both exist (Photos ignores this UserData tag in .mov). iOS (8.4)-9 and newer inserts 'Keys:CreationDate' to its movies.

For example:
[MacOS]         FileCreateDate                  : 2001:01:01 12:00:00-05:00
[System]        FileModifyDate                  : 2001:01:01 12:00:00-05:00
[QuickTime]     CreateDate                      : 2001:01:01 12:00:00-05:00
[UserData]      DateTimeOriginal                : 2001:01:01 12:00:00-05:00
[Keys]          CreationDate                    : 2001:01:01 12:00:00-05:00
[UserData]      GPSCoordinates                  : 40.74842 -73.98561 443.2
[Keys]          GPSCoordinates                  : 40.74842 -73.98561 443.2

See also:
https://discussions.apple.com/docs/DOC-250002750


text:
the "non-monotonic DTS in output stream " error while concatenation even after reencoded input files
hi I am trying to write a Python program that is trying to first edit different videos separately under the heading "intro" "story" and "byte" with the help of FFmpeg and Python subprocess module and then concatenate them in the function named "bind". At first, I encountered this "Non-monotonic DTS in output stream" then i reencoded the input files before concatenating them but i am still getting this error
code
def bind():

bunch = ["final_intro.mp4","final_story.mp4","finalbite.mp4"]
new_bunch =[]
for video in bunch:
    name = f"re_{video}"
    re_command =[
        "ffmpeg", "-y",
        "-i", video,
        "-c:v", "libx264",
        "-c:a", "aac",
        "-strict", "experimental",
        "-b:a", "192k",
        name
    ]
    subprocess.run(re_command)
    new_bunch.append(name)

with open("concat_list_final.txt", "w") as f:
    for video in new_bunch:
        f.write(f"file '{video}'\n")

command_final = [
    "ffmpeg", "-y",
    "-f", "concat",
    "-safe", "0",
    "-i", "concat_list_final.txt",
    "-c", "copy",
    "done.mp4"
]
subprocess.run(command_final)
for video in new_bunch:
    os.remove(video)
os.remove("concat_list_final.txt")

return "done.mp4"

for reference this is the error messages :-
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x14cf16040] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0x12ce06880] Non-monotonic DTS in output stream 0:0; previous: 152933, current: 127760; changing to 152934. This may result in incorrect timestamps in the output file.
[mp4 @ 0x12ce06880] Non-monotonic DTS in output stream 0:0; previous: 152934, current: 128272; changing to 152935. This may result in incorrect timestamps in the output file..........

maybe, different time base (tbn), if so, try to change temporary outputs ext to mkv or add -video_track_timescale 24000 or what, before name. Or use concat filter

authors: Баяр Гончикжапов


text:
How to move a connected audio clip into the primary timeline?
The following works:

add audio clips from the browser to the primary timeline

The following works:

drag and edit audio clips already in the primary timeline

However, I'm unable to:

move audio clips that are connected to the primary timeline, into the primary timeline

I've tried various things like, creating a compound clip from the connected audio clip,then dragging that into the primary timeline, then breaking that apart, but when I break it apart, the audio straight away leaves the primary timeline (leaving a grey 'gap' generator in its place).
I want my video clips to be attached to my audio clips. I could create a secondary timeline from my audio clips, but I don't see a way to attach video clips to the secondary audio timeline? So, when I edit the audio, the video clips all becom out of sync, and have to move each of the video clips, one by one...
The worst case is to drag each of the audio clips, one by one, from the browser, into the primary story line, and re-edit them. But this will take forreevvver. (unless there's a quick way to do this, keeping the original edits, timings, relative positions, etc?)
Thoughts?


text:
I have two near identical compound clips. One gives me the option to break apart. One does not. Why?
I have two near identical compound clips. One gives me the option to break apart. One does not. Why?
Screenshots show both clips. They are the same compound...


text:
How to replace a clip in the timeline with another near identical clip, maintaining in-out points?
How to replace a clip in the timeline with another near identical clip, maintaining in-out points?
Let's say I have a 2 minute clip, call it One. The timeline shows the clip at 5:00, with in and out points set to 0:30 and 0:40 respectively.
I want to replace clip One with clip Two, that is also 2 minutes. I want to keep the same in-out points as One. How to do this?
FCPX appears to provide the following options:

"Replace": replaces the clip with the new clip. Sets the in-out points on the new clip to show the entire clip, all 2 minutes of it
"Replace from start": maintains the length of the clip in the timeline. Sets "In" to 0:00. Sets "out" so that the clip takes the same time as before, in this case will be "0:10"
"Replace from end": as for 'replace from start', but now the "out" will be set to 2:00, and the "in" will be set to 1:50
"replace with retime to fit". makes the new clip play at very high speed, so that it fits in the same time on the timeline (from 5:00 to 5:10), even though out is now set to 0:00, and out is set to 2:00
thee seems no option to replace the clip, preserving the in-out positions?


text:
How can I use ffprobe inside a batch file to detect if below 720p?
My plan is to write a recursive searching batch file, that will search for video files below 720p, store their full paths, and then at the end of the search, start upscaling those videos.
But first how can i via ffprobe detect if said file is below 720p in preset, not sure if that is the correct terminology.
Thanks.


text:
Video width&height is horizontal but video frames are vertical. How to fix it with ffmpeg?
I have a video, that when checked with ffmpeg/ffprobe shows a horizontal aspect ratio.
ffprobe.exe my_video.mp4 -show_streams -of json
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'my_video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf60.16.100
  Duration: 00:06:50.04, start: 0.000000, bitrate: 15240 kb/s
  Stream #0:0[0x1](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: hevc (Main) (hev1 / 0x31766568), yuvj420p(pc, bt709), 3072x1728, 15044 kb/s, 25 fps, 25 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    "streams": [
        {
            "index": 0,
            "codec_name": "mp3",
            "codec_long_name": "MP3 (MPEG audio layer 3)",
            "codec_type": "audio",
            // ...
        },
        {
            "index": 1,
            "codec_name": "hevc",
            "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
            "profile": "Main",
            "codec_type": "video",
            "codec_tag_string": "hev1",
            "codec_tag": "0x31766568",
            "width": 3072,                  <-----------
            "height": 1728,                 <-----------
            "coded_width": 3072,
            "coded_height": 1728,
            //...
        }
    ]
}

But the frames are in fact vertical:
ffprobe.exe my_video.mp4 -show_frames -of json
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'my_video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf60.16.100
  Duration: 00:06:50.04, start: 0.000000, bitrate: 15240 kb/s
  Stream #0:0[0x1](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: hevc (Main) (hev1 / 0x31766568), yuvj420p(pc, bt709), 3072x1728, 15044 kb/s, 25 fps, 25 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
    "frames": [
        {
            "media_type": "video",
            "stream_index": 1,
            "key_frame": 1,
            "pts": 0,
            "pts_time": "0.000000",
            "pkt_dts": 0,
            "pkt_dts_time": "0.000000",
            "best_effort_timestamp": 0,
            "best_effort_timestamp_time": "0.000000",
            "pkt_duration": 3600,
            "pkt_duration_time": "0.040000",
            "duration": 3600,
            "duration_time": "0.040000",
            "pkt_pos": "44",
            "pkt_size": "577224",
            "width": 1728,                              <------------------
            "height": 3072,                             <------------------
            "pix_fmt": "yuvj420p",
            "pict_type": "I",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0,
            "color_range": "pc",
            "color_space": "bt709",
            "color_primaries": "bt709",
            "color_transfer": "bt709",
            "chroma_location": "left",
            "side_data_list": [
                {
                    "side_data_type": "Mastering display metadata",
                    "red_x": "3000/50000",
                    "red_y": "16500/50000",
                    "green_x": "15000/50000",
                    "green_y": "7500/50000",
                    "blue_x": "32000/50000",
                    "blue_y": "30000/50000",
                    "white_point_x": "15635/50000",
                    "white_point_y": "16450/50000",
                    "min_luminance": "0/10000",
                    "max_luminance": "0/10000"
                }
            ]
        },
        ...

How can I fix the streams metadata (using FFmpeg) to have vertical aspect ratio without reencoding the video?

Edit 1:
When the video stream is extracted, e.g. with ffmpeg -i my_video.mp4 -c copy my_video.265, the frames appear to be horizontal (i.e. ffprobe.exe my_video.265 -show_frames -of json shows width: 3072 and height: 1728) but the stream is corrupted and playback shows green frames with decoding artifacts.


text:
Some mp4 files converted with ffmpeg are off by .01 frames/second, how can I fix this (without resampling)
I have several mp4 files with a frame rate of 119.88 frames/second, I need to convert these to 29.97 frames/second without resampling.
To do this, I ran
ffmpeg -itsscale 4 -i input.mp4 -c copy output_con.mp4

However, some of these files return with a frame rate of 29.98 frames/second, this is messing me up in later analyses by throwing off some cross correlations between the mp4 files and related wav files. Any insight into how to remedy this would be much appreciated!


text:
how to make ffmpeg process all images with gaps in the file names?
I have a bunch of jpg-images from a time lapse project in one directory. The file names have all the same patters, but there are gaps in the numbering. How can I make ffmpeg process all images in ascending order from the directory?


text:
HDMI->Thunderbolt alternatives to BMD Ultrastudio 3G?
My computer setup has a thunderbolt dock (Caldigit TS4) which also has USB ports, a DSLR camera with HMDI output (Sony A5100).
I originally had an Elgato Calming 4k which is a HDMI-USB3 device. It was never reliable on my setup, and I couldn't get it to work via the dock.
I then moved to a BlackMagic Design UltraStudio 3G Recorder which is a HDMI-Thunderbolt-3 device. Worked much better and through the Thunderbolt dock too.
I am told that with Thunderbolt, I also benefit from the throughout not struggling with 1080p@30fps or 1080p@60fps, whereas USB-3 apparently struggles.
Question: I had to sell the BMD UltraStudio 3G Recorder, but am now ready to buy another capture device. I'm asking for options, and doing internet searches seems to find no similar HDMI->ThunderBolt devices.
Notes:

I can't use a capture card that I need to install internally like a PC graphics card, I'm using a MacBook pro so it must be a device that connects, rather than installs.

I would prefer a HDMI-Thunderbolt-3/4 that will plug into the dock.

The BMD UltraStudio 3G Recorder has SDI input. I don't need this, and am hoping an alternative device is smaller, cheaper.

I did have another problem with the BMD. It doesn't present as a USB-VC class device and so lots of software would not work with it.


text:
Adding a roving watermark in Premiere?
I want to add a watermark that follows a defined path around the screen throughout the whole video, kind of like the logo in this video youtube.com/watch?v=QOtuX0jL85Y (although that path is random).
The goal is so it cannot easily be blurred.
Is there a free plugin or technique that lets you set a path for the watermark to follow?
Using Premiere 2022 fyi.
Thanks!

I suggest you don't really need a plugin to do this:

Add your logo to a sequence
Move it to the first position where you want it to appear
Add a position keyframe
Continue through the sequence, moving the image to different positions on screen
After a minute or so, copy the first position keyframe to the end of your one minute sequence.
Nest your sequence
Copy the nested sequence
Go to the beginning of your nested sequence, and paste repeatedly until your sequence fills the duration you need.

You could then nest this sequence, to make it easier to manage as a single block.
Move it to a track above your footage.
Adjust opacity and/or blend mode to taste.


text:
How to get rid of recorded commercials from a video file, using ffmpeg or mlt?
I have a problem with video editing and unsynchronized sound.
What I'd like to achieve:
a) I have a TV tuner, with recording ability. So I have a long .mts file.
b) The file consists of both movie, and commercials. I'd like to cut all the commercials out, and get a movie in .mp4 file (h264, or h265 - it does not matter that much).
--- Part 1 ---
What I do right now:

I get the .mts file, and check it in VLC player.
I do it to find the time moments, when commercials start and stop.
I cut the .mts file into pieces, using the command:

ffmpeg -ss <START_MOMENT> -i <FILE> -t <DURATION> -c copy <OUTFILE>.mts > /dev/null 2>&1
In this way, I usually end up with three parts of the video I'd like to achieve.

Having the separated parts (all in the .mts format), I concatenate them:

ffmpeg -f concat -safe 0 -i toconcat.txt -c copy <DEST_FILE>.mts

Then, as the final step, I encode (and, thus, shrink) the file:

ffmpeg -i <CONCATENATED_FILE>.mts -c:v libx264 -preset fast -crf 25 -c:a aac -b:a 128k <TARGET_VIDEO>.mp4
The problem is: in the final .mp4 file, audio is out of sync. After each "junction", the audio gets (more or less) ahead of video. Sometimes the problem is barely noticable, and sometimes it is very annoying.
--- Part 2 ---
I have also thought about some alternative way to solve the problem of "picking up" video fragments of the .mts file:

Find out the frames numbers of video fragments (without commercials).

I could do it by:
a) add frames numbers to the video
ffmpeg -i <INPUT_FILE> -vf "drawtext=fontfile=Arial.ttf:text='%{frame_num}':start_number=0:x=(w-tw)/2:y=h-(2*lh):fontcolor=white:fontsize=50:" -c:a copy <OUT_FILE>
b) check the numbers in some video player

Use MLT framework to make a movie from the original .mts file, by using the found fragments (identified by the frame numbers).

I'm not sure, which method would be the best in order to obtain the video without commercials, and with properly synchronized audio.

bash script, concat filter
#!/bin/bash
f="/tmp/in.mp4"
o="/tmp/output.mp4"
if [ ! -f "$f" ]; then
#create test video with keyframes every 75 frames
ffmpeg -lavfi "testsrc2=1280x720;sine=440:1:48000" -g 75 -t 32 "$f" -v 24
ffprobe -select_streams v:0 -skip_frame nokey -show_entries frame=pts_time -of default=nw=1:nk=1 "$f" -v 24
fi

# create list of times
echo "0 5
10 15
20 25
" > /tmp/1.txt

inp=()
i=0
c=""
while read -r ss to; do
  if [ "$ss" != "" ]; then
    inp+=("-ss" $ss "-to" $to "-i" "$f")
    c+="[${i}:v][${i}:a]"
    ((i++))
  fi
done < /tmp/1.txt
ffmpeg "${inp[@]}" -lavfi "${c}concat=$i:1:1" -c:v libx264 -preset fast -crf 25 -c:a aac -b:a 128k "$o" -y
mpv --no-config --osd-fractions --osd-level=2 --keep-open "$o"


text:
Does HEVC/H.265 "slower" preset introduce artefacts?
I have been experimenting with HEVC/H.265 compression parameters to find a sweet spot balance between file size and quality for a 1080p/H.264 recording of a festival with lots of details and flashing/strobing dynamics going on in the picture.
Specifically, I was comparing the "slow" and "slower" presets at CRF 24.
The "slower" preset took roughly twice as longer to encode and produced only about 1% smaller file size than "slow". I expected the quality to be at least not worse.
To my surprise, the "slower" preset introduced some noticeable artefacts in the picture which "slow" did not.
Here is a 200x150 px chunk of a frame from the original stream (showing crowd before the stage at night time):

Same encoded with "slow":

Same encoded with "slower":

It may be hard to spot any difference at first glance, so I repeat the latter showing where to look:

— see there is a tiny dot of light which is not visible in either the original or the "slow" encodings. This is just one example. The entire frame featured more of these new light dots (or other artefacts) which HEVC seemingly introduced on its own.
Why is HEVC doing that when using the "slower" preset? Is that a bug? Is it applying some fancy opportunistic or heuristic prediction of what it thinks should be on the picture?
ffmpeg params I used:
-c:v libx265 -x265-params log-level=error -crf 24 -preset slower

Version:
ffmpeg -version
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.27)
configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-version3 --pkg-config-flags=--static --disable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100


text:
Green screen on RTSP stream from USB camera using mediamtx (ffmpeg)
I need to cast a stream from a USB camera via RTSP as stable as possible (at any moment i need to be able to get a static picture on a remote host, reflecting the real state of affairs in front of the camera) and economically on the used resources (the hardware is very weak).
Trying to write mjpeg to rtsp only displays green screen
Camera information:
[dshow @ 000001e6a938b880] DirectShow video device options (from video devices)
[dshow @ 000001e6a938b880]   vcodec=mjpeg  min s=1280x720 fps=30 max s=1280x720 fps=30
[dshow @ 000001e6a938b880]   vcodec=mjpeg  min s=640x360 fps=30 max s=640x360 fps=30
[dshow @ 000001e6a938b880]   vcodec=mjpeg  min s=640x480 fps=30 max s=640x480 fps=30
[dshow @ 000001e6a938b880]   vcodec=mjpeg  min s=848x480 fps=30 max s=848x480 fps=30
[dshow @ 000001e6a938b880]   vcodec=mjpeg  min s=960x540 fps=30 max s=960x540 fps=30
[dshow @ 000001e6a938b880]   pixel_format=yuyv422  min s=160x120 fps=30 max s=160x120 fps=30
[dshow @ 000001e6a938b880]   pixel_format=yuyv422  min s=320x180 fps=30 max s=320x180 fps=30
[dshow @ 000001e6a938b880]   pixel_format=yuyv422  min s=320x240 fps=30 max s=320x240 fps=30
[dshow @ 000001e6a938b880]   pixel_format=yuyv422  min s=424x240 fps=30 max s=424x240 fps=30
[dshow @ 000001e6a938b880]   pixel_format=yuyv422  min s=640x360 fps=30 max s=640x360 fps=30
[dshow @ 000001e6a938b880]   pixel_format=yuyv422  min s=640x480 fps=30 max s=640x480 fps=30

Mediamtx output output:
ffmpeg version 6.1.1-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, dshow, from 'video=Integrated Webcam':
  Duration: N/A, start: 152089.739306, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 30 fps, 30 tbr, 10000k tbn
2024/06/28 14:58:55 INF [RTSP] [conn [::1]:36681] opened
2024/06/28 14:58:55 INF [RTSP] [session f3037426] created by [::1]:36681
2024/06/28 14:58:55 INF [RTSP] [session f3037426] is publishing to path 'camera01', 1 track (M-JPEG)
Output #0, rtsp, to 'rtsp://localhost:8554/camera01':
  Metadata:
    encoder         : Lavf60.16.100
  Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, q=2-31, 30 fps, 30 tbr, 90k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
2024/06/28 14:59:00 INF [RTSP] [conn 127.0.0.1:36683] opened=N/A
2024/06/28 14:59:00 INF [RTSP] [session 0462ceb2] created by 127.0.0.1:36683
2024/06/28 14:59:00 INF [RTSP] [session 0462ceb2] is reading from path 'camera01', with UDP, 1 track (M-JPEG)

runOnInit in mediamtx.yml:
FFmpeg -hwaccel_output_format qsv -fflags nobuffer -f dshow -vcodec mjpeg_qsv -s 640x480 -i video="Integrated Webcam" -vcodec copy -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH

Thank you for your help


text:
FFMPEG recorded video not playable in browser on mobile phone (Android/iPhone)
I am facing a problem which seems to be a common one; my recorded videos using ffmpeg on raspbian is not playable in any mobile browser (android and iphone).
ffmpeg -loglevel quiet -input_format mjpeg -i $1 -preset ultrafast video.mp4

$1 is /dev/video0

The output of ffprobe of the recorded video is:
ffprobe version 6.0-full_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, 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-libaribb24 --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-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '..\videos\1_1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.5.100
  Duration: 00:00:36.10, start: 0.016016, bitrate: 11896 kb/s
  Stream #0:0[0x1](und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuvj422p(pc, bt470bg/unknown/unknown, progressive), 1920x1080, 11894 kb/s, 60 fps, 60 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]

I have already tried multiple possible solutions like pix_fmt etc but it didnt work. The device under /dev/video0 deliveres mjpeg.
Thank you very much in advance!

please, try:
ffmpeg -loglevel quiet -input_format mjpeg -i "$1" -c:v libx264 -preset ultrafast -profile:v main -pix_fmt yuv420p -movflags +faststart video.mp4

explanation:
"$1" - the use of quotation marks to better handle whitespace in directory names and paths.
-c:v libx264 - to force the use of x264.
-profile:v main - to force compatibility with Android 6 or higher according to documentation provided by xer-rex
-pix_fmt yuv420p - to force the 8-bit color standard accepted on most devices.
-movflags +faststart - to move muxer information to the beginning of the file and thus allow "instant" execution in web scenarios.
see: ffmeg/h.264 jellyfin/codec-support android/supported-formats
_o/

Supported media formats mentions a baseline profile, the ffmpeg encode command should have
-c:v libx264 -crf 23 -profile:v baseline -level 3.0 -pix_fmt yuv420p

The main problem is in the profile (which limits the set of compressing algorithm). You didn't use the -profile option, so the (default) x264 encoder automatically selects one for you.
In your case, this automatically selected profile is not appropriate for your device, because it obviously enables enhanced compression algorithms for which there is no appropriate decoder in your (maybe older or modest) device.
So change this option to the simplest one: -profile:v baseline. After a successful result, you may try the more advanced profile: -profile:v main to obtain a smaller-sized output.
Next, change your preset from ultrafast (which produces a very large output file — possibly another difficulty for your slower device, because it may require higher speed for decoding frames) to something more appropriate —  as medium (which is the default one, so you may omit your -preset ultrafast option) or slow.


text:
Ffmpeg error: amv files only support 2 streams?
I'm using ffmpeg to convert videos to amv format. Most of the time it works fine.
Sometimes I get the error: amv files only support 2 streams.
How can I fix this?
Thanks


text:
ffmpeg - marking frames
I use this command to mark each frame with a green mark:
ffmpeg -i "F:\Avatar\film3\film.mp4" -vf "drawbox=x=0:y=0:w=5:h=3:color=green:t=fill" "F:\Avatar\film3\output_with_markers3.mov"
Please, tell me, how can I make a similar marking, but only for each even frame? Odd frames must remain unmarked.
I tried to do this:
ffmpeg -i "F:\Avatar\film3\film.mp4" -vf "select='(mod(n,2))', drawbox=x=0:y=0:w=5:h=3:color=red:t=fill" "F:\Avatar\film3\output_with_markers3.mov"
But the unmarked frames do not remain in the final video.

use enable option → ...en:t=fill:enable='mod(n,2)'" ...

authors: Баяр Гончикжапов


text:
Resuming ffmpeg hls trancoding from an existing segment
I'm setting up a service to transcode input videos, generally MP4, for HLS. This currently works fine when starting from scratch, but I would like the transcode to be resumable in case the service crashes while working on a longer video.
I'm running into two issues with resuming the transcoding process:

ffmpeg generates too many segments: if the processing is halted at, say, 10 segments for a video that should be 20 segments long and processing is resumed later, the manifest contains 10 + 20 segments, where the final 10 segments don't actually play back properly
Adjacent to this, running the command again when the video is fully transcoded results in the playlist being appended with the entire video once more, with the numbers above that would result in 20 additional segments being added to the playlist every time the conversion is ran. In other words, ffmpeg doesn't realize the transcoding is already complete

The desired result here is that running the ffmpeg command again simply continues the transcode after the last completed segment and appends these segments to the m3u8 playlist. If all the segments are already present ffmpeg should not output or modify anything. I've tried to coax ffmpeg into this behaviour, but no combination of -start_number, -ss and append_list gets me there.
Here's my current command that is executed when a transcode should be resumed (I've ommited some filters for brevity):
ffmpeg -i input -map 0:v -map 0:a -map 0:v -map 0:a -map 0:v -map 0:a \
-c:v libx264 -preset veryfast -c:a libfdk_aac \
-maxrate:v:0 1500K -b:a:0 128k \
-maxrate:v:1 3000K -b:a:1 192k \
-maxrate:v:2 6000K -b:a:2 256k \
-flags +cgop -g 60 -hls_time 5 -hls_list_size 0 \
-hls_flags independent_segments+temp_file+append_list \
-var_stream_map "v:0,a:0,name:480p v:1,a:1,name:720p v:2,a:2,name:1080p" \
-y -f hls -master_pl_name master.m3u8 ./%v.m3u8

Here is the folder structure that ffmpeg would work in for a resumed transcode, assuming the service crashed after the first two chunks:
.
├── 1080p.m3u8
├── 1080p0.ts
├── 1080p1.ts
├── 480p.m3u8
├── 480p0.ts
├── 480p1.ts
├── 720p.m3u8
├── 720p0.ts
├── 720p1.ts
├── input
└── master.m3u8

Here is the contents of 480p.m3u8:
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXT-X-ENDLIST

However, as explained in the prelude, running the command against this folder results in too many chunks being appended to the playlist.
This is the expected 480p playlist:
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXTINF:5.000000,
480p2.ts
#EXTINF:5.000000,
480p3.ts
#EXTINF:5.000000,
480p4.ts
#EXTINF:5.733333,
480p5.ts
#EXTINF:5.000000,
480p6.ts
#EXTINF:5.000000,
480p7.ts
#EXTINF:5.000000,
480p8.ts
#EXTINF:5.000000,
480p9.ts
#EXTINF:5.000000,
480p10.ts
#EXTINF:5.000000,
480p11.ts
#EXTINF:5.000000,
480p12.ts
#EXTINF:3.950000,
480p13.ts
#EXT-X-ENDLIST

And this is the actual playlist:
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXT-X-DISCONTINUITY
#EXTINF:5.000000,
480p2.ts
#EXTINF:5.000000,
480p3.ts
#EXTINF:5.000000,
480p4.ts
#EXTINF:5.000000,
480p5.ts
#EXTINF:5.000000,
480p6.ts
#EXTINF:5.733333,
480p7.ts
#EXTINF:5.000000,
480p8.ts
#EXTINF:5.000000,
480p9.ts
#EXTINF:5.000000,
480p10.ts
#EXTINF:5.000000,
480p11.ts
#EXTINF:5.000000,
480p12.ts
#EXTINF:5.000000,
480p13.ts
#EXTINF:5.000000,
480p14.ts
#EXTINF:3.950000,
480p15.ts
#EXT-X-ENDLIST

I've already surmised the #EXT-X-DISCONTINUITY tag can't be disabled, which is fine, as I can remove that with post-processing steps. The two extra segments are problematic however, as they break the video at the end of its actual runtime.
To bring this to a point: is there a way to get ffmpeg to resume transcoding from the last segment, such that it does not append the entire video to the last transcoding attempt?


text:
Extracting a part of a video with ffmpeg, without reencoding, the output is choppy, how to avoid this?
I extract the part from 2:00 to 3:30 of a video with ffmpeg:
ffmpeg -i input.mp4 -ss 120 -t 90 -vcodec copy -acodec copy output.mp4

It works but the output video is jerky/choppy, i.e. not really smooth/fluid. The log I have is:
[mp4 @ 000000000041c700] track 1: codec frame size is not set
[mp4 @ 000000000041c700] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mp4 @ 000000000041c700] pts has no value
     Last message repeated 7894 times

When watching the original video and navigating to 00:02:00.000, the video is perfectly fluid/smooth. How to fix this?
The reason might be that (see here):

A video stream consists of chunks of video [...] At the start of each chunk is a keyframe, which contains the entire frame, and then the subsequent frame data consists of changes to the previous image.
When you use -c:v copy -ss 123.45, chances are the timestamp you're specifying doesn't coincide with a keyframe, and so your resultant video will assume a black keyframe and the subsequent frame changes will not make much sense, hence giving a choppy output.

What solution is there, without reencoding?
Maybe: a flag in ffmpeg in addition to -ss 123.45 to ask ffmpeg to keep all the data since the previous keyframe and a flag in the video to say "the video should begin at 123.45".
TL;DR: the output MP4 might contain data from 118.28, but with a flag to begin the playback only at 123.45.


text:
Use ffmpeg to play UDP stream and also analyze with ffprobe simultaneously
I have a UDP stream that I have running using ffmpeg that I want to see video on the client/player side
ffplay udp://127.0.0.1:51234?localaddr=127.0.0.1

along with the metrics using ffprobe. If I play with ffplay and try to run with ffprobe
ffprobe -show_streams -show_format "udp://127.0.0.1:51234?localaddr=127.0.0.1"

I get the error:
[udp @ 0000019319aef480] bind failed: Error number -10048 occurred
udp://127.0.0.1:51234?localaddr=127.0.0.1: Unknown error

Is this possible with the -tee command in ffmpeg? If not, is there a script that I could use to achieve this?


text:
How to create proxies for Davinci Resolve Dolby Vision Video?
I'm working with 8K Canon RAW footage and need to perform color grading for a Dolby Vision project in DaVinci Resolve. Given the massive file sizes and high-resolution, my system struggles with smooth playback and editing. I understand that creating proxies can help, but I'm unsure of the best approach to generate and use these proxies effectively within DaVinci Resolve while ensuring the final output meets Dolby Vision standards.
These are my current settings

This is after color grade

This is after Export


text:
What parameters do I use for ffmpeg to encode video for a Playstation 4 so that both video and audio work even in PSVR
I have seen parameters that work for video but the audio does not play. I'm trying to watch through PSVR. That's the first headset to come out for the play station 4 console.

What parameters are you trying? That would help us understand where your problems are caused.


text:
How to convert HDR HEVC mov files to WebM for Wikipedia videos (on a Mac)
I have a series of HDR HEVC .mov files taken with an iPhone in BT.2020 colour space.
I want to publish them on Wikipedia which requires VP9 WebM files.
I am converting them on a Mac using Handbrake.
When I playback the original mov file in Quicktime, I see an HDR video file.
When I playback the original mov in VLC, I cannot see the HDR effect -the colours look more muted and the dynamic range is less.
I have converted the file to VP9 webm using BT2020 colour space. When I playback the converted file in VLC it also looks more muted and lower dynamic range.

Is it possible to playback WebM files at HDR on a mac to verify they have converted correctly? Quicktime cannot play WebM files. VLC can, but doesn't appear to playback HDR correctly.
Can Wikipedia handle HDR files? Their site says they handle VP9 which includes the BT2020 colourspace.
Any advice on workflow would be appreciated, but it needs to be on a Mac.

Just seen VLC 3 doesn't support HDR colour rendering, but should be fixed in v4: https://forum.videolan.org/viewtopic.php?f=12&t=165034&p=545919&hilit=HDR#p545919 is there a webm player for the mac that can?


text:
Insta360 camera - what software and hardware for upload and basic editing
Hope someone can help.
I am about  to buy the insta360 GO 3S in order to record content for upload to youtube. I have some questions about hardware and software for basic video production.
A main reason for choosing this (Insta360) model (aside from the good reviews) is its ability to be used as a body cam while walking around, either worn on the chest using the magnetic ring on a neck lanyard, or on a cap peak... (I'm open to other camera suggestions if they can be used in the same way - I don't want one that can be used only on a selfie stick or gimbal or to be held in the hand etc)
Anyway, I will need to do some editing, inserting some text on screen maybe or some music before uploading to youtube. Nothing too fancy- like the basic on-screen texts and graphics one can see on these kind of walking style videos.
I have an old HP laptop which I've been looking to replace. It still works well enough for web surfing and so on but I realise its processing ability is unlikely to be enough.
What I would like is some recommendations for  basic editing software (pre-installed on a new PC is likely to be ok or not?), and minimum pc processing power (i.e. is (16GB RAM enough, cpu speed etc)... Also any other tips welcome on the interfacing between the Insta360 and the PC. Thank you in advance for any advice. Cheers!

Have you looked at the software that comes with the Insta360 camera yet. I think it does everything you need, as well as being able to cope with the 360 format, which many other editors cannot handle.


text:
Benefits of recording audio directly into Zoom H1n as opposed to using as a pre-amp and recording into camera
My current camera setup includes a Sony a6400, a Rode VideoMic Pro+ and a Zoom H1n. This gives me a couple options for sound recording:

Rode records into Zoom, sync audio in post
Rode runs through Zoom to use the Zoom's pre-amps, then records into camera

Is option 1 going to give me significantly better sound quality? And for solo shooting or a barebones crew is it worth the hassle of dealing with two recording devices?

Is option 1 going to give me significantly better sound quality?

No.

And for solo shooting or a barebones crew is it worth the hassle of dealing with two recording devices?

It depends on whether you consider “bare bones” to include a boom op. IMHO a dedicated boom operator is a must for getting professional quality location dialog recorded. If you have a boom op, then they can double as location sound mixer and it’s very often more convenient on location for them to record to a portable device that they wear instead of having to run cables or wireless between boom and camera.
These days wireless rigs can be very good sounding so that may be an option (boom mic to mixer to wireless transmitter to camera for recording with video).
Another reason to have a dedicated recorder is if your camera only records stereo and you want more than two separate tracks of audio. One boom plus two lavs is already three tracks, and that’s a great way to get location dialog with solid post production choices available.
All of this is from the point of view of scripted fiction or docudrama production. For documentaries or journalism, you don’t need the same kind of verisimilitude that is ideal for fiction, so you can go without a boom op and just record right to the camera.

Thanks! Another thought, the Zoom records 24 bit audio and the camera is 16 bit audio. Does that change anything?


text:
How to activate default Workspace in Adobe Premier Pro 2023?
I was following a tutorial on Youtube on how to render videos using Adobe Premier Pro 2023 like this one.

I tried to follow the instruction on how to create workspace but mine is so different than in the Youtube that I don't know how to have the same Workspace as the one show in the video.

My question is, how to have the same workspace as shown in the Youtube? Is it really the default workspace of Adobe Premier Pro 2023 when first rendering a video?
Thanks!


text:
ffmpeg: Start/stop recording a stream on black blue screens
I have about a hundred VHS tapes I'm trying to digitize. I've got a capture card hooked up to the VCR so I can play the tapes and record using ffmpeg using /dev/video0 as input, but I have to start/stop the recording manually. The VCR outputs a solid blue screen when it's not playing content.
I'd like to script a way to delay starting the recording while the screen is blue and stop it when it returns, so I can put tapes in one by one and let them play out without worrying about how long each tape is. I'm okay with some buffer to clean up later, but this will be recording over several days, so I don't want to record everything to one huge file. Ideally, I'd end up with one file for each tape.
So far, I've tried finding some way to use -vf signalstats to output color information, so I can trigger a signal to stop ffmpeg and start another. I've also tried to find some way to periodically write frames to an image file that another process can check.


text:
FFMPEG: Black background for transparent overlay
I'm trying to create some overlays over a video using c# but I can't get the overlay to be transparentOverlay to be transparent.
            for (int i = 0; i < textModelList.Count; i++)
            {
                var textModel = textModelList[i];

                // Text overlay properties
                string textColor = ConvertHexToFFmpegColor(textModel.TextColour, includeAlpha: false);
                string backgroundColor = textModel.BackgroundColour == null
                    ? "0x00000000"  // Fully transparent
                    : ConvertHexToFFmpegColor(textModel.BackgroundColour);

                // Calculate scaled overlay dimensions
                int overlayWidth = (int)(textModel.LabelWidth * scaleFactorX);
                int overlayHeight = (int)(textModel.LabelHeight * scaleFactorY);

                var xPosition = (textModel.Position_X + textModel.InitialX) * scaleFactorX;
                var yPosition = (textModel.Position_Y + textModel.InitialY) * scaleFactorY;

                string fontFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Fonts", "NewWaltDisneyFontRegular-BPen.otf");

                var startTime = TimeSpan.FromTicks(textModel.StartTime).Seconds;
                var endTime = TimeSpan.FromTicks((int)textModel.EndTime).Seconds;

                string formattedFontFilePath = FormatFontFilePath(fontFilePath);

                int fontSize = (int)(textModel.Font_Size * Math.Min(scaleFactorX, scaleFactorY));

                // Create text overlay image with scaled dimensions
                string overlayImage = $"text_overlay_{Guid.NewGuid().ToString()}.png";

                int rotationAngle = (int)textModel.Rotation;
                string rotationFilter = $", rotate={rotationAngle}*PI/180:fillcolor=0x00000000:ow=rotw(iw):oh=roth(ih)";

                // Create a transparent overlay
                string transparentOverlay = $"transparent_overlay_{Guid.NewGuid().ToString()}.png";
                string createTransparentOverlayCommand = $"-f lavfi -i color=c=0x00000000:s={overlayWidth}x{overlayHeight} -vf \"format=rgba\" -frames:v 1 {transparentOverlay}";
                await ExecuteFFmpegCommand(createTransparentOverlayCommand);

                string createOverlayCommand = $"-i {transparentOverlay} -vf \"drawtext=fontfile={formattedFontFilePath}:text='{textModel.Text}':x=(w-text_w)/2:y=(h-text_h)/2:fontsize={fontSize}:fontcolor={textColor}:box=1:boxcolor={backgroundColor}{rotationFilter}\" -frames:v 1 {overlayImage}";
                await ExecuteFFmpegCommand(createOverlayCommand);

                // Prepare the overlay command for this textModel
                string overlayCommand = $"-noautorotate -i \"{currentInputFile}\" -i {overlayImage} -filter_complex \"overlay={xPosition}:{yPosition}:enable='between(t,{startTime},{endTime})'\" -codec:a copy";

                // Create a temporary output file for this stage
                tempOutputFile = $"E:\\TempOutput\\temp_output_{i}.mp4";

                // Apply the overlay and save to the temporary file
                await ExecuteFFmpegCommand($"{overlayCommand} \"{tempOutputFile}\"");

                // Update current input to be the output of this stage

It's this command here:
    string createTransparentOverlayCommand = $"-f lavfi -i color=c=0x00000000:s={overlayWidth}x{overlayHeight} -vf \"format=rgba\" -frames:v 1 {transparentOverlay}";

It always appears with a black background rather than transparent.

try ... -i color=blue@0:{overlayWidth}x{overlayHeight},format=rgba -frames:v 1 ...

authors: Баяр Гончикжапов


text:
ASS/SSA subtitles hard coded using ffmpeg are highly antialiased
I am using ASS/SSA format for hard coding captions on the video. These are relevant parts of my .ass file:
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: s0, Montserrat-Black, 60, &H0015CCFA, &H001C1CB9, &H77000000, &H00000000, 1, 0, 0, 0, 100, 100, , 0, 1, 2, 2 , 2, 0, 0, 0, 1

[Events]
Format: Start, End, Style, Text
Dialogue: 00:0:43.8,00:0:46.55,s0,{\pos(540,1550)\fscx50\fscy50\t(0,100,\fscx100\fscy100)\org(10540,-8450)\t(100,600,\frz0.10)\t(600,1100,\frz-0.10)\t(1100,1600,\frz0.10)\t(1600,2100,\frz-0.10)\t(2100,2600,\frz0.10)\t(2600,3100,\frz-0.10)\t(3100,3600,\frz0.10)\k3463}ME FOR WHATEVER

And to hard code on the video, I use following ffmpeg command:
ffmpeg -i video_filepath -vf ass={ass_filepath} -c:a copy -y out_path

This works as intended, except the captions are highly antialiased.
Here is a small section of result: https://gifyu.com/image/S5ZD6
By the way, all chat bots have failed to answer this.


text:
Encode piped images as they arrive with real time timestamps
I'm encoding a video by piping images into ffmpeg using the -i pipe: input.
However the images arrive sporadically, but are encoded as if they are sequential frames.
I have tried using -use_wallclock_as_timestamps 1 in the input block, but it has no effect.
This is the command I'm using:
ffmpeg -use_wallclock_as_timestamps 1 -i pipe: -vf fps=50 -c:v libx264 -map 0 -f segment -segment_list playlist.m3u8 -segment_list_flags +live -segment_time 10 -segment_wrap 5 seg%03d.mkv
Input block parameters I've tried to no avail:

-re
-framerate 1
-framerate 1/1000
-framerate 50

So to reiterate the problem: A video is being produced, but each piped image is set as an individual frame, despite having arrived and encoded at an entirely different time than its predecessor.

I found a Japanese article while searching the internet and thought it might be what you were looking for, so I am posting it. Please translate it in any way you like.
"Save images generated in real time with OpenCV as a variable frame rate video", (Google Translate).
I consider this to be a way to accept images with variable frame rates in situations like yours. I'm not confident in coding, but after trying various things, I was able to get a fixed rate image as shown below.
(However, I was not able to get a video, and I was having trouble with the broken pipe error 32 due to the termuxX11 environment.)
fpsns = 0.00333  # nearly 30fps interval
endns = 0.0

if interval > fpsns:
    interval = ((time.time_ns()/1000000000) - endns)

    # capture or something here

    endns = time.time_ns() / 1000000000000
else:
    logging.debug(f'not capture timming {str(interval)[:6]}')
    continue

I made a small correction because I was wrong code part.


text:
Will re-encoding a video file using the same codec as the original video's codec minimize quality loss?
This is something that came to mind when I was thinking about minimizing quality loss of video uploads to YouTube after the videos get compressed and processed. While I am not aware of the exact mechanisms by which YouTube compresses their videos, I would like to ask if using the same video codec to compress as the original video file will ensure minimal quality loss, or if there is any relationship, like for example codec A can be encoded to codec B with less quality loss, while codec A to codec C would be a lot less pretty with lots of ugly artifacts.
This is, of course, assuming the bitrates are constant when comparing various codecs.


text:
How to store discontinuous timestamps in metadata?
I would like to include timestamps not as watermarks (though potentially extracting from them) but as metadata for each segment, how can this best be achieved?


text:
2 Youtube channels in the same account, one says I can earn money with Youtube and the other says monetization isnt available for my location (?)
I have several youtube channels in the same account. One of the accounts says I can earn money with Youtube, the other says monetization isnt available for my location. How is this possible? Is it a bug or something?


text:
How do I set a default end screen for YouTube videos?
I am posting videos to my YouTube channel and want to have a standard end screen for each video. Currently, while YouTube does allow me to import end screens from previous videos, I need to import the end screen for every upload individually.
How do I either set a default end screen or set the end screen for multiple videos at once?


text:
ffmpeg - convert MP4 to 2010 Lumix playable MJPEG
I'm new to ffmpeg and ffprobe, I started using it to convert videos to show on 3DS and DSi for an art project.
Now I want to show my own videos on a Panasonic LUMIX digicam (DMC-FT2)(JPN), but have had trouble getting the device to play the video.
The digi takes videos in AVCHD Lite and Motion JPEG.
I've tried online converting mp4 to the respective formats + changing file name, but the device only recognises that it's there — refuses to/can't play it.
I also tried using this code to convert to MJPEG: ffmpeg -i input.mp4 -c:v mjpeg -q:v 2 -an output.mjpeg
But no luck! Changed the filename to match the others, the camera recognised the file is there, but can't play it.
So I used this code to get the information of a MJPEG video taken on the digi: /opt/ffmpeg/ffprobe file.mp4 -show_streams  -select_streams v  -print_format json/opt/ffmpeg/ffprobe file.mp4 -show_streams  -select_streams v  -print_format json
and got the following, is it possible to convert my own video (mp4) to these settings? So that it can play on the device? If so how?
  Metadata:
    major_brand     : qt
    minor_version   : 537331972
    compatible_brands: qt  pana
    creation_time   : 2024-08-21T21:54:59.000000Z
  Duration: 00:00:06.00, start: 0.000000, bitrate: 12287 kb/s
  Stream #0:0[0x1](eng): Video: mjpeg (Baseline) (jpeg / 0x6765706A), yuvj420p(pc, bt470bg/unknown/unknown), 640x480, 11083 kb/s, 30 fps, 30 tbr, 30 tbn (default)
      Metadata:
        creation_time   : 2024-08-21T21:54:59.000000Z
        vendor_id       : pana
        encoder         : Photo - JPEG
  Stream #0:1[0x2](eng): Audio: pcm_s16be (twos / 0x736F7774), 16000 Hz, 1 channels, s16, 256 kb/s (default)
      Metadata:
        creation_time   : 2024-08-21T21:54:59.000000Z
        vendor_id       : pana
    "streams": [
        {
            "index": 0,
            "codec_name": "mjpeg",
            "codec_long_name": "Motion JPEG",
            "profile": "Baseline",
            "codec_type": "video",
            "codec_tag_string": "jpeg",
            "codec_tag": "0x6765706a",
            "width": 640,
            "height": 480,
            "coded_width": 640,
            "coded_height": 480,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 0,
            "pix_fmt": "yuvj420p",
            "level": -99,
            "color_range": "pc",
            "color_space": "bt470bg",
            "chroma_location": "center",
            "refs": 1,
            "id": "0x1",
            "r_frame_rate": "30/1",
            "avg_frame_rate": "30/1",
            "time_base": "1/30",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 180,
            "duration": "6.000000",
            "bit_rate": "11083093",
            "bits_per_raw_sample": "8",
            "nb_frames": "180",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "non_diegetic": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            },
            "tags": {
                "creation_time": "2024-08-21T21:54:59.000000Z",
                "language": "eng",
                "vendor_id": "pana",
                "encoder": "Photo - JPEG"
            }
        }
    ]
}

Show full ffprobe for the input as well as the working Lumix file, without -select_streams v


text:
Using ffmpeg alphamerge to mask two images before calculating similarity index
I'm working on a script that removes duplicate frames from images stored on disk. I need to ignore certain irrelevant parts of the images.
The following ffmpeg command line should work, but it returns the same SSIM statistics as without mask.
ffmpeg -i 1.webp -i 2.webp -i mask.png -filter_complex \
"[0][2]alphamerge[img1]; \
 [1][2]alphamerge[img2]; \
 [img1]format=yuva420p[masked1]; \
 [img2]format=yuva420p[masked2]; \
 [masked1][masked2]ssim=stats_file=-" -f null -

Example output:
[Parsed_ssim_4 @ 0x7fb76b70ff00] SSIM Y:0.829392 (7.680003) U:0.987882 (19.165656) V:0.993201 (21.675403) All:0.883108 (9.322165)
[out#0/null @ 0x7fb76c604700] video:0KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.602x

Result is the same with ffmpeg -i 1.webp -i 2.webp  -lavfi ssim=stats_file=- -f null -.
[Parsed_ssim_0 @ 0x7f9c0cf06d80] SSIM Y:0.829392 (7.680003) U:0.987882 (19.165656) V:0.993201 (21.675403) All:0.883108 (9.322165)
[out#0/null @ 0x7f9c0da08e80] video:0KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown

This is weird because the masked output files look as expected if I output them with:
ffmpeg -i 1.webp -i 2.webp -i mask.png -filter_complex \
"[0][2]alphamerge[img1]; \
 [1][2]alphamerge[img2]; \
 [img1]format=yuva420p[masked1]; \
 [img2]format=yuva420p[masked2]" \
-map "[masked1]" masked_1.webp \
-map "[masked2]" masked_2.webp

Does anyone know what the right syntax would be for getting the SSIM values from a single command using a mask?
Side note: If I use -map "[masked1]" masked_1.jpg it outputs the original picture, not the masked one. Could there be a problem in the ffmpeg pipeline?
Thank you very much!

What alphamerge does is attach a grayscale image as an alpha component to the base image. Video quality metrics don't factor in the alpha component.
What you need to use is a filter like maskedmerge. e.g.,
ffmpeg -i 1.webp -i 2.webp -i mask.png -f lavfi -i "color=black:s=WxH" -filter_complex \
"[3][0][2]maskedamerge[img1]; \
 [3][1][2]maskedmerge[img2]; \
 [img1]format=yuv420p[masked1]; \
 [img2]format=yuv420p[masked2]; \
 [masked1][masked2]ssim=stats_file=-" -f null -

where W and H should be replaced with dimensions of the base images.


text:
What ffmpeg parameters can be different between first and second pass?
I have attempted to encode a large video file with libvpx-vp9 with 2 pass encoding. The first pass took a surprisingly long time, while the second pass was unacceptably slow.
Since libvpx-vp9 can, unlike libx264, receive a benefit to quality from two pass, I would like to ideally make use of the first pass log.
The encoding pages on the trac.ffmpeg.org wiki state that audio can be left out of the first pass, implying that audio related commands don't matter. My own testing suggests that libopus doesn't support 2 pass and is unaffected by a first pass.
What other parameters, if any, can be different between first and second pass? Eg; could I set a different speed (cpu-used) or deadline for the second pass? Are there other video related parameters that can be different? What are the consequences to using drastically different params between first and second pass? Would it cause an error, reduce the benefit from the first pass, nullify the benefit, or result in less quality than 1 pass? Would any answer differ between encoders?


text:
How to compress a 100GB video effectively to smoothly play it on TV via Google Chromecast
How to compress a 100GB video effectively to smoothly play it on TV via Google Chromecast?
The video is 2160p converted from BlueRay disk.
The video is on my Macbook Pro computer and I play it with VLC Player or Airflow app and project it to TV via Chromecast.

failed attempt #1: Splitting it into 5GB parts and play them separately. It still have pauses every few seconds.


text:
Can some one help me how to make ffmpeg capturing with preview on PictureBox?
My system is Windows 10/11

I am making ffmpeg based video capturing software in VB6 with preview.
I could deal ffmpeg.exe only by command line.
Source is from Decklink card or Video file.
I can't use ffplay for preview, because I need the preview on my application window
unlike ffplay's floating window.
Most of it I need open source solution as my application is not for commercial use.
ffmpeg usual pipe can not be used, because I need the Preview first by process A.
When user decide to start Capture, that time only Process B will be executed.

Stage-1:
First I need to receive the source and show the preview on my application PictureBox/Form.
If its by ffmpeg, well, else some Directshow suggession needed.
I could do Stage-1 easily by VB6+Directshow, but how the same stream will be consumed by ffmpeg on Stage-2 ?
Stage-2:
ffmpeg command line should receive the same source (from above stream) and do the capturing on a file. (I can manage the commands for encoding and capturing on file)
Help needed:

How to render the preview on my application window with ffmpeg/ffplay ?
How to use the same video source if it is already used on Stage-1 by the preview process ?

Possibilities:
A)
I could manage it, if I get some Directshow Virtual Video/Audio Sink/Source filters.
But no where I could find Virtual Video/Audio Sink/Source filters
I may use the Virtual Sink filters on Directshow graph one with Preview.
ffmpeg will receive the same source from Virtual Source filter.
B)
By some means if I could create mkfifo in Windows, I could manage it.
But I doubt we can create fifo in Windows like Linux.
C)
If I could dump the Video/Audio stream on Memory and if ffmpeg receives that stream from memory, then it should work. But I don't know how to do it from ffmpeg command line.
Please help and suggest me the proper schema for this.
gaamaa


text:
Way to convert already imported numbered images into an image sequence in After Effects
In After Effects, is there a way to turn an already imported numbered images (PNG in this case) into a single image sequence, without having to import them again? I already assume it is not possible (with creating regular «compositions» being the closest approach), but still.

I'm not sure whether this is exactly what you're asking, but you can update an image sequence in After Effects after you have imported it. This can be very useful if you're importing a sequence from e.g. Blender:

Render the image sequence in Blender
Import the sequence into AE

Then imagine you need to re-render a few frames within the Blender sequence.

Render only the frames you need to fix in Blender
Go back to After Effects and right-click on your image sequence in the Projects tab.
Click on "Reload Footage".

Your sequence will update, and you can re-render your comp with the new files.
Reading your question again, maybe you mean "I've imported a load of images individually into After Effects, how do I add them to a comp as a sequence? You can do this, but it's neater to import them as an image sequence.  But if you want to make a sequence of the images, I would do this:

Select all the images from the Project tab
Drag them into a new comp (by dragging them on to the "Create a new composition" icon at the bottom of the tab.
A dialogue box will appear asking the duration for each image. Set it as you want (eg 1 frame).
Go to the menu item Composition-->Composition Settings. Set the comp duration to the correct length for all your frames (eg if you have 25 frames at 1 frame duration each, set your comp duration to 25 frames).
With all the layers still selected in your comp, stagger the layers using a plugin like pt_ShiftLayers


text:
Generate HLS streams from pre-encoded videos without re-encoding using ffmpeg
I have three videos: low.mp4, mid.mp4 and high.mp4, all of which were generated from the same source file using ffmpeg with the following command:
ffmpeg -y -i source.mp4 -c:v libx264 -crf SOMEVALUE -preset veryfast -vsync 0 -bf 0 -x264-params scenecut=0:keyint=25:min-keyint=25 -c:a aac -ab 128k -f mp4 OUTPUT.mp4

Now, I want to stream these videos using the HLS protocol. I use the following ffmpeg command to generate the HLS streams:
ffmpeg -i low.mp4 -i mid.mp4 -i high.mp4 \
-map 0:v -map 0:a -map 1:v -map 1:a -map 2:v -map 2:a \
-c:v copy -c:a copy \
-hls_time 4 -hls_playlist_type vod -hls_segment_type fmp4 \
-hls_flags independent_segments \
-var_stream_map "v:0,a:0,name:low v:1,a:1,name:mid v:2,a:2,name:high" \
-master_pl_name master.m3u8 \
-hls_segment_filename '%v/segment-%06d.m4s' \
-hls_fmp4_init_filename '%v/init.mp4' \
-strftime_mkdir 1 \
-f hls '%v.m3u8'

While this command does generate the HLS streams, the resulting video quality is poor. However, if I omit the -c:v copy -c:a copy flags, the video quality is good, but the command takes significantly longer to run because it re-encodes the video.
I'm looking for a solution that meets the following requirements:
Separate Quality Generation: The different quality versions (low.mp4, mid.mp4, high.mp4) should be created in a separate step. This is important because, in practice, we speed up this process by cutting the videos into smaller pieces, transcoding them in parallel, and then recombining them.
No Re-encoding During HLS Generation: The HLS generation step should not involve re-encoding the video, to save time.
High-Quality HLS Output: The final HLS output should have good video quality, similar to what is achieved when re-encoding.
Is this possible? How?

This is bizarre. A re-encoding can, at most, preserve source quality, not improve it. I would check your player and try others.

Sorry, I think my question was unclear. I’m not expecting higher quality because of re-encoding. My concern is that when I skip the re-encoding step (using -c:v copy -c:a copy), the resulting HLS stream exhibits poor video quality (the video is mostly grey, totally unrecognizable). It seems like the issue may be related to not fully adhering to the HLS protocol or some other compatibility problem.

Turns out the provided command is actually correct. The problem was in how I was testing the resulting HLS files. It didn't work correctly with VLC media player, but when using video.js in the chrome browser, it actually works.


text:
ffmpeg: -hls_time and -hls_init_time not working
Source video: h264 mp4, 45 seconds, 30 fps, keyint 30, min keyint 16
I am trying to create an m3u8 playlist where the first chunk is smaller (2 seconds) and the rest are 10 seconds.
when using this command:
ffmpeg.exe -i test4_c.mp4 -codec copy -bsf:v h264_mp4toannexb -start_number 0 -hls_init_time 2 -hls_time 10 -f hls -hls_list_size 0 test4_hls.m3u8

result is 4 10 second ts chunks
when using this command:
ffmpeg.exe -i test4_c.mp4 -codec copy -bsf:v h264_mp4toannexb -start_number 0 -hls_init_time 2 -hls_time 10 -f hls -hls_list_size 100 test4_hls.m3u8

result is 23 2 second ts chunks
what's the issue here?
I have already read this:
https://stackoverflow.com/questions/43489097/ffmpeg-hls-init-time-hls-time-not-working-together
and it doesn't work

a colleague figured it out (for a 20 second input video):
ffmpeg -i input.mp4 -map 0 -c copy -f ssegment -segment_list playlist.m3u8 -segment_times 2,12,22 -break_non_keyframes 1 out%03d.ts

if used in a program then segment_times needs to be somehow generated with regards to media length - for instance it won't be 2,12,22 if your media is 60 seconds long and you want 20 second chunks (after the first 2 second one), it will be 2,22,42,62


text:
ffmpeg hardware vaapi encoding VC1 to H.265
I am trying to transcode a video from VC1 to H.265 using hardware acceleration. VC1 by software decode and then encode by hardware acceleration.
ffmpeg  -i title_t01.mkv  -map 0   -c:a copy  -c:s copy   -c:v hevc_vaapi  DUMB_AND_DUMBER.mkv

Unfortunately this does not work
detected 16 logical cores
[graph 0 input from stream 0:0 @ 0x55bc75120200] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x55bc75120200] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x55bc75120200] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x55bc75120200] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x55bc75120200] Setting 'frame_rate' to value '24000/1001'
[graph 0 input from stream 0:0 @ 0x55bc75120200] w:1920 h:1080 pixfmt:yuv420p tb:1/1000 fr:24000/1001 sar:1/1
[format @ 0x55bc75120a40] Setting 'pix_fmts' to value 'vaapi'
[auto_scale_0 @ 0x55bc750eae80] w:iw h:ih flags:'' interl:0
[format @ 0x55bc75120a40] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
[vf#0:0 @ 0x55bc751182c0] Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
[vist#0:0/vc1 @ 0x55bc751134c0] Decoder thread received EOF packet
[vist#0:0/vc1 @ 0x55bc751134c0] Decoder returned EOF, finishing
[vist#0:0/vc1 @ 0x55bc751134c0] Terminating decoder thread
Error while filtering: Function not implemented


text:
Convert 50fps to 25fps by skipping frames but not changing speed
I have a 50p H264 video which was originally shot normally at 25p, but encoded by some idiot to 50p. So every frame is encoded twice.
Is it possible to copy it by skipping every second frame, and setting the speed to 25p?
I know I could re-encode it at 25p, but I would like to copy the frames without re-encoding.

just drop it in a 25p timeline, will be fine. all NLEs can do that automatically.


text:
Wave effect spills outside the frame in Sony Vegas Pro 13

I'm using the wave effect on a foreground element but it spills outside the frame and onto the black bar on the side. This is not visible in Vegas' preview but it appears as soon as I render the video. This problem occurs when I render the video in both 1080p and 720p.
I tried different aspect ratios and added a mask to crop the waves but it didn't work. Is there any way to crop the excess waves or remove the bars entirely?


text:
Youtube crappy quality after upload
I made a PNG sequence video to mimic a write on effect. Problem is, it looks very good on my pc. But when I See it on youtube, the quality is horrendous. I've attached various timestamps of the video to show how it looks fine in one timestamp (00:05) and it looks so bad in one timestamp (00:04). Honestly, this is very troubling and I Tried everything - from outputting from premier pro via prores, h264/h265 (highest settings), but Youtube still keeps pulling this crap out of nowhere. What's the problem here? I Dont understand why its screwing up parts of video in one time and the rest?
I'm attaching screenshots here (please view full images) of the various timestamps, and the quality is all over the place and odd. its worse in some, and good in some. for example the white lines look horrendous (00:07 timestamp) although the quality is 720p.
what settings do I apply to export via premiere pro or do I use any other way?

This the link to the video:

What exactly does "they look horrendous" mean? Are there artifacts? Are those artifacts in your original video? Are their in the original images?


text:
Qstopmotion cannot find ffmpeg encoder on my computer, allthough it is installed
I just started working with Qstopmotion on an Ubuntu system and I am trying to export my video using the ffmpeg encoder. Qstopmotion keeps throwing the error message:
The selected encoder is not installed on your computer.
Install the encoder or select another one!

However, ffmpeg is installed on my computer, if I type in $ ffmpeg --version in the terminal I get version
ffmpeg version 4.4.2-0ubuntu0.22.04.1+esm4 Copyright (c) 2000-2021 the FFmpeg developers

I have already played with the preferences, trying to change the output format from mp4 to avi but nothing seems to help. Does someone know what else I can try?


text:
How to cut a video by time into two pieces losssless and fast?
I have input.mp4 of length 30 minutes.
I want to cut it at roughly 24:35, as losssless as possible, as fast as possible.
So, the first output is from 0 inclusive to 24:35 exclusive. The second output is from 24:35 inclusive to 30:00 exclusive.
I'm totally fine if the keyframe is at 24:30 or 24:40, as long as the merged video has no dropped frames and no duplicated frames.
I crafted this command lines.
ffmpeg -y -ss 0 -to 24:35 -i input.mp4 -c copy input-1.mp4
ffmpeg -y -ss 24:35       -i input.mp4 -c copy input-2.mp4

However, I'm not fond of it because I have to specify 24:35 twice. If I have more splitting points, the command lines will be lengthy and repetitive.
Also, I'm concerned about the length difference between the original video and the merged video.
$ ffprobe -i input.mp4 2>&1 | grep "Duration"
Duration: 00:29:40.18, start: 0.000000, bitrate: 10598 kb/s
$ ffprobe -i merge.mp4 2>&1 | grep "Duration"
Duration: 00:29:40.26, start: 0.000000, bitrate: 10603 kb/s

I know time seeking is inaccurate without re-encoding, but is the inaccuracy deterministic for -to and -ss?

try ffmpeg -i input.mp4 -c copy -f segment -segment_times 24:31 -reset_timestamps 1 input-%d.mp4

authors: Баяр Гончикжапов