text:
FFmpeg with input SRT stream very low bitrate
I am trying to record an input SRT stream with ffmpeg 4.0 and even though it is recognized as a valid stream and the input stream is around 2.5Mbps, the recording is with only 80-120Kbps. I understand that ffmpeg by default is cutting the null PIDs but even though I would have expected an input bitrate of around 2.2Mbps. This is the command I am using:
$ ffmpeg -re -i srt://10.88.159.70:10000 -c copy -f mpegts /tmp/srt_listener_recording_ffmpeg.ts
Input #0, mpegts, from 'srt://10.88.159.70:10000':
  Duration: N/A, start: 4155.366989, bitrate: N/A
  Program 1
    Stream #0:0[0x1e1]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1e2]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 133 kb/s
Output #0, mpegts, to '/tmp/srt_listener_recording_ffmpeg.ts':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 133 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 Lsize=    1808kB time=00:01:44.32 bitrate= 142.0kbits/s speed=0.994x
video:0kB audio:1623kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 11.393347%
Exiting normally, received signal 2.

This is my ffprobe output:
$ ffprobe -i /tmp/srt_listener_recording_ffmpeg.ts
ffprobe version 4.0 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --pkg-config-flags=--static --extra-libs='-lpthread -lm' --toolchain=hardened --enable-gpl --enable-nonfree --enable-version3 --disable-stripping --enable-avisynth --enable-libass --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-librubberband --enable-libshine --enable-libsnappy --enable-libssh --enable-libtwolame --enable-libwavpack --enable-libzvbi --enable-openal --enable-sdl2 --enable-libdrm --enable-frei0r --enable-ladspa --enable-libpulse --enable-libsoxr --enable-libspeex --enable-avfilter --enable-postproc --enable-pthreads --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-ffplay --enable-libopenjpeg --enable-libsrt --enable-libwebp --enable-libxvid --enable-libvidstab --enable-libopenh264 --enable-zlib --enable-openssl
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[mpegts @ 0x55b24141afc0] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 0x55b24141afc0] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from '/tmp/srt_listener_recording_ffmpeg.ts':
  Duration: 00:01:44.26, start: 1.400000, bitrate: 142 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 120 kb/s

And mediainfo is not even showing me the video stream:
$ mediainfo /tmp/srt_listener_recording_ffmpeg.ts
General
ID                                       : 1 (0x1)
Complete name                            : /tmp/srt_listener_recording_ffmpeg.ts
Format                                   : MPEG-TS
File size                                : 1.77 MiB
Duration                                 : 1 min 44 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 142 kb/s

Audio
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format version                           : Version 4
Format profile                           : LC
Muxing mode                              : ADTS
Codec ID                                 : 15
Duration                                 : 1 min 44 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy

Menu
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
List                                     : 257 (0x101) (AAC)
Service name                             : Service01
Service provider                         : FFmpeg
Service type                             : digital television

At the same time if I try to play the input SRT stream with VLC it works just fine and I have picture and audio.
[EDIT: 25.02.2019] I have created two log files with the following commands:
$ ffmpeg -i udp://225.0.0.0:3000 -c copy -y -f mpegts -loglevel debug /tmp/test_c_copy.ts &> ffmpeg_udp_recording_c_copy.txt

$ ffmpeg -i udp://225.0.0.0:3000 -c:v libx264 -c:a copy -y -f mpegts -loglevel debug /tmp/test_cv_libx264_ca_copy.ts &> ffmpeg_udp_recording_cv_libx264_ca_copy.txt

The log files, as well as the recordings, could be found at Google Drive
In addition in the ffmpeg_udp_recording_c_copy.txt file I see a lot of errors like:
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[mpegts @ 0x55ed3b9c7000] Delay between the first packet and last packet in the muxing queue is 10016645 > 10000000: forcing output

video:0kB audio:1623kB  --> no video has been copied. Is the -re flag needed? You're saving to disk. Increase verbosity and check.

the -re flag is not needed, but I have the same output without it. If I remove the -c copy option it works just fine, if I add -c:v copy -c:a copy again the recording is broken. I have tried to update to ffmpeg 4.1 and the result was exactly the same. I have tried to record udp live stream and again with -c copy the recording was broken.

@Gyan I will add the log files in around 30 minutes.

@Gyan added all the debug files and the ffmpeg recordings.

Add -copyinkf and check.

@Gyan, I have executed: $ ffmpeg -i udp://225.0.0.0:3000 -c copy -y -f mpegts -loglevel debug /tmp/test_c_copy_copyinkf.ts &> ffmpeg_udp_recording_c_copy.txt and it crashed with: Conversion failed! error. I have added the log file to the Google Drive link from the main thread.

ffmpeg -i udp://225.0.0.0:3000 -c copy -copyinkf -bsf:v extract_extradata,h264_mp4toannexb -y -f mpegts -loglevel debug /tmp/test_c_copy_copyinkf.ts

It is still crashing with the same error. I put the log file in the same directory (ffmpeg_udp_recording_c_copy_bsf.txt)

How far are the keyframes spaced out?

it is an open GoP with GoP size of 60, while the frame rate of the video is 25fps, means that rougly every 2.5 seconds there should be an I-frame.

OK, add only -max_muxing_queue_size 9999 to your original cmd and check. The bitstream filter won't transform the stream is codec config isn't extracted and available, but codec config looks to be sparse.

You can also see if you can dump to a raw file: ffmpeg -re -i srt://10.88.159.70:10000 -c copy -copyinkf -map 0:v -f data srt.264

I have changed the input and now everything seems to work fine. So I guess my input source signal wasn't good and this was causing the issues.


text:
How to make ffmpeg flush the subtitles in real time while transcoding?
I'm feeding ffmpeg from stdin and do several transcoding operations in one command only. The issue is that ffmpeg seems to transcode them(or at least write on disk) sequently (i.e. first it transcodes/writes audio/video and then it transcodes the subtitles). This way it takes minutes before you get any subtitle content which translates in a poor user experience(if the transcoding is "on demand"/live) because the client needs to wait for the subtitles even if the audio/video is ready(at least partially).
  How can I change that? How can I make ffmpeg write the subtitles to the disk as soon as they are copied/transcoded?
Note:  I believe the transcoding is done concurrently for the subtitles too but for some reasons it flushes/writes them on disk only after the audio/video transcoding completes. That's because there is no way ffmpeg could start reading the input from beginning after a/v transcoding is done because it can't seek/start over from stdin.
Below is a sample of my command:
 ffmpeg -nostdin -i - -map 0:2 -c:0 webvtt -f webvtt first.vtt \
-map 0:3 -c:0 webvtt -f webvtt second.vtt \
-map 0:0 -c:0 copy -map 0:1 -c:1 aac \
-use_timeline 1 -min_seg_duration 1000000 \
-use_template 1 -init_seg_name $RepresentationID$-0.mp4s \
-media_seg_name $RepresentationID$-$Number$.mp4s \
-adaptation_sets "id=mkv/0,streams=0 id=mkv/1,streams=1" \
-f dash -dash 1 out.mpd

When ffmpeg will flush to output depends on the protocol. For file protocol, atleast 256 kiB data must be waiting, unless it's end of output. So, for text formats, there will be only one payload write.
You can workaround by forcing ffmpeg to flush a stream after each packet.
 ffmpeg -nostdin -i - -map 0:2 -c:0 webvtt -flush_packets 1 -f webvtt first.vtt \
-map 0:3 -c:0 webvtt -flush_packets 1 -f webvtt second.vtt \
-map 0:0 -c:0 copy -map 0:1 -c:1 aac \
-use_timeline 1 -min_seg_duration 1000000 \
-use_template 1 -init_seg_name $RepresentationID$-0.mp4s \
-media_seg_name $RepresentationID$-$Number$.mp4s \
-adaptation_sets "id=mkv/0,streams=0 id=mkv/1,streams=1" \
-f dash -dash 1 out.mpd

See also https://stackoverflow.com/questions/50574086/ffmpeg-flushing-output-file-every-chunk/50576757#50576757 for another example

source: Stack Exchange

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

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

sort: votes


text:
FFMPEG demux concat dropping audio at stitch points
I am trying to use FFMPEG (v.3.3.3) concat demuxer and as the file is stitched the audio drops at concat points. As I have files of same codecs, bitrates and so on - it doesn't make much sense to transcode again, so I really want to make concat demuxer to work.
I've had this problem with h.264 and aac. Here is how to recreate so you can see what I am talking about.

Create test file with bars and tone (10s)
ffmpeg -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=10" -f lavfi -i smptehdbars=size=1920x1080 -t 10 test.mp4
Split the file into two using seeking
ffmpeg -i test.mp4 -ss 0 -t 5 test-1.mp4
ffmpeg -i test.mp4 -ss 5 -t 5 test-2.mp4
Join the files together using concat demuxer
ffmpeg -f concat -safe 0 -i <(for f in ./test-*.mp4; do echo "file '$PWD/$f'"; done) -c copy testconcat.mp4

This creates a file with clearly audible audio drop at 5s mark. To picture this here I've created two spectrograms by extracting audio.

Extract audio
ffmpeg -i test.mp4 test.wav
ffmpeg -i testconcat.mp4 testconcat.wav
Create spectrograms
sox test.wav -n spectrogram -Y 130 -c "Input file" -o test.png
sox testconcat.wav -n spectrogram -Y 130 -c "Concat file" -o testconcat.png

And here is the result:

So my questions are:

Can concat demuxer be used in such a way to avoid the described problem?
Or what would you see as a solution (beyond full re-transcode)?

Transcode the audio of your inputs to PCM and save as MOV. Concat those.

@Mulvya - I know it's brief, but you could make a good answer from that comment.

MOV and MP4 almost same container

ffmpeg -i test.mp4 -ss 0 -t 5 test-1.mp4
ffmpeg -i test.mp4 -ss 5 -t 5 test-2.mp4

This is the root of evil. You almost never can split your audio/video with very high precise. Reasons for it:

Non-integer FPS in video. You can't split non-integer number of frames, so if you use 29.997 fps, you can't get 149.985 frames in file.
Audio codecs compress audio samples in blocks of samples, for example, in 1024 samples per second. So, if you split your sound in 5 second and sound has samplerate 44100Hz, you can only get 44100*5/1024=215.332 frames, this is too not integer. Actually, here you get small drop. Some codecs always add some silent frames at end, mp3 do in that way. Only one exception I know: pcm (any kind), this "codec" can save any count of frame, with no rough.

So, in conclusion, if you want split and concatenate files without loss:

use integer count for fps
use codecs what can encode any count of samples without rough or padding.

could you explain how to use integer count for fps for #1. Also Michal - how did you solve your problem

The problem you're describing with blanks between each segment is due to priming samples. This can be removed with the inpoint directive. However, for it to be completely seamless, there's a bit more to do.
To concat seamlessly with no gaps, you can do the following:

Calculate the AAC frame length based on the sample rate, e.g. 1024/44100 = 0.02321995 for 44.1KHz.
Encode an extra 2 AAC frames at the beginning and end of each segment.
Account for the 2 silent padding frames that ffmpeg always adds internally.
Assign inpoint and outpoint directives in the concat txt file so that only the "good" content is used when creating the output file.

The 2 extra beginning frames are required because each AAC frame is dependent on up to 2 frames before it. So to encode the first frame correctly, it needs that context. The 2 extra frames at the end are required because ffmpeg tapers the audio at the end to avoid a sudden pop. By adding 2 extra frames, we shift the taper so it doesn't affect our actual content. These extra frames are then removed with inpoint and outpoint to avoid repeated content.
Using this method, it's important that all segments have a length that's an exact multiple of an AAC frame duration. If they don't, you will see unpredictable artifacts at segment boundaries.
I recently released a repo that demonstrates this further with actual code: https://github.com/wistia/seamless-aac-split-and-stitch-demo.

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


text:
Final cut pro X takes hours to export a file with lots of images
So I've created a video, its in 1080p, it has a lot of images on it doing various things, fading in and out, moving around the screen etc.  It also has a picture in picture video on it and two audio streams.  I find that when I come to trying to share this as a master file even in the lowest resolution I can pick it takes hours and hours to export it!  The final file is <2gb in size (if I try 1080p the result is only circa 6gb and I've never completed it, it seems to grind to a halt after hours).
I'm running on a macbook pro which is about 2 years old, with 16gb Ram, 1tb hdd with a good 33gb of space etc.  Worth adding that when I don't have so many pictures the same video might take an hour or two but overall is much faster, is it just the sheer number of images I've got?  If so is there a way to mitigate this?  Not sure if relevant or not but I've also turned of rendering as having it on makes the mac start to sound like it's ready to take off!
Any suggestions how I can speed things up?

What are the resolutions of the images ?, if they are very big being shrunk down to 1080 it will have to render every image. I run on a MBP older than yours with lower ram and I work with a mix of 4K and 1080p video and mine runs fine. if you export as a master file and choose prores does that make a difference ? have you tried removing the animations and transitions, does this make a difference to export?

The images are 2k pixels high, could that possibly be whats doing it?  There are quite a few of them in there and the timeline isnt rendered before I try and share it, would rendering it help?  It seems to be taking an age to render to :/

When exporting I always choose master but I cant see anywhere to select pro-res, where would I set this :/

the images dont need to be 1080p but it will impact the as it will have to resize them slightly. also depending on the file format ie: jpeg, raw, tiff etc will depending on what it has to do to render.

here is a link to an image of the export screen the "Video Codec" is what you need to look into, changing this will make things run faster or slower depending on the codec and format etc https://larryjordan.com/wp-content/uploads/2013/05/export041.jpg

cheers for the photo, I only have h264 in that dropdown :/

The images are all png with transparent backgrounds

@MorkProk it is taking so long because it is converting it to h.264 its odd you don't have a ProRes option as that's normally the default

Any suggestions about how I can add it back in?  I dont remember doing anything different when I installed FCPX, I originally had imovie but I didnt import anything from that, I downloaded a free version and then upgraded it after the month trial.  Have tried creating a new library and new project and I can pick the 422 option when creating the new project but still no export option appeards :/

Possibly when I imported the videos from the avchd (imported directly into FCPX) I didnt do the optimise media option, would that remove it?

Aha! Ive found out how to get it to export to prores 422, only I had it set to computer not video and audio, the only problem now of course is that the resultant file is going to be 38gb not 6!  how do I reduce that?!

Not so much an answer as a workflow suggestion - when you are creating image sequences, group images together in a Compound Clip. Enter that clip and export it as ProRes 422. Overwrite the compound clip (this is saved in the browser) with the rendered video. This can run in the background while you continue to edit, but will save final export time as FCPX won't have to decompress/conform each still image.
If you need to make changes later, drop the original compound clip back into the timeline, add new images etc, and export again.

nice idea like it!

I found in the end the easiest way was to leave the video to render everything as I hadnt done this, it took about six or seven hours to do but once done the actual sharing in h264 format only took about an hour to do, which isn't that bad.
I could change the share version to video and audio and then pick prores but the resultant file would have been nearly 40gb! I have no idea how long it'd take to spit that out, possibly shorter than the rendering and sharing time of the other filetype combined but then I'd have a file approximately 7-8 times the size and not suitable for uploading online/to youtube etc, and any resizing that I'd need to do would probably end up taking an extra chunk of time as well, in the end I'll just make sure I have my projects render overnight before I need to do stuff with them...


text:
Attempting to focus on two people talking across a table to each other
Im not sure if this the right place for this but I run a small youtube channel, there's two of us and we often record by facing each other across a table about a meter apart, with the camera to the side and we talk to each other and look to the camera as we talk.
We have a panasonic DMC-GX80K that sits about 1.5 meters back and is hooked into a black magic box to stream to the PC to capture in obs but I can't work out how to get the thing to stay focused on our faces and our videos keep coming out slightly fuzzy/blurry.
What is the best way to ensure we both remain in focus throughout the video, or is that nearly impossible given the setup and we're better off just sitting next to each other when we record?

It looks like you're trying to achieve a wide depth of field. This is done with your camera's aperture. A smaller/more closed aperture (higher f-number) lets less light in, but gives you a wider DoF.
Try closing your aperture as much as possible. This may require you to light your subjects more and/or boost your ISO. Bear in mind that a boosted ISO can add grain to your video.
Also, it's possible that your lens is dirty. You can clean the front and back of your lens with a microfiber cloth and lens cleaner.
Lastly, I know it's not your question but I want to throw out there that a phone camera may be what you need. Modern phones can capture exceptionally high quality video, and typically have a very wide depth of field. May be worth looking at!

Awesome thankyou I shall give that a try!

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


text:
Audio quality deteriorates on Rendering
I have a video from which I extracted audio to clean it using Audacity. I applied both High Pass Filter (50 Hz) and Low Pass Filter (1000 Hz)  and then used Noise Gate to remove unwarranted noise.
Now, when I merge the audio back with the video, it plays fine in the Editor (I have tried several paid and free programs), but after rendering, the audio quality becomes very poor with constant random noise in background.
What may be the cause of it? Any idea?
Edit -  I found out that the rest of the audio stays almost the same, but the voice's texture changes to be a lot noisy. I am sure I'm doing something wrong, but cannot point out what.

Can you post any samples?

@AJHenderson How should I post them? Would a link be fine?

Yeah, a link is fine as long as you also have a description of it (which you do).

Yeah, sure. Will post link to both - the raw version and the version ripped from the Rendered Version

https://clyp.it/tv1lvbtw    2. https://clyp.it/4zbr3fic

The audio is clipping internally somewhere from the sound of it.  The background noise gets louder and so does the speaking, but the speaking is getting crushed.  I'd double check if there are any adjustments being applied in the render.  It sounds like either an incorrectly adjusted limiter or possibly an additional signal boost being applied.  It might also be rendering in to a lower bit depth that clips.

Even when using a simple audio-video merger, the problem persists.


text:
after affect delay layer animation
I am new to AE and I am trying to edit a Photo Album template ( its a video of a photo/videos album flipping pages ).
I managed most of my requirements, but failed to make some of the transitions longer. ( I need the page to delay the turn because the videos are longer than the current duration ). Thanks

It is a bit unclear what you are asking. Could you explain what you have tried doing and perhaps provide a sample video?

I am using this template:
https://www.youtube.com/watch?v=1HkcLwFs4nw and I am trying to add videos, but the page duration is to short

@MichaelLiebman , is there a way I can send you the AE project privately ?

Sending it outside of SE would defeat the purpose. It is better to post screenshots of the UI.

In the composition where you drag and arrange individual pages. Pick the layer of the page you want to make longer, then click and drag that layer in the timeline to the desired length.

If you have the full project, look for "02. Product Overview" tutorial, fast forward to 1:55 min to see how it is done.


text:
Recover broken kazam video file (.mux)
History :
Here is some background of this long lasting problem : https://answers.launchpad.net/kazam/+question/218308
I am posting it to get some valuable suggestions from video gurus here.
About Kazam :
kazam is a screen recording tool which also records audio. Once the recording is finished, a popup comes and then we can save the video into a mp4 file.
Problem :
Sometimes, in particular when the screen recording time is large like, 2~3 hrs, in those cases, the pop up does not come up. so, basically we cannot save the recorded data into a file.
We find 2 residual files. with .movie and .mux

kazam_5e8ob247.movie.mux (~ 1.2 GB)
kazam_5e8ob247.movie (0 bytes)

.movie file is of 0 bytes. So, this is just a temporary file.
.mux contains the real data and is of ~1.2 gb.
How can I recover the .mux file?
Notes :
I see from kazam source code (https://github.com/sconts/kazam) that it is using Gstreamer internally.
So, can you please suggest an appropriate gst-pipeline that can convert .mux into a playable .mp4 file?
To provide more details, I tried to get some information about the recorded stream using gst-discoverer-1.0. But it fails saying it cannot read any details.
gst-discoverer-1.0 kazam_5e8ob247.movie.mux
Analyzing file:///home/sandeep/sw/samples/kazam_5e8ob247.movie.mux
Done discovering file:///home/sandeep/sw/samples/kazam_5e8ob247.movie.mux
An error was encountered while discovering the file
 Could not determine type of stream.

First 1 MB :
To analyze, the first 1 MB of the file can be found here

Please, post first 1mb of your file for analysis

@bukkojot I just added the link for the 1 MB of the video in the description

There's a baseline H.264 stream in there, so this was meant to be a MP4. Generate a short video with kazam using the same settings as the broken one. Then use recover_mp4 from http://slydiman.me/eng/mmedia/recover_mp4.htm

Thanks @Mulvya.. Looks very promising. As it needs a windows PC, I will try it later and will share the result. Tank you again.

I just finished my own tool for video recovering: https://github.com/bookkojot/mp4fixer - try it.

the answer to this question was posted by bukkojot as a comment to this question on 2017/10/12: https://github.com/bookkojot/mp4fixer
This tool fixes exactly this problem. I tried it and it worked for me.
There are a few simple steps involved, instructions are enclosed. You need a short properly saved video on the same machine with the same kazam to use as input so it knows what the headers should look like. And you get the mp4 from the temporary movie.mux.

Thanks Jmarina. Accepting it as answer.

If audio is enough to be recovered, use VLC directly.

open VLC
go to media convert/stream, select the mux file, then convert
select profile audio-mp3 and then edit it, go to audio tab and check keep original audio track

I tried several attempts for video converting, but no success. At least the audio steps worked for me.


text:
Preserving Frame Rate
I'm a physicist with no experience in video production.
I work with satellite imagery and I have created timelapses where one frame corresponds to one minute. It matters I preserve the time/frame rate. However, I am finding this difficult
Using Adobe Premiere Pro I track features on the satellite imagery using a coloured dot (using timeframes etc), then export this as a movie which I analyse using a script I have coded. I then get data regarding where the coloured dots are, their velocity and the interactions between them. However, my velocities are meaningless at the moment because of the frame rate issue - I can't preserve the 1 frame for one minute issue. Sometimes premiere pro skips frames or doesn't update the whole frame, etc.
I cannot get the frames to be preserved though my animation process. I have a counter on the timelapse which increases by 1 for each frame. In the finished video, this no longer increases by 1 for each frame.
I really want to maintain the frame rate and stop "interlacing", i.e. where the whole frame doesn't update. I just want the original video with my animations on them - no other changes.
Edit with examples
The interlacing problem:

This frame is repeated twice in the resultant video:

Full video (2Mb) can be found here. (https://www.dropbox.com/s/x0dmj9j8br2j4y3/AL_202_Tracking%20copy.mov?dl=0). When going frame by frame, note that the frame counter of the original timelapse at the bottom right hand of the screen does not match that of the resultant video with animation overlay. The solution ideally needs to have each frame of the original timelapse match that of the resultant video. i.e. each time you move forward a frame, the counter increases by an integer.
If anyone is interested what you are looking at; its x-ray imagery from the Hinode satellite (NASA/JAXA) pointing at the sun, looking at eruptions from the sun.

It isn't really clear what you are asking here.  How is Premiere skipping frames?  How do you realize this is occurring?  On a rendered video, there is no reason there should be skipped frames unless something is wrong with your playback engine?  Do you mean that you are using premiere to do the tracking and it is sometimes losing the track?

Added example. On rendered video, see that the counter does not always increase by one when moving frame by frame. On the original timelapse, this is the case, i.e. each frame increases the counter by 1. Premiere is working fine, apart from exporting in a way which does preserve the frame rate.

What output settings are you using?

At first I did not understand your question, after you have supplied the example video I understood what your problem is.
The issue is that when you import the Images, Premiere Pro assigns a default Frame Rate to them, which might be different from what you desire.
Changing Sequence Frame Rate does not change Images default Frame Rate when you import them, to fix this you can do the following:

Create a new Project
In Project Window right click > import > select first Image only and check Image Sequence.

Right click on Image Sequence in Project Window > modify > interpret Footage.

check "Assume this frame rate" and set desired FPS and click OK.

Drag Image Sequence from Project Window to Timeline. Then Render/Export as usual and make sure the Frame Rate at export matches the one you set up earlier.

NOTE: Image Sequence imported, Sequence in Timeline and Export Settings have to have the same Frame Rate.
That is all. You should not have any Skipped or Extra Frames in output video.


text:
Which lossless RGBA codec should I use for share animations sequences between my different video software?
All is in the question. For the moment, I use PNG image sequences which is cool but sometimes I wonder if a better option exists. I heard about HuffYUV but I never tried it because it wasn't easy to find informations about it. Anyway this format should be the most standard as possible.
Software I use are : Sony Vegas, Blender, Max/MSP Jitter, After Effect, Processing, etc...
Any Idea ?

What's wrong with PNG?

If you want to do more research, what you're looking for is an intermediate codec. Other examples are ProRes, DNxHR, and GoPro Cineform (all proprietary, the last two are free, ProRes is only available on non OSX-encumbered machines via ffmpeg). They're minimally lossy, support high bit-depth, all I-Frame and fast to en/de-code. I have them all installed, but my intermediate codec of choice is .png sequence.

@Mulvya I think it is possible to obtain a better compression and so better performance by taking account of multiple frame.

@stib +1 for intermediate codec, I will have a look to these, but I'm wondering if a software like Sony Vegas will be able to use them, that's always the problem...

Also, I don't know if that's really a problem but working with images sequences leads to a huge amount of tiny files of various size and I don't like the idea it fragments my hdd like that :( ...

You can save PNGs as a MOV, using ffmpeg: ffmpeg -framerate 25 -i in%d.png -c copy out.mov

You can get better compression with intra-frame codecs like h.264, but you get worse performance, because multiple frames need to be processed to display one frame. All of those codecs will be smaller than png sequences, but at the expense of being lossy.

And fragmentation is going to happen regardless. Fragmentation is actually where large files don't fit into the available gaps on a hard drive and get broken up by the OS into fragments. Small files fit into available gaps better, so are less likely to be fragmented. But yes, it can be tedious working with folders containing tens of thousands of files.


text:
New Monetisation system on YouTube
I have a channel on YouTube and unlike those "soccer skills and tricks" videos, i upload only videos of top goals from latest matches (30 to 40 seconds long).
Now, my channel is growing at a good rate (without any paid views) but according to new Monetisation system, you should have atleast 10,000 all-time views to be eligible for Monetisation and after reaching 10,000 views, channel will be checked for (voilating or not) community guidelines.
What are the chances that my channel will pass this test and i can monetize.
(None of my videos have copyright strike and none of them have logo like "BeinSports", "FS1" etc. )

YouTube came up with the 10k views policy to prevent spammers and channels that make money with offensive content.
So as long as your videos are legit without any copyright strikes, there shouldn't be any problem. In any case, your real worry should begin after your channel is monetized. Countless channels, big and small, have criticized YouTube's incessant and often invalid strikes just because some big company claimed so. Watch this by Chriss Stuckmann to know what I mean. I highly recommend it for YouTube creators, especially those new in the game.
And finally learn more about Youtube Fair Use.
Good luck!


text:
Metadata says the video is 25i, but MPC plays it as 50i
I have a DVD with footage which I want to convert to h264/h265. Mediainfo says that the video is 720x576, MPEG-2 encoded, PAL 25 fps and interlaced which is the first time I've seen that, usually 25 fps is progressive.
Media Player Classic plays the video at 50 fps and applies deinterlacing, but VLC plays it at 25 fps without deinterlacing by default. I suspect that the metadata is incorrect, it should read 50i instead of 25i - is it possible?
Is there a way to fix it? Avidemux, Virtualdub and others see the video as 25i and doubling the framerate to 50 either duplicates frames or uses frame-blending, both options look worse than what MPC manages to display.
Here is the Mediainfo's readout: https://pastebin.com/cWKsUraM

Paste the mediainfo readout about the file.

@Vlives, you pasted info about the newly encoded MKV, not about the original VOB.

25i and 50i are the same thing. 25i means "25 frames per second, interlaced". 50i means "50 fields per second", the latter implies interlaced video.
Likewise, 30i and 60i are the same thing. Basically, if the number before "i" is larger than 30 then it means number of fields, otherwise it is number of frames. All the existing interlaced systems I know of use 2 fields per frame. There were some systems that used 4 or even 8 fields per frame.
DVD are encoded to produce interlaced output. They also have flags that allow to save space by not repeating unneeded fields or frames. These flags are widely used in 60 Hz DVDs, I don't know how commonplace they are in 50 Hz DVDs. If the original title was a movie, you likely should treat it as 25p, not as 25i/50i or 50p.


text:
DaVinci Resolve: Track with points outside of a window
I am completely new both to video editing and DaVinci Resolve 14.
I would like to apply stabilization to a clip which has a constantly moving and changing object in the middle. Therefore I only want to track points which are outside of a certain region in the middle of the screen.  Is it possible to mark the middle region by drawing a power window and then track everything that is outside of it?
So far I have been trying to manually draw an "inverse window" which selects mostly everything except the middle.  Is this the right way to go about it?

The button to invert the power window is next to the tool that you used to create the selection.  You're using the pen tool in this case, but the same is true for ellipses, rectangles, gradients, etc.  Immediately to the right of the tool is an icon of a square outline around a solid circle.  That's the invert selection button.  If you click it before you start your tracking, the tracker will follow everything outside of the shape you drew instead of everything inside the shape.
It's often helpful to toggle "highlight mode" so that you know what's currently selected.  Shift+H is the shortcut for that.  Everything that's grey with highlight mode on is not part of the current selection.  The tracker will follow everything that IS selected, i.e., everything that you see (that isn't grey) when highlight mode is on.
As you become more proficient with power windows, qualifiers, and trackers in Resolve, you'll want to learn how to combine multiple shapes, combine shapes other qualifiers, or combine any/all of the above with alpha channels from external files.  The "invert" power window button is a small part of a larger toolset.  There's more to explore under the "Key" tab, which will let you control how one node passes a mask or matte to another node.  There's also the "Key mixer" node, which allows boolean operations.  To access the Key mixer, right-click in the background of the node editor, and select it from the "Add node" submenu.

The tracker is designed to track whatever you put inside the tracker's window.  It doesn't matter whether you want to track something in the middle of your frame or on the edge.  All that matters to the tracker is that it can "see" enough detail of whatever it's being told to track that it can lock on it in the various dimensions it can track: pan, tilt, rotate, zoom, and 3d perspective.
Your background looks really tricky to track because it's very low contrast (relatively speaking).  You could dramatically boost the contrast of your background, for the purpose of building a good track, then use that tracker data on the non-contrast-enhanced image.  Just use a square or a circle over a small but distinct area you want to track and it should be good.
BTW, now you know why people who need to do VFX use Tracking Markers


text:
DaVinci Resolve: Fix insufficiently smooth top-down drone footage
I am completely new to both video editing and DaVinci Resolve, so please bear with me.
I have some drone footage which looks directly downwards onto a flat surface.  It has panning, rotation and zooming (up to a factor of 2.5) at the same time.  However, because I wasn't able to control all three types of motion well enough at the same time, it's not as smooth as it should be. For example, the panning stops at one point in time rather suddenly, then resumes.  It's not too bad, but I would like to make it perfect by editing it in DaVinci Resolve 14 (free version).
This was my original plan of action:

Stabilize the footage.  I expect to get a rotating and ever shrinking rectangle, with black borders.
Use keyframe animation to re-create the appropriate rotation, panning and zooming in a smoother way.  It's okay to crop a bit, since the source is 4K and I output 1080p.

Since I am literally a complete beginner with Resolve, I wasn't sure how to do it. This is what I tried:

I drew a power window to avoid the middle of the scene, which contains lots of chaotically moving objects. (See my other question.)
I went to Tracking → Window, and unchecked Tilt and 3D.  I clicked track forward, and allowed the program to track using automatically selected points within the window.
I copied the tracking data and switched to Stabilize view.  I selected "Classic Mode", as I wasn't able to figure out the new stabilizer.  I pasted the tracking data.
I left Strength at 100 and Smooth at 0. I unchecked Zoom to allow black borders. I clicked the "Stabilize" button.

This was the only way I could get the system to apply the stabilization to the clip.  It gave me an okay-ish result, but after stabilization there is a new and distracting jerkiness in the clip, and I do not know how to get rid of it.  If I set "Smooth" to any value between 1-99 (instead of 0) and click Stabilize again, then it won't stabilize at all.  Why is this?  How can I smoothen out the stabilization?  Does it have to do anything with the fact that there's zooming difference of 2.5 between the end and beginning of the clip?
The jerkiness probably comes from inaccuracies in tracking. The clip zooms into a flock of birds on a shallow lake. I can only use the somewhat blurry lake-bed for tracking because the birds are constantly moving, so I do not think the tracking itself can be improved. However, simply smoothening out the tracking data would clearly fix the problem, if only I know how to do that.
Other than the jerkiness problem, I can animate the pan/zoom/rotation and achieve the general effect I wanted.  But I am still not sure that I am approaching this problem in the correct way.  How would you do it?

This is 10 seconds from the clip (downscaled).  It's ungraded, so low contrast.  You can see that the panning motion stops at the 5 second mark. This is what I am trying o remedy.

Can you share a sample of the video? That might help people understand what the issue is and offer suggestions.

Thank you for the comment @Michael. I shared 10 seconds, downscaled to 1080p with Quicktime.

@MichaelLiebman I'm new here. Do you think there is anything I can do to get an answer to any of the three questions I asked?

It's a small but growing community, so not every aspect of every piece of software will get fast answers. Generally the questions that get the quickest answers are the most focused. I'm sorry I can't help with this one, I'm an engineer, not an editor.


text:
ffmpeg repackaging AVI (h264) into mp4 gives choppy playback in html5 video on chromium
I have file.avi which contains a h264 video:
$ ffmpeg -i file.AVI
Input #0, avi, from 'file.AVI':
  Duration: 00:00:20.61, start: 0.000000, bitrate: 1530 kb/s
    Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuv420p, 640x480, 1459 kb/s, 18 fps, 18 tbr, 18 tbn, 36 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 44100 Hz, stereo, s16p, 64 kb/s

When I convert to a mp4 container using:
ffmpeg -i file.AVI -vcodec copy -acodec copy test.mp4

This produces the following file:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:20.72, start: 0.000000, bitrate: 1515 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x480, 1455 kb/s, 18 fps, 18 tbr, 18432 tbn, 36864 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, s16p, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

The output mp4 file plays in chromium using html5  but is choppy / stutters as it plays.
The file plays smooth in firefox, and also in the desktop viewer (Totem), but I need it to play smooth in chromium.
Are there any ffmpeg flags I need to set to achieve this, or is it something inherently wrong with Chromium?
Note: if I re-encode the file with ffmpeg -i file.AVI test2.mp4 the result works fine in Chromium, but I can't do this (for speed) I'd like to just re-package the h264 video... which almost works.
EDIT: The choppy playback occurs on both Linux (Ubuntu) and Windows and in both Chrome and Chromium.
EDIT 2: Full output from command (note, using flag -an to remove the possibility it's an audio issue.)
Input #0, avi, from 'file.AVI':
  Duration: 00:00:20.61, start: 0.000000, bitrate: 1530 kb/s
    Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuv420p, 640x480, 1459 kb/s, 18 fps, 18 tbr, 18 tbn, 36 tbc
    Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 44100 Hz, stereo, s16p, 64 kb/s
[mp4 @ 0x1734d80] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480, q=2-31, 1459 kb/s, 18 fps, 18 tbr, 18432 tbn, 18 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x1734d80] pts has no value
    Last message repeated 370 times
frame=  371 fps=0.0 q=-1.0 Lsize=    3664kB time=00:00:20.61 bitrate=1456.2kbits/s
video:3661kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.066175%

Notes:

Adding -fflags +genpts removes the [mp4 @ 0x1734d80] pts has no value error, but does not improve the playback.
Adding -flags:v +global_header removes the [mp4 @ 0x1734d80] Codec for stream 0 does not use global headers but does not improve the playback
Setting the tbc output using -r ## does not improve playback
Setting tbn using -video_track_timescale ## does not improve playback

Show the complete console output from the command, not just an excerpt. Also, provide a link to the input file if possible. Why does the input show mp2 audio and the output mp3?

The audio is odd as I'm using -acodec copy I assumed it was just repackaging. I'll see if I'm allowed to share the actual file. Thanks.

Can you show the complete console output? Do you have a link to a file so we can attempt to duplicate the issue?

I ran into this same stuttering after remuxing to mkv and then playing the video on a Roku.  Solved the issue by first fixing the avi with the mpeg4_unpack_bframes filter, then remuxing that as mkv.
See https://www.ffmpeg.org/ffmpeg-bitstream-filters.html#mpeg4_005funpack_005fbframes
Posting here as this is the top Search result when searching "avi to mkv stutter".

ffmpeg says that this BSF only works on mpeg4, not h264, so it's a valid answer but not if the input video is h264.

As of the date of your post, this was already a reported bug. You stated that you had this problem both in Windows and Ubuntu. For Windows at least there was a reported workaround:
For Chrome: Navigate to chrome://flags
Enable "Enable D3D11 Windows"
Chromium uses switches instead. It appears that the corresponding switch for Chromium is -d3d11See: https://peter.sh/experiments/chromium-command-line-switches/ for more switches to modify Chromium`s behavior. Perhaps these will help you reach a solution that you are happy with. Since other players and browsers are capable of playing the same file smoothly, it doesn't seem logical (at least to me) to blame the encoding.
This is likely no longer necessary as the aforementioned bug was reported Fixed and closed Oct 2015 (at least on Windows)
EDIT: Since Firefox and totem use gstreamer plugins, it would appear that you may be able to resolve this issue by adding a gstreamer backend to chromium. It appears that this approach was first announced by the Samsung Open Source Group July 6, 2015 and that there is a github project here./ChromiumGStreamerBackend) Further information and details on how to implement this approach can be found here.

Thanks for the sleuthing - but that flag is not available (at least in Ubuntu chromium). I'd suspect a bug fixed and closed in 2015 is not the culprit.

@Trees4theForest As of the first edit in your question it's clear that this problem occurred in Chrome as well. If not a bug in the browsers mentioned, Where do you think the problem lies if not with the player. I hope you don't mind me quoting you. "The file plays smooth in firefox, and also in the desktop viewer (Totem)"

I agree it's an issue with the browser. I was not aware of the command-line flags (thanks for the list) but unfortunately d3d11 is not the culprit. (I also tried a variety of GPU / video flags, none of which helped).


text:
After Effects automation and annotation tools (scripts) for student work
I need a professional advice for self-assessing among students. I am searching for a tool (script or scripts) that helps annotating very long videos in After Effects. I also would like to automate the process without repeating myself.
I have long speeches (narrations) of students with subtitles. Subtitles are edited in Subtitle Edit. In Subtitle Edit at the beginning of some words or sentences I add symbols like [#] or [$].  After importing video and subtitles (pt_ImportSubtitles) with added [#] and [$] symbols I would like a specific lower third (simple text annotation or feedback) to be automatically activated (appeared on screen) (for 3 sec) for each imported word or group of words (marker or timestamp) with specific symbols.
Let us say that I have two lower thirds. First lower third is associated with words starting with а [#] (valid argument ) symbol and other set of words are associated with any words starting with [$] (invalid argument).
Examples
[#] Moscow is the capital of Russian Federation
[$] Moscow is not a capital of Russian Federation

If [#] is repeated 30 times then the firt lower third must also be appeared 30 time. Same logic is for [$] symbol.
Texts for lower thirds preferably must be stored outside of AE in a spreadsheet for example (Text2Spreadsheet)
Please let me know if a tool (script or a set of scripts) that I am searching is indeed exists or not.
If not. How can I do it manually with scripts that I mentioned above ?
Thank you all

This can be done with scripting, but I doubt there's already a script that does what I think you want. Why not separate the subtitle process and the lower third process, it would make it much simpler.

Lower thirds are completely speared from imported subtitles (timestamps) I just use subtitles timestamps (markers) to trigger lower thirds to be appeared when it is needed.

Sorry. Not all subtitles timestamps but subtitles containing symbols like: # and & only. In the beginning of certain subtitles.

As I've written on my blog, you can use the function evalFile to load the contents of an external file as data or executable code.
So if you have a file called titles.txt that looks like this
var titles={
    {startTime:1.23, endTime:2.23, textContent:"this is the first subtitle"},
    {timestamp:2.34, endTime:3.45, textContent:"this is the second subtitle"},
    {timestamp:4.56, endTime:5.55, textContent:"and so on…"}
}

…you can evaluate it as part of the source of the expression, so that the titles array is now available to the expression.
So you could do something like this with the source text property of a text layer:
try{
    myPath = “/path/to/my/titles.txt”; //obviously the path to the file
    $.evalFile(myPath);
    for (var i=0; i < titles.length; i++){
       if (time > titles[i].startTime && time < titles[i].endTime){
           titles[i].textContent;
       } else { ""; } //blank text
 }catch(err){
 “ERROR”;
}

What that does is:

load up the subtitles file,
scan through the titles and look at each one to see if the current time is between its start and end points
if the time is right for the subtitle to display then it sets the source text to the subtitle content, if not sets it to a blank string.

Other layers could use the startTime and endTime variables to drive other properties such as opacity or anything else you can animate.
If your subtitle time stamps are represented as smpte timecode you'll have to add a converter to the expression. There's one here.
You can use a capable text editor (notepad++, atom, sublime text, vim etc) to reformat the subtitles file, or you could use JS text processing tools (eg. regex, string.split, string.replace etc) in the script to parse the subtitles file. I'd recommend against the latter, they're going to be a lot slower. Remember that the expression is evaluated every time the frame is rendered, which includes reading the subtitles file from disk. If you have motion blur on, that could mean dozens of times each frame.

Thank you for your help.
I just wanted to make several lower thirds and apply them over (30 or 50) stamps which strings starts by [#] (symbol associated with first lower third) and then I apply second lower third to all stamps which strings starting with [$] (symbol associated with second lower third). Please see screenshot above.
In your code, I do not see how to do that (search for strings starting with [#] or [$]). I am wrong ? Sorry. As you see, English is not my first language.

Just save out your subtitles as an srt or whatever, then using a text editor like the ones I mentioned (all free) reformat them so that they look like the example above. You can use find-and-replace and regular expressions. You could add code to the expression that looks for the symbol, javascript has lots of string processing tools, most of which work in expressions (though they're not documented), but you'd be better off doing it in a text editor.

Check out Marker Remap at www.aescripts.com/marker-remap . It takes the principles you mention above and adds a powerful After Effects panel to control marker additions and timing. You won't be able to customize it to your tags, but I think it offers the functionality you're looking for.


text:
Static frame video and a motion-intensive appendix: how to render fast?
A frequent task is to render a 5–30 minutes video from a single image + soundtrack and then append a pre-rendered outro logo animation sequence.
Output is hd720 h264 mp4 for YouTube.
What would be the fastest aproach to combine a lo-motion static image part with motion-intensive tail animation and produce a quality result?
I tried rendering the image part and then concat the outro:
ffmpeg       \
  -loop 1    \
  -r 24      \
  -i $IMAGE  \
  -i $AUDIO  \
  -t $AUDIO_LENGTH  \
  -c:a aac   \
  -profile:a aac_low  \
  -ar 48000  \
  -b:a 192k  \
  -bsf:a aac_adtstoasc  \
  -strict -2 -y  \
  -c:v libx264  \
  -profile:v high  \
  -preset veryfast  \
  -tune stillimage  \
  -crf 24  \
  -x264opts bframes=2  \
  -pix_fmt yuv420p  \
  -safe 0  \
  $RENDER

ffmpeg  \
  -f concat  \
  -safe 0  \
  -i <(printf "file '%s'\n" ${RENDER} ${OUTRO})  \
  -c copy  \
  -y  \
  ${OUTPUT}

This renders rather fast but the appended logo reveal gets garbled. That's because of the h264 compression settings, I guess.
Maybe I could somehow imitate the two-pass rendering of h264 mp4? I know the exact length of the first part and it contains zero motion. There's the second animation and I can "prepare" the 1st pass for it ahead.
Please advice, how would a ffmpeg Pro aproach the task?
Upd. here are the properties of the appended outro:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'outro.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.14.101
  Duration: 00:00:03.19, start: 0.000000, bitrate: 263 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 77 kb/s, 24 fps, 24 tbr, 12288 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 181 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Show the file properties of the outro.

@Mulvya thank you for the attention! I updated the question with outro file properties. I wonder if there a way to build an mp4 file with two distinct compressions settings for the two parts?

As I can see, you know duration of your song, it good.
I can suggest this trick:

Generate 5 second of video with static image. With good settings, good fps, slow encoding and so on. Video must be without audio.
Join this video with itself as many times, as you want, so duration will be a little more of your clip. This operation not requires reencoding, so can be performed very fast.
Split your clip to exact size as you need. (no re-encoding)
Join outro to file
Join your file with audio (without re-encoding for video, but audio you can modify based on your needs. If you want to upload it to youtube, you can not reencode audio, youtube does it itself)

This can be pretty fast.

Thank you for the suggestion! Will try soon and report here. Which container/codec, capable of the fastest concat protocol concat:video1|video2|video3 do you recommend? I used huffyuv recently, but not sure which is better. Disk space is not limited.

huffyuv is codec, not container. Try to use avi, I love this old container. Codec must be x264 or any other which you want in final video


text:
ffmpeg live streaming to Periscope: bitrate appears too high
I just noticed Periscope Producer capability to accept live streaming from external sources.
A quick test with ffmpeg fails to fit bitrate requirements of 160kbps max for audio. Periscope says my audio bitrate is "475.243 kbps", while allowd max is 160kbps.
"testsrc" creates a test pattern video and "sine" filter generates a 440Hz tone with beeps. I tried various settings to limit video and audio bitrate, but none seems to work. Here's the latest test:
ffmpeg -f lavfi -i testsrc=rate=30:size=960x540,format=yuv420p \
    -f lavfi -i "sine=frequency=440:sample_rate=44100:beep_factor=4" \
    -vf "
  drawtext
    =fontfile='/Library/Fonts/MyriadPro-Regular.otf'
    :fontcolor='#ff6600'
    :fontsize=64
    :text='%{pts}'
    :x='w/2 - text_w/2'
    :y='h/2 - text_h/2'
" \
    -c:v libx264 \
        -crf:v 26 \
        -preset:v fast \
        -pix_fmt yuv420p \
        -x264opts keyint=60:no-scenecut=1 \
        -maxrate:v 600k \
        -bufsize:v 1400k \
        -bt:v 100k \
        -g 60 \
        -b:v 600k \
    -c:a aac \
        -bt:a 10k \
        -b:a  128k \
        -y  -hide_banner \
    -f flv \
    -flvflags no_duration_filesize \
    rtmp://de.pscp.tv:80/x/MYSECRETKEY

Periscope complains:

Please advice how to limit aac audio bitrate so it fits under 160kbps?
ffmpeg displays this while running:
Input #0, lavfi, from 'testsrc=rate=30:size=960x540,format=yuv420p':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 30 tbr, 30 tbn, 30 tbc
Input #1, lavfi, from 'sine=frequency=440:sample_rate=44100:beep_factor=4':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #1:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fcd5b050800] using SAR=1/1
[libx264 @ 0x7fcd5b050800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fcd5b050800] profile High, level 3.1
[libx264 @ 0x7fcd5b050800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=60 keyint_min=6 scenecut=0 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=26.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=600 vbv_bufsize=2400 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://de.pscp.tv:80/x/MYSECRETKEY':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], q=-1--1, 600 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.89.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 600000/0/600000 buffer size: 2400000 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, mono, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc57.89.100 aac
frame= 8146 fps=156 q=32.0 size=   10323kB time=00:04:29.93 bitrate= 313.3kbits/s speed=5.17x

[SOLVED] My fault: missed the -re flag that would limit speed of reading the generators at a speed of playback. My ffmpeg was streaming data to Periscope much faster than the playback, thus exceeding the bitrate limits. Following is the working code:
ffmpeg \
    -re \
    -f lavfi \
    -i testsrc=rate=30:size=960x540,format=yuv420p \
    -re \
    -f lavfi \
    -i "sine=frequency=440:sample_rate=44100:beep_factor=4" \
    -vf "
  drawtext
    =fontfile='/Library/Fonts/MyriadPro-Regular.otf'
    :fontcolor='#ff6600'
    :fontsize=64
    :text='%{pts}'
    :x='w/2 - text_w/2'
    :y='h/2 - text_h/2'
" \
    -c:v libx264 \
        -crf:v 22 \
        -preset:v fast \
        -pix_fmt yuv420p \
        -x264opts keyint=60:no-scenecut=1 \
        -maxrate:v 600k \
        -bufsize:v 2400k \
        -g 60 \
    -c:a aac \
        -ac 2 \
        -b:a 96k \
        -maxrate:a 96k \
        -bufsize:a 192k \
    -f flv \
    -flvflags no_duration_filesize \
    -y  -hide_banner \
    rtmp://de.pscp.tv:80/x/MYSECRETCODE

Your total bitrate in that execution is 313 kbps, so audio can't be 475 kbps. Save to FLV file and check.

I see that too and I'm completely lost: why does Periscope show those irrelevant high bps numbers?  Periscope bug?

[SOLVED] My fault: missed the -re flag that would limit speed of reading the generators at a speed of playback. My ffmpeg was streaming data to Periscope much faster than the playback, thus exceeding the bitrate limits.

Interesting. Strange that Periscope does not check incoming timestamps for this.

I missed the -re flag that would limit speed of reading the generators at a speed of playback.
My ffmpeg was streaming data to Periscope as fast as it can, much faster than a live stream would, thus exceeding the bitrate limits.
Working code, that will stream a test table with a timecode running on top of it to Periscope:
ffmpeg \
    -re \
    -f lavfi \
    -i testsrc=rate=30:size=960x540,format=yuv420p \
    -re \
    -f lavfi \
    -i "sine=frequency=440:sample_rate=44100:beep_factor=4" \
    -vf "
  drawtext
    =fontfile='/Library/Fonts/MyriadPro-Regular.otf'
    :fontcolor='#ff6600'
    :fontsize=64
    :text='%{pts}'
    :x='w/2 - text_w/2'
    :y='h/2 - text_h/2'
" \
    -c:v libx264 \
        -crf:v 22 \
        -preset:v fast \
        -pix_fmt yuv420p \
        -x264opts keyint=60:no-scenecut=1 \
        -maxrate:v 600k \
        -bufsize:v 2400k \
        -g 60 \
    -c:a aac \
        -ac 2 \
        -b:a 96k \
        -maxrate:a 96k \
        -bufsize:a 192k \
    -f flv \
    -flvflags no_duration_filesize \
    -y  -hide_banner \
    rtmp://de.pscp.tv:80/x/MYSECRETCODE

You can use option -ab, like -ab 32000 for 32kbit/s bitrate audio. But here may be problem: not all codecs (encoders) can support so small bitrate. For example, libaacplus can do even smaller, but it was removed from ffmpeg.
You can use options -qmix and -qmax for define video quality. Try something like -qmin 32 -qmax 64. Also, check -bufsize, you set it to 1400k.

Thanks! I tried -ab 128k with no improvement: my ffmpeg lists 323kbps, Periscope goes crazy with 591kbps sound bitrate. qmin/qmax are video options. Somehow video bitrate is okay for P.
Setting bufsize doesn't seem to affect "periscope bitrate".

try very low values like -ab 32000 -qmin 50 -qmax 64

I already found the cause of error: missed the -re option. Without it my ffmpeg was streaming content as fast as it could: ahead of "live" time.


text:
Color changes after video to single frame images back to video using ffmpeg
Given master video in mov rle:
Video: qtrle (rle  / 0x20656C72), rgb24(progressive)

Converted the video to a serie of single .bmp frames.
ffmpeg -i source.mov $FRAMES/f%03d.bmp

Frames from unchanged parts I recompiled to mpeg ts intermediate files:
ffmpeg                   \
-framerate 25            \
-start_number $i         \
-i "$FRAMES/f%03d.bmp"   \
-vframes $n              \
-c:v libx264rgb          \ # libx264
  -preset slow           \
  -tune animation        \
  -crf 20                \
  -pix_fmt rgb24         \ # yuv420p
-bsf:v h264_mp4toannexb  \
-f mpegts                \
-y -an -hide_banner      \
"$FOLDER_TS/_${i}_${o}.ts"

To other part of the clip I applied filters like pad, zoompan, format. Overlaid PNG with transparency, animated. Output to the same format h264 .ts
Concat the .ts parts to mp4 movie file.
Color seems to have changed a little. Can be noticed when joining source movie with the processed one.
What stage of the process could affect the slight changes in colors?
Is it the pixel format conversion or BMP format usage?
How to convert movie file to sinlge frame images preserving exact color?

other part of the clip I applied filters --> what exactly?

Clip length is 10s @ 25fps = 250 frames.
Frames 1–50 and 208-250 are kept as is, I render them directly to .ts
Over middle frames I overlay PNG with padding and use zoompan to scale/position. All parts joined together looks consistently in color.
The slight color difference occurs compared to the original master video.

You can’t convert between RGB and YUV perfectly. It’s a lossy conversion.

Thanks @SlimSCSI, after posting the question I figured that too. I tried changing libx264 to libx264rgb and yuv420p to rgb24. That reduced color difference but it's still in place.
What else could possibly go wrong? Is BMP format with its bgr24 a good option for intermediate images?

Updated code in question with codecs and pixel pformats I tried.

Solved the problem by setting colormatrix conversion using swscale lib. Added to my filter chain:
scale=in_color_matrix=bt601:out_color_matrix=bt709

and
-colorspace bt709

to the output.

References

ffmpeg scale filter
ffmpeg colormatrix filter
colorspace on ffmpeg wiki
question on video.stackexchange

Credits
Found the advice on VideoHelp forum reply from 2017, which in turn references the question on this video.stackexchange.  Thanks again, Gyan!


text:
How to keyframe zoompan filter in ffmpeg?
I am trying to animate an image position and scale on top of  background video. Moving between frames, say, 1 and 15. And scaling from frame 24 to frame 42.
overlay filter does its job moving the image at a time well.
I'm lost with the zoompan filter. Here's my current filtergraph:
video.avi >----------------------------------->|-------|
                                               |overlay|-> out.mp4
image.png >-> scale >-> zoompan >-> zoompan >->|-------|

Scale up the image 10 times for jitter-free zoompan. The first zoompan is set to z=1 and enabled till start of zoom (frame 24). Second zoompan increments zoom by a step to reach from 1 to 2.3 in 18 frames (24..42). I would add third zoompan to keep the image at 2.3. If second one is prolonged further it starts looping the zoom-in effect.
ffmpeg -i $FOOTAGE -loop 1 -i $IMAGE -filter_complex \
"
[1:v]
  scale=10*iw:-2
  ,zoompan=
    z=1
    :d=1
    :s=500x100
    :enable='lt(n,24)'
  ,zoompan=
    z='min(zoom+1.3/18,2.3)'
    :x='iw/2-(iw/zoom/2)'
    :y='ih/2-(ih/zoom/2)'
    :d=19
    :s=500x100
    :enable='gte( n, 24)'
[name];
[0:v][name]
  overlay=
    x = '1005 - 250 + 80 - min( 80 * n / 15, 80)'
    :y='406-50'
    :enable='lte(n,130)'
" -t 7 -y  -hide_banner out.mp4

How can zoom an image between certain keyframes somewhere in the middle of the sequence? I.e. zoom goes from 1 to 2.3 between frame A and frame B.

With loop added, you are generating a video stream from the image. Now, zoom is applicable within the processing loop of a single frame, and pzoom for video streams. Also, zoompan doesn't have timeline editing support, no enable won't work. So,
ffmpeg -i $FOOTAGE -loop 1 -i $IMAGE -filter_complex \
"
[1:v]
 zoompan=
    z='if(gte(in,24),min(pzoom+1.3/18,2.3),19.3/18)'
    :x='iw/2-(iw/pzoom/2)'
    :y='ih/2-(ih/pzoom/2)'
    :d=1
    :s=500x100
[name];
[0:v][name]
  overlay=
    x=1005-250-3*n
    :y=406-50
    :enable='lte(n,173)'
" -t 7 -y  -hide_banner  out.mp4

zoompan is timeline-capable: see output of ffmpeg -hide_banner  -h filter=zoompan – it reads  "This filter has support for timeline through the 'enable' option.".   Besides it kind of works to me already, when I set d=19 for the zooming part.

Commit aa26258f on Aug 27 removed that flag, after the avfilter framework was tweaked.


text:
How to fit word to width with ffmpeg drawtext filter?
A script takes a single word 3 to 11 characters long, draws it with a custom font and overlays on top of a video. The word should fit a certain width.
The animation involves pan and zoom that the word follows. Maybe this compositing job suits smth like After Effects, but the task is ffmpeg implementation. I made it work with the shortest 3-character long sample word and the longest 11-character one.
drawtext filter generates a transparent png with big margins around the text. zoompan filter does the zooming afterwards.
I determined the font size for 3- and 11-char sample words and tried linear interpolation to get font size, depending on the word length. This approach fails with some words, as the font has variable width letters, and "MMM" vs. "III" differs n times in width.
Is there a way in ffmpeg to fit a variable-width text to fixed dimensions?
Maybe some filter to detect a least-sized rectangle with non-transparent pixels?
Plan-B works fine: bash function that calculates word length depending on each letter width in the particular font. Had to measure each letter width in Photoshop in pixels at 100pt font size.
Still wondering if there is a way ffmpeg could scale font size text to fit some fixed width.

Were you able to find any FFmpeg command option to solve this problem?
Is bash function mentioned in Plan-B working for you? Can you share that bash function here? I am also facing the similar issue and not able to find a solution yet.

@Raju I added my answer with the solution and the code.

There's no way to force the drawtext filter to fit the text in a certain width.
What you can do, is get the rendered text dimensions in a first pass and then run drawtext accordingly in 2nd pass, or crop and scale the output using the values from first pass.
For first pass,
ffmpeg -i video -vf drawtext=fontfile=path/to/font:fontsize=FinalSize:text='Lorem Ipsor' \
                   :x=0+0*print(tw):y=0+0*print(th) -vframes 1 -f null -

This will print the text at the top-left. The print statements will output
84.000000
14.000000

The first value is tw - the width, and the 2nd th - the height, in pixels.

I love this idea, but that print(tw) just gives me an unexpected token error from ffmpeg.

Usually a matter of correctly quoting and/or escaping arguments, based on your shell.

Thanks....yes, Bash was barfing on the parens without quoting the filter.

Also, I ran into an issue of way to much output to stderr for grabbing those values, so I used print(tw,0) which put the results in the "panic" loglevel, making it easy to set "-loglevel panic" and only have the width/height returned.  However it wanted to do this for the entire video which ended in buffer overflow, so I also set "-t 1" before the input video to limit the input length to 1 second.

Better than using print, is using -loglevel debug, you'll get something like [Parsed_drawtext_0 @ 0x7fc1c3704c00] n:0 t:0.000000 text_w:138 text_h:33 x:0 y:0

debug will produce a lot of text. You'll then to need to use grep or similar to pare it down.

I know this question is about achieving the result with the drawtext filter.
However this might be an alternative approach using the ass filter.
in="Slow_when_flashing_school_zone_traffic_sign_in_Chinese.jpg"
txt="school_sign"

ffmpeg -i "$in" \
-vf "zoompan=z='min(zoom+0.005,1.5)':y='if(gte(zoom,1.5),y,y+1)':x='x':d=125,\
scale=w=600:h=800,\
fps=fps=25,\
ass=${txt}.ass" -f nut pipe: | ffplay pipe:

Preview: (the color changing text is the animated subtitle)

Since ASS is very flexible and can be formatted extensively this might be worthwhile to explore.
You might want to have a look at Visual_Typesetting and ASS Override Tags (search for Animated transform and \t tag).
I suggest to generate the ASS file with Aegisub as a starting point. If you need to, you could further improve it with a text editor.
File and Image:
File: school_sign.ass (proof of concept)
[Script Info]
; Script generated by Aegisub 3.2.2
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: PC.601
PlayResX: 600
PlayResY: 800

[Aegisub Project Garbage]
Video AR Mode: 4
Video AR Value: 0.750000
Video Zoom Percent: 2.000000

[V4+ Styles]
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: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:04.94,Default,,0,0,0,,{\an5\fscx100\fscy100\t(0,3960,\fscx150\fscy150)\frz5.811\4c&H000000&\4a&HFF&\c&H2A2A2A&\3c&H000000&\3a&HFF&\move(307,527,460,755,0,3920)}Slow when flashing! School zone

Image: Slow_when_flashing_school_zone_traffic_sign_in_Chinese.jpg
Daniel Case / CC BY-SA (https://creativecommons.org/licenses/by-sa/3.0)

I call FFMPEG from python and this worked with me:
from PIL import ImageFont

translation_font = ImageFont.truetype(
    "SourceCodePro-Regular.otf", size=55, encoding="unic")
w, _ = translation_font.getsize(" ".join([line, word]))

Which will put the width of the text (rendered with the given settings) in w.
Based on that you can find the first word that makes the text get outside of the screen and insert a new line before it
def fit_text(string: str, frame_width):
    split_line = [x.strip() for x in string.split()]
    lines = ""
    w = 0
    line_num = 0
    line = ""
    for word in split_line:
        # Make a test
        w, _ = translation_font.getsize(" ".join([line, word]))
        # If it exceeds the frame width, add a new line
        if w > (frame_width - (2 * 6)):  # Leave 6px margin on each side
            lines += line.strip() + "\n"
            line = ""

        line += word + " "

    lines += line.strip()  # Append leftover words
    return lines

My solution that works well was to manually measure every letter width. I typed letters in Photoshop at a relatvely large font size to minimize rounding effect of pixel size and measured widths in pixels.
Given the word I determine its length and calculate the scale factor to make it fit required length.
Function that calculates the word width for the Cyrilllic alphabet and a paricular typeface:
# Given string calculate its length based on the font metrics.
# Letter widhts measured in pixels at 100pt font size in Photoshop.
function textWidth {
    local word=$1
    local varname=$2

    local widths=(73 59 65 52 80 56 56 105 66 73 73 75 76 102 69 78 70 62 67 64 74 86 76 81 66 90 102 75 84 63 60 105 70)
    local alpha="абвгдеёжзийклмнопрстуфхцчшщъыьэюя"
    local total=0
    local i

    strindex() {
        local x="${1%%$2*}"
        local length=${widths["${#x}"]}
        total=$(( length > 0 ? total + length : total + 74 ))
    }

    for i in $(seq 1 ${#word}); do
        strindex $alpha ${word:i-1:1}
    done

    eval $varname="\"$total\""
}

Hey, @Serge thanks a ton. I will update you how it goes. Have a good day ahead.

I would need it for English alphabets and few supported special symbols, I will have to recalculate the width I suppose. Also, I may have to extend this feature to a different language in future.


text:
ffmpeg zoompan filter zoom value limits
Does ffmpeg zoompan filter has a cap for z value? I tried a simple test that stops zooming up at 10.5. Is it that 10.5 is the maximum value for the z parameter or is there a limit for maximum frame dimensions?
zoompan=z='print(zoom + 0.5)'
Output:
2.000000
2.500000
3.000000
3.500000
4.000000
4.500000
5.000000
5.500000
6.000000
6.500000
7.000000
7.500000
8.000000
8.500000
9.000000
9.500000
10.000000
10.500000
Last message repeated 26 times

If there is such a limit its worth mentioning in the docs as well as the minimum of 1. That matters when choosing the tool to implement a certain effect.
I wish ffmpeg had some versatile capability of arbitrary zoom and positioning video input without limitations, like in any compositing software.

worth mentioning in the docs --> will appear in a few hours.

zoom value is capped between 1 and 10.
I wish ffmpeg had some versatile capability of arbitrary zoom and positioninig video input without limitations
Patch welcome.


text:
Why both videos are of same file size?
I am using ProMovie Recorder to record high quality videos using iPhone X, and I noticed a weird thing today.
Here's what I did:

I recorded a 4K 60fps video for 6 seconds (HEVC encoding).
I recorded a 4K 30fps video for 6 seconds (HEVC encoding).
Both the above videos captured the same physical content.
Both videos were captured with the same bit-rate, ~118 Mbps.

Here's what I found:

The two videos I captured (with different fps) are of the same file size - 84MB. How? Why?

Question

A higher frame rate video with same bit-rate as that of a video with
  lower frame rate should be double the file size, shouldn't it?
Why isn't there a difference in file size? More the number of frames
  will lead to more the file size, since we're storing extra 30 frames
  for every second, right? Or is the underlying HEVC encoding optimises the file
  size for higher frame rate videos?
Or, can slight differences in exposure cause significant file size difference?
Please correct/clarify.

Bitrate is set and measured per second of media duration, not per some number of frames. So, the fps doesn't matter.

Thanks. So it won’t make a difference even if the frame rate is like, 1000fps?

In theory, no. In practice, it depends on how well the encoder's rate-control works. At 1000 fps, an encoder in normal circumstances would force many keyframes, and it would be hard to keep to the limit. But notionally, yes, the fps doesn't matter.

As it seems both videos have a bitrate of 118 (117) megabits per second.
This means - regardless off any other parameter - your video will take up 118 mb for each recorded second.
But as you already noted, a video with double the FPS should have double the data, so if you originaly exported the 4k60 video with 118, you can export the 4k30 video with 57mb/s and gain about the same quality.
There's more to it like diffrent codecs optimized for diffrent types of videos or Interframe Compression, so you can compress high FPS a bit easier. It is recommendable to go slightly above the half.
Keep in mind, that many consumer cameras tend to have a low bitrate for high FPS as the camera is not able to record more.

So is it okay to consider that 118 mbps is divided into 60 for 60 FPS and 30 for 30 FPS? Can I assume that 60 FPS video has lower per-frame quality than 30 FPS video? Is this assumption right?

a video with double the FPS should have double the data: that's not exactly true, because when using codecs that support inter-frame compression doubling the frames while keeping the same number of I-frames only produces little difference on the output size

@BadhanGanesh Kinda yes, but as mcont already noted, there's a bit more toonit like Interframe compression which works a bit better with higher FPS. It is diffrent from codec to codec, but generally, you will get about half as much + a bit more data from half the FPS.


text:
Recover mangled VirtualBox-generated WebM video
When being called by the Indian "Microsoft" department I let them join in on my VirtualBox virtual machine, and started a video capture to catch any details on them.  Doing so, VirtualBox creates .webm video files.
However, when I now play back that webm file, I see it got mangled right where I changed the VM's resolution.  The session lasted an hour (phew...), and at the end I managed to thwart their futile hack attempts at setting a system password on my machine, and instead logged back into the connection they then broke.  I think I then saw some full-screen dashboard environment - maybe theirs?  Could have some very handy info it this is true!
The mangling seems like it's just a scanline-length issue in the video stream.  Tricky thing here is that the video itself is all correctly in 1024x768 resolution, but the payload is just an 800x600 area in the middle (with black borders around it).  That inner area is what got messed up further in the video.  The black borders remain OK, so it's just VirtualBox's source data stream for the middle part that got misaligned.
Does anyone know of some procedure or software I could use to try to de-mangle this video?  I've already seen that webm video files use a Matroska-based standard and use an EBML coding; I've already tried changing some headers values in the EBML structure to fudge the display resolution (making the black borders misaligned but the middle payload OK), but that led nowhere fast (each 5 secs of video or such has it's own header block as well).
Addition:
To be precise: the video was rendered at 1024x786 pixels, while the virtual machine ran at 800x600.  This results in a fat black border surrounding the inner captured content during the entire video.  Once I increased the virtual machine's window size (to, say, 1200x650 - really couldn't say exactly), the black border remained the same in size, only the inner content in it gets mangled.  With mangled I mean that it looks like it displays the now longer scan lines of 1200 pixels and wraps them in the 800 scanline length, thus each next real scanline gets offset by the horizontal size difference since the previous line is wrapped in it.  Or at least, that's what I thought initially, but looking at it again I'm having my doubts on that theory as well.
Well - that's not clear at all :)  I've uploaded a frame here:

and a short video fragment here:
short fragment of scam video
(the issue happens halfway through the fragment)
But, to be honest, I think I'd better give up.  I start to suspect that the only possible fix is to do pixelgrabbing in the old frames and build a new video out of that, if that's even a fix - i.e. too much effort.  Shame, though, since I'd really like to review the content at the end...
Solution:
Thanks to bukkojot, I've come up with the follow (Windows targetted) app that fits in the middle of the ffmpeg cmdline he gave; maybe someone may find it useful?  Note that the "RGB24" in the cmdline must be "rgb24" when using the latest ffmpeg version on Windows, which brings the cmdline I used to:
ffmpeg.exe -i scamvideo_problem.webm -f rawvideo -pix_fmt rgb24 pipe: | restorer.exe | ffmpeg -f rawvideo -pix_fmt rgb24 -s 1103x436 -i pipe: -vcodec libx264 resolvedvideo.avi

The video came out legible (apart from color shifts), and all parties dragged into it have been notified (iTunes, gmail, TeamViewer and VICIdial).
Anyway, this is the C++ code I ended up using:
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <Windows.h>
using namespace std;

int main() {
    const size_t inLineSize = 1024 * 3;
    const size_t inFrameSize = 1024 * 768 * 3;
    const size_t outFrameSize = 1103 * 436 * 3;

    const size_t inPayloadLineSize = 800 * 3;
    const size_t inPayloadNumLines = 600;
    const size_t inPayloadFrameSize = inPayloadLineSize * inPayloadNumLines;
    const size_t inTopBorderNumLines = 84;
    const size_t inLeftBorderNumPixels = 112;
    const size_t inPayloadOffset = inLineSize * inTopBorderNumLines + inLeftBorderNumPixels * 3;

    const size_t outPadSize = outFrameSize - inPayloadFrameSize;

    _setmode(_fileno(stdin), _O_BINARY);
    _setmode(_fileno(stdout), _O_BINARY);

    char* inFrame = new char[inFrameSize];
    char* outPadding = new char[outPadSize];
    memset(outPadding, 0, outPadSize);
    while (!feof(stdin)) {
        size_t sizeLeft = inFrameSize;
        char* nextReadPos = inFrame;
        while (!feof(stdin) && sizeLeft > 0) {
            size_t bytesRead = fread(nextReadPos, 1, sizeLeft, stdin);
            sizeLeft -= bytesRead;
            nextReadPos += bytesRead;
            if (sizeLeft > 0) {
                Sleep(100);
            }
        }
        if (!feof(stdin)) {
            char* inPayloadPos = inFrame;
            inPayloadPos += inPayloadOffset;
            for (size_t inLineNr = 0; inLineNr < inPayloadNumLines; ++inLineNr, inPayloadPos += inLineSize) {
                fwrite(inPayloadPos, 1, inPayloadLineSize, stdout);
            }
            fwrite(outPadding, 1, outPadSize, stdout);
        }
    }
    return 0;
}

By mangled, do you just mean size, or decoding errors?

@Mulvya: it's... I'll update the post to give more details :)

After a bit manipulation... You see...

Most easiest way for you:

Write very simple app in C, which will read 1024*768*3 bytes and pads by zeros to 1327*768*3 bytes. It easy for you.
Dump raw pixels with ffmpeg, pipe data to your app, pipe data to ffmpeg back

Something like:
ffmpeg -i scamvideo.avi -f rawvideo -pix_fmt RGB24 - | ./a.out | ffmpeg -f rawvideo -pix_fmt RGB24 -s 1327x768 -i - -vcodec libx264 newvideo.avi

All other options to your taste. I think, you got idea.

The luma has been aligned but not the chroma, which will be half-sized.

@bukkojot: SO MANY THANKS!  You don't know how badly I wanted that video restored!  Now for the execution of it :)  I'll indeed be able to do it, but I've got to find some time first... got the video anyway, so it won't be going anywhere in the meantime.

@Mulvya: * the chroma - if it's legible enough, I'm a happy camper :)

started working on it anyways, but I guess my time isn't the limiting factor - it's the running time :)

This task very easy. You need hour or two.

Thought so as well, but since I'm working on Windows it proved more difficult than anticipated.  The conversion works, but I can't get ffmpeg to pipe correctly to my app.  Skipping the pipes and writing via temp files is not viable either for RAW output at that framerate for 1 hour :)  To be continued after this weekend.

Be sure to use binary mode. Under windows it very matters. Use winapi to binary read/write

@bukkojot: binary mode was indeed key.  And... I've got the video back!  Well, only the top 3/4 of the frames since that's the only part that got crammed in the inner 800x600 portion.  Anyway, got the e-mail address they tried to use to receive iTunes giftcards on, as well as the desktop they have in front of them (they use VICIdial Web Client).  Success!  Off to contact fraud@itunes, fraud@teamviewer, fraud@VICIdial and maybe the local police (but I think I won't bother with the last).  Couldn't have done it without your answer!

And another comment for anyone trying the same feat: DON'T use Powershell - in it you can use pipes, but it has the nasty habbit of trying to buffer the whole stdout output from one app before piping it to the next... won't work in this case of course.  Took me some hair pulling to figure that out...


text:
Streaming HLS from a video4linux2 virtual video device
I'm trying to accomplish a few things at the same time with the raspberry pi camera;

create an HLS live stream
take regular interval jpg snapshots and save them to disk
irregularly record short pieces of video to disk triggered by another process

Running the HLS stream on its self works well with raspivid, psips and ffmpeg like this:
raspivid -n -w 1280 -h 720 -fps 30 -t 86400000 -b 10000000 -o - | /root/psips | ffmpeg -loglevel 2 -y -analyzeduration 10M -i - -c:v copy -hls_time 5 -hls_list_size 10 -hls_wrap 20 /var/www/stream.m3u8

Since it's not possible to get access to the video device when it's already in use by raspivid, I create multiple virtual video devices for the desired scenario with v4l2loopback.
The first virtual device (/dev/video1) is created by running ffmpeg in the background like this:
ffmpeg -f video4linux2 -video_size 1280x720 -r 24 -input_format h264 -i /dev/video0 -vcodec rawvideo -f v4l2 /dev/video1

Then I try to start the HLS stream like this:
ffmpeg -i /dev/video1 -r 24 -f h264 - | /root/psips | ffmpeg -loglevel 2 -y -analyzeduration 10M -i - -c:v copy -hls_time 5 -hls_list_size 10 -hls_wrap 20 var/www/stream.m3u8

For some reason this results in ffmpeg producing quite a few 'Past duration 0.xxxxx too large" errors and psips exiting with a 'SPS/PPS overrun!' warning.
I'm not sure what's happening here or if there's something wrong with the approach I've chosen maybe?

I don't know how raspberry encodes video, but if you got encoded stream, you can:

Setup local RTMP server
Transcode it to HLS on the fly (this is cheap task, build-in in nginx rtmp server)
When you need, you can get screenshots with ffmpeg
When you need, you can record as many videos as you want with ffmpeg/rtmpdump
Feed video/images everywhere else you want

Since here only one stream, here must be no problems with stream errors.


text:
ffmpeg - Make a white line look thicker
I've been actively playing around with ffmpeg for the past few days, and now I want to make an audio visualiser, just with the showwaves filter (I made it white using p2p mode, and I don't want to use a mode that would just fill the wave with white).
The problem with the showwaves filter is that it creates a very thin 1px line which makes it pretty hard to see when it varies really fast. At a low video bitrate it becomes almost invisible.
So I tried several ways to make this thin white line look thicker, including geq to increase alpha values, gblur+increasing contrast. For now I got the most "satisfying" results by making the size of the showwaves 10x smaller and then using scale to make it the size I want. But the result is very pixelated so that's not really suitable. I've also thought of duplicating the wave a lot and displacing the copies around but I don't think it would be very performance-friendly.
So I was wondering whether there is anyway of adding some outline/glow/shadow/anything that would make this line look a bit thicker (like 5px would be enough), or anything else than showwaves that would somehow achieve what I'm looking for.
Thanks

An example of adding dilation might look like:
ffmpeg -i example_in.mp3 -filter_complex \
"[0:a]showwaves=mode=p2p:s=1280x480:colors=Magenta|Azure|White:r=25; \
 [v]dilation=threshold3=10[v]" \
-map "[v]" -map 0:a -pix_fmt yuv420p \
-b:a 360k -r:a 44100  example_out.mp4


text:
How to change the grey color of a clip block in the grey timeline in FCPX
in the FCPX timeline, is there a way to change the standard grey color of a clip?  so i can notice it quickly between hundred other grey clips in the timeline ? Imagine the convenience...

Modify > Edit Roles
Choose a colour, then right-click an item in the Browser or in the Timeline to Assign that new Role.

Ok this sounds promising , but i was already stuck , at choosing the color.

yes - that can be a problem  ; )


text:
KdenLive: Nothing is being rendered on Windows?
Let's start off from the beginning: I have already configured KdenLive to point to the melt.exe file, and all the other proper plugins to allow rendering.
When I hit "Render" and try to render to a file, I am told that it has started to render, and then I am instantly told that the render completed successfully, in 00:00:00. However, there's nothing saved to disk.
I tried analyzing the script that generates when you select "Generate Script". It seems to be giving a "usage" dialog due to incorrect parameters. I'm wondering if maybe this is the problem. It reads as follows:
C:\Users\b4ux1\Documents\Vlogs\2017-10-22>"E:/Kdenlive-
17.08.1/kdenlive_render.exe" "in=0 out=100 "E:/Kdenlive-
17.08.1/share/mlt/melt.exe" atsc_1080p_60 avformat -
"file:///C:/Users/b4ux1/Documents/Vlogs/2017-10-22/2017-10-22_001.bat.mlt"
"file:///C:/Users/b4ux1/Documents/Vlogs/2017-10-22/2017-10-22.webm" f=webm
vcodec=libvpx acodec=vorbis crf=15 vb=0 quality=good aq=7 max-intra-
rate=1000 cpu-used=4 threads=4 real_time=-1"
Kdenlive video renderer for MLT.
Usage: kdenlive_render [-erase] [-kuiserver] [-locale:LOCALE] [in=pos]
[out=pos] [render] [profile] [rendermodule] [player] [src] [dest] [[arg1]
[arg2] ...]
  -erase: if that parameter is present, src file will be erased at the end
  -kuiserver: if that parameter is present, use KDE job tracker
  -locale:LOCALE : set a locale for rendering. For example, -locale:fr_FR.UTF-8 will use a french locale (comma as numeric separator)
  in=pos: start rendering at frame pos
  out=pos: end rendering at frame pos
  render: path to MLT melt renderer
  profile: the MLT video profile
  rendermodule: the MLT consumer used for rendering, usually it is avformat
  player: path to video player to play when rendering is over, use '-' to disable playing
  src: source file (usually MLT XML)
  dest: destination file
  args: space separated libavformat arguments

Had the same problem and fixed it. Sort of in agreement with Alisha's fix.
Check the Settings-Configure Kdenlive-Environment-MLT environment.
Because I had both an installed version and a standalone version on my disk, the automatic setting is pointing to different paths. If the path is not set correctly to point to the ffmpeg, ffplay, ffprobe, mlt, melt, then the software cannot correctly call those exes to perform the render operation.


text:
If the environment being captured on a video stream becomes less complicated, does the bit rate and latency decrease?
For example, a live GoPro video is being streamed to a HDMI capture software on Windows. The live stream of an office with the lights on has a bitrate of X and a latency of Y ms. If the lights in the office are turned off so all that is captured in the live video stream is a red light bulb and a black background, will the new bitrate be less than X? Will the new latency be less than Y ms?
The resolution is maintained throughout at 1080p at 60fps.
I'd appreciate any help you folks can be!

so all that is captured in the live video stream is a red light bulb
  and a black background

No. You can't get black background. You will get any possible type of noises, many shadows and all kinds artifacts of camera's matrix.

will the new bitrate be less than X?

No. As GoPro writes constant bitrate (CBR)
No. As new noises can require even more bitrate than static image.
Yes, if you will fill background with black color in video editing software and select non-CBR mode for compression

Will the new latency be less than Y ms?

No. Delay causes by some buffers. Buffers for N frames, buffers for N bytes. If you lower bitrate, you can INCREASE delay in some cases (actually, it's true to very low bitrates).

Like much with technology (and life), it depends. You didn't specify what software, protocol, or codec you are streaming with, so there are quite a few variables.
Will the bit rate drop?
If you are using a constant bit rate (CBR) codec, no it will not. As the name implies, the bit rate is always the same regardless of the content.
If you are using a variable bit rate (VBR) codec, it might be lower than when the lights are on. It may also not be significantly lower, because, as the other answer alluded to, you will get a lot of noise. When the light level drops, the camera will automatically increase the gain which will result in color artifacts in the dark area, like in the sample video below. It is very difficult for codecs to handle noise, so you might actually see an increase in the bit rate over a brightly lit scene with little movement.

Will the latency drop?
If you are using a codec that has several latency modes, then the it might. However, most of those codecs are commercial products that are either a proprietary codec or fudge things in incompatible ways within the standard. That makes it unlikely that you are using one of those codecs. On top of that, those codecs usually make you select the latency mode before starting the stream and it is then fixed while the stream is up.


text:
Two different video streams on PC. How do I sent each video stream into a separate monitor?

For example, in the picture I have video stream A and video stream B. How can I sent each video stream into separate video outputs, so that each video stream can be sent to its own monitor or video capture device?
Please note, I am not looking to extend the display as used in the Windows 10 display settings.