text:
FFMPEG fails to convert to usable x265 MP4 after reinstalling Windows/flashing BIOS
I use the following command to convert videos recorded by Nvidia ShadowPlay to x265:
ffmpeg -i "%fn%.mp4" -c:v libx265 -crf 28 -c:a aac -b:a 128k "%fn%.x265.mp4"
I've done this for the past year+ with no problems.  Recently I reinstalled Windows,  flashed my BIOS, and obviously reinstalled ShadowPlay.  Now whenever I run this command against these MP4 files, despite there not being any errors in the console, it creates a corrupt, unplayable file that is dramatically smaller than expected (tried in MPC-HC and MPV).  Files I converted prior to reinstalling still play fine in these players.
I'm sort of at a loss as to what to do without any errors and MPC-HC just says "Cannot render the file", but I don't see how to get any extra information (in a log or whatever).  I grabbed the latest ffmpeg (4.2.1) as I was using 4.1.3 before this, but it made no difference.
Any ideas?  Are there other easy to use command line x265 converters?
Here's the output of converting a 10gb file.  I'm using the -ss switch as I have in the past, but it does the same even without it.
C:\Users\langdonx\Videos>set fn=s11w3oct31-nov6

C:\Users\langdonx\Videos>ffmpeg -i "s11w3oct31-nov6.mp4" -ss 5:04 -c:v libx265 -crf 28 -c:a aac -b:a 128k "s11w3oct31-nov6.x265.mp4"
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's11w3oct31-nov6.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
  Duration: 00:24:09.32, start: 0.000000, bitrate: 57968 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 57764 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.0_Au+21-bac0e1acb874
x265 [info]: build info [Windows][GCC 8.3.1][64 bit] 8bit+10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 12 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=6 deblock sao
Output #0, mp4, to 's11w3oct31-nov6.x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
    Stream #0:0(und): Video: hevc (libx265) (hev1 / 0x31766568), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.35.100 libx265
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.35.100 aac
frame= 7634 fps= 17 q=-0.0 size=  183296kB time=00:04:15.07 bitrate=5886.8kbits/s speed=0.579x
C:\Users\langdonx\Videos>echo.

C:\Users\langdonx\Videos>echo COMPLETE!
COMPLETE!

C:\Users\langdonx\Videos>pause
Press any key to continue . . .

ffplay output:
ffplay sw.x265.mp4
ffplay version 4.2.1 Copyright (c) 2003-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000019655161240] moov atom not found0
sw.x265.mp4: Invalid data found when processing input

mpv output:
C:\Users\langdonx\Downloads\mpv-x86_64-20191215-git-2dbe33c>mpv sw.x265.mp4
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
Failed to recognize file format.

Why would ffmpeg create these broken files but not report anything in the output?  Do I need to enable some hardware feature in my BIOS?  ffmpeg itself supports the AAC codec I'm using right, or do I need to install one somehow?

Does ffplay it? What's the log of mpv?

@Gyan Didn't even think to try ffplay... I added ffplay and mpv output to the bottom of my question.

Does ffmpeg -i in -c copy out.mp4 produce a playable file?

Yes, with the same length and size as the original.

Since it takes so long to convert something and end up in a failure state, I've taken my smallest file (6:32 @ 2.48gb) and I'm running some isolated tests against it. I cropped it down to 2 minutes with -copy and when I convert that, it produces a playable file.  Using -ss 0:00 -to 0:30 also produces a playable file.  I'll see if I can figure out which conditions fail.

It seems to fail at random... I did the first 4m30s and it worked... and every a few further tests, returned to do another 4m30s test and it failed.  Maybe I need to run memtest?

@Gyan I changed the output container from mp4 to mkv and ran my 4m30s test again... the file is playable but it's only 2:02 long...

Yes, I suspect a HW failure mode.

I'll run memtest, but mkv is seemingly working 100% without fail now.  Are there certain requirements for mp4 (memory, disk, etc) that mkv output doesn't need?

Not really; main difference is ffmpeg writes the MP4 metadata after all the media data is written.

Ah, makes sense.  I've converted 8 or so files, all of the mkv files are playable (I guess, obviously), but some are shorter than the original.  It looks like ffmpeg is dying somewhere along the way but not throwing any errors in the console.  Trying to glean some information from changing the loglevel.  Still need to make a bootable thumbdrive with memtest86.


text:
How exactly did analog TV cameras work?
Before the invention of the CCD, how were analog video images captured? Specifically, what process occurred between the optics of the camera, and the resulting analog electrical signal (not necessarily ready to transmit)?

Welcome! You've asked some very broad questions. There are whole books on the subject. Two I'd recommend are the Standard Handbook of Video & Television Engineering and Video Engineering.

They didn't need tape if they were transmitting live. They simply sent the signals to a radio transmitter, or to tape for recording.
This is how television and video worked for nearly 80 years before digital video came along.
I'd suggest reading the Wikipedeia pages on Video and the History of Television as a starter.

I just fail to understand which device exactly captured light and converted it to signal. I really can't think around the CMOS.

I think Michael's comment is correct then - you need to go through a much broader set of reading materials. I'll close this question as far too broad. If you read his and my links, that will start you off.

source: Stack Exchange

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

sort: votes


text:
ffmpeg: av1 getting worse results than hevc (h265)
I converted an avc (h264) file to an hevc (h265) file and an av1 file.
Relative to the hevc (h265) file, the av1 file is far larger in size, and the av1 file has worse psnr and ssim results too.
With the hevc (h265) file, i used the default crf setting (28)
av1 doesn't have a default crf amount, but i used the ffmpeg recommendation of 30
Here's the command i used to do the hevc (h265) conversion
C:\Users\l\Desktop\6-app\ffmpeg -i y.mp4 -c:v libx265 -preset 8 -vf scale=1920:1080 -r 60 -ab 192k -ar 48k -map_chapters -1 -map_metadata -1 z.mp4

Here's the command i used to do the av1 conversion
C:\Users\l\Desktop\6-app\ffmpeg -i y.mp4 -c:v libaom-av1 -crf 30 -b:v 0 -strict experimental -vf scale=1920:1080 -r 60 -ab 192k -ar 48k -map_chapters -1 -map_metadata -1 z.mkv

Here are the psnr and ssim results of the hevc (h265) file
ssim
Y:0.981764 (17.390662)
U:0.992258 (21.111573)
V:0.992246 (21.104816)
All:0.985260 (18.315015)

psnr
y:41.620801
u:48.257839
v:47.699066
average:42.905441
min:38.873493
max:58.862531

Here are the psnr and ssim results of the av1 file
ssim
Y:0.923286 (11.151250)
U:0.991684 (20.800862)
V:0.987425 (19.004970)
All:0.945376 (12.626126)

psnr
y:27.332443
u:44.955360
v:41.569108
average:29.034062
min:8.783696
max:59.518112

Here are the size results of the files
avc
3.9 mb

hevc (h265)
4.6 mb

av1
9.59 mb

I know i'm compressing an already well-compressed file, I didn't necessarily expect a smaller file size - but i did expect av1 to outperform hevc (h265))
Here are the actual files
combo-3-avc-original.mp4
combo-3-hevc.mp4
combo-3-av1.mkv
Why would such poor results occur?
edit:
· here are the versions of the tools
ffmpeg version N-93389-gd15117c996
[libaom-av1 @ 0000025b4839bf40] 1.0.0-1458-ge40c226a6
libavutil      56. 26.100 / 56. 26.100
libavcodec     58. 47.103 / 58. 47.103
libavformat    58. 26.101 / 58. 26.101
libavdevice    58.  6.101 / 58.  6.101
libavfilter     7. 48.100 /  7. 48.100
libswscale      5.  4.100 /  5.  4.100
libswresample   3.  4.100 /  3.  4.100
libpostproc    55.  4.100 / 55.  4.100

libaom is still an experimental encoder - performance will remain in flux for the time being. Which build are you using?

@gyan · i edited my post with version details at the bottom

libaom version?

@gyan ? how do i check libaom version

When you encode using libaom, ffmpeg log will have a line like this, [libaom-av1 @ 0000000003990500] 1.0.0-1475-g7c64a0dca

@gyan [libaom-av1 @ 0000025b4839bf40] 1.0.0-1458-ge40c226a6

@gyan · it looks like my version is old ? how do i update it

Not that old. It's from Mar 13 2019. Try asking at Doom 9.

@gyan · i registered on their forum · it said that i'd need to activate my account via email · i def put in my correct email · yet, i received no activation email · i checked my junk folder too · also, there's no button to re-send the activation link · and so, i'm unable to use the doom 9 forums

@gyan · i sent an email to error@doom9.net regarding the registration not working · i never received a response though

Register from another email address.

Latest version of ffmpeg in May 2021 and I confirm significantly worse compression efficiency of AV1 compared to H265, despite the far slower encoding time.

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


text:
Reverse & Time Ramping Effect Issue
What I'm trying to do is to show part of clip and then start reversing on it...
So i made a key frame and add a "speed remapping" effect, slow the video, then i duplicate that video, and everything to this point is fine... the video start normally, goes to the speed of zero, then slowly back to normal speed in reveres.
Now i want to do the reveres in higher speed, to the beginning of the video... so using trim tools, i extend the reversed video to the very beginning, and here's the buggy part:
I drag the "speed remapping" up, to speed it up, it get speeds, but the issue is, it adds from the begin of reversed clip not the end... and it cause my two clip to goes out of sync... it slows down in one frame, and start to speed up in a totally non related frame.
How to make it extend on the end point
Thank you.

Edited
Visual Explaination:
Okey, Here's a normal timeline with some marker to show the effect...
So think about this, as our begin state:

No i add another marker at the end, and start changing speed, as you can see the end of the clip got shorter, but our previous marker are same, it mean it fill the shortage from the end of the clip (cut from end)

Now i undo to our begin state and reverse the video clip

You can see the begin state of reversed state

Now i add a marker at the end, same to what we did with the first video...
and start speeding up the video, as you can see this time our existing marker are moving, and it adds frame to the begin of clip not the end

Now here what i have, this little guys in here suppose to show a part of event which i important to me, then slow down to freeze, then reverse and maintain the speed, then goes to higher speed to the very beginning of the movie

But when i add/change the marker, instead of add/remove frames from the end of second clip, it take them from the start, and cause those two clip (specific frames) goes out of sync. it end at some place, and start at somewhere totally not related

Kinda hard to understand what's going on here. A screenshot might help get you better answers.

@stib I added the screen shots

@stib so no one hold the answer? :'(... how to anchor to the first frame on timeline (which is last frame on actual reversed clip) and do time remapping, which increase or decrease the amount of loaded clip from the end?


text:
How to encode HEVC with alpha without a Mac?
I am trying to produce a file that Safari on Apple devices will play with alpha support. I don't actually have any Apple devices, though, and all of the instructions I've found for doing this suggest that it can only be done on a Mac. But, I did some searching and reading, and it looks as though the latest version of the x265 command-line utility adds alpha support in software on any platform where it'll run.
Here's the process I've arrived at so far:

The video itself is being created using FFMPEG, using a filter chain that builds up an animated alpha layer and applies it, on a frame by frame basis, to another video.

I can get it to produce a suitable WebM file encoded with VP9. To do this, the tail of the command-line is: -c:v libvpx-vp9 output.webm
To produce an HEVC with alpha file, I have built version 4.0 of the x265 command-line utility from source code at https://bitbucket.org/multicoreware/x265_git, and then the tail of the FFMPEG command is changed to: -f rawvideo -pix_fmt yuva420p output.yuva420p. This, of course, produces an absolutely massive uncompressed raw video file. :-)
Then I run this command to encode the video:
x265 --input-res 606x692 --fps 30000/1001 --alpha --crf 20 output.yuva420 output.hevc

Then I put this into a container using mkvmerge:
mkvmerge output.hevc -o output.mkv

For some reason, the timescale on this is all messed up. It thinks there are twice as many frames as there actually are, and it plays at 10FPS. I haven't figured out a fix for the first part, but the second part is fixed with:
ffmpeg -itsscale 0.3336666666 -i output.mkv -c copy -vtag hvc1 output.mp4

None of the tools I have seem capable of handling HEVC with alpha, so I don't know if this file actually has the proper alpha channel. I'm putting my trust in x265 with the --alpha flag. But, I asked a friend with a Mac to browse to my web site set to this file, and it didn't seem to work. They reported that the video seemed to be playing but nothing appeared. So, my assumption presently is that it didn't work. :-(
Does anybody see any obvious oversights in this process? How can I produce the file I need?
If anybody has tools to inspect the file and see whether it did, in fact, manage to encode with alpha information, the output of the above process is available here:
https://wizardsoftheplains.ca/Zap.mp4


text:
Why hasn't "still image camera matching" technology been used for tracking moving shots?
Camera Matching adjusts a camera viewpoint so that the perspective in a background image matches the perspective of the digital world (Rotation and location of a camera in a 3D software). This allows you to place 3D objects as if they were part of the background image.
For example ,there exists a software called fSpy, that lets you place vanishing points, representing each of the axis's. fSpy will then generate camera data that you can export to your project, as seen on the right of the video. I'm sure the short video on their website, https://fspy.io/ can demonstrate much better than I can explain in words here, or this image here:

So my question is why hasn't this kind of software been applied to moving video? You can track the points, and then you only have to track 8 points, versus the many you would have to track using standard motion tracking. It also seems to be much more accurate.
Has this been done before, is there a reason why it hasn't been done before, or have I just came up with a groundbreaking idea?

After watching the video, I'm not sure I understand what the purpose is and what you are asking. You might want to add a screenshot here as the video doesn't add much information. The homepage of the software fspy.io might give a hint.

Sorry about that. I will be sure to edit the question with extra details to make more sense. Thank you.

Sorry, After Effects (and other compositing apps) already has Camera tracking built in. You track a piece of footage, it solves for the camera movement, and creates a virtual camera. Then any 3D layers will look as though they are in the 3D world of the shot. https://helpx.adobe.com/after-effects/using/tracking-3d-camera-movement.html

You're describing augmented reality.
Try something like Carrot Weather's AR Mode or Memoji?
The answer to your question is "Many vendors have implemented 'Augmented Reality' or AR, which works similarly to fSpy.

I don't think so. Augmented reality is just regular tracking but in real time. It uses the same standard system of lots of trackers, just really fast, in real time. I don't think It uses the perspective system as I described. However if I am wrong does such a software exist for creating camera movement as I described?

Yes, trackers have existed for some time. They were very expensive, but costs are coming down rapidly.


text:
ffmpeg fade in from center (with scale image)
I'm trying to apply the effect fade in and zoom/scale image for X seconds. I don't have problems with fade in but how to achieve effect to scale image during X seconds when the first frame is no image and then is zoom in on that image? I think that gif says more than my description.

I thought that upscale video 2x and image 2x and then zoom in will do it but the effect wan not as above in my gif.
Here is my command to fade in image:
ffmpeg -i file.mp4 -loop 1 -i image.jpg -t 5 -filter_complex "[1:v]format=rgba,fade=t=in:d=5:alpha=true:st=0[im];[0:v][im] overlay=x=10:y=10:enable='between(t,0,5)'" out.mp4

Use
ffmpeg -i file.mp4 -i image.jpg -filter_complex "[1:v]pad=iw*2:ih*2:(ow-iw)/2:(oh-ih)/2:c=black@0,zoompan='1+on/125':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2':d=125:s=WxH,format=gbrap,fade=t=in:d=5:alpha=true:st=0[im];[0:v][im] overlay=x=10:y=10:enable='between(t,0,5)'" out.mp4
The image is padded to double width and height with the padding colour being transparent black. Then zoompan is used to zoom in over 125 frames (5 seconds). This result is overlaid on the video.
You have to replace W and H in the zoompan filter with the dimensions of your image.


text:
FFmpeg: apply audio/video fade-in on the first TS chunk, then "cat" all chunks produces a frame loss
this is my first post (on video.stackexchange.com).
I need some explanation regarding to re-encoding a single .ts chunk and then use cat command.
I'll explain my scenario.
I've a  lot of .ts chunks that all together create a smooth video. Tested.
To create a single video I use the classic linux cat command, and everything works a treat.
BUT
These "lot of .ts chunks" reside on a web-hosting where, obviously, it is not possible to install ffmpeg, but I can use cat command (through PHP's shell_exec).

My goal
is to apply an audio/video fade-in on first chunk (and so far I've done it with -vf "fade=t=in:st=0.1:d=1" and -af "afade=t=in:st=0.1:d=1") on my local machine and then, after uploaded the "faded chunk" on remote web-hosting, cat the faded chunk + remaing chunks.

My actual results
My concatenated-chunks-video has a frame-gap at the end of the "faded chunk" and the beginning of the next chunk. After this, plays smoothly.

CLI
ffmpeg -i /path/to/first_chunk.ts -vf "fade=t=in:st=0.1:d=1, format=yuv420p" -af "afade=t=in:st=0.1:d=1" -c:v libx264 -b:v 5099.998K -profile:v main -level:v 4.0 -c:a aac -b:a 279000 -strict experimental -y /path/to/first_chunk_fade_in.ts

cat /path/to/first_chunk_fade_in.ts /path/to/2nd_chunk.ts /path/to/3rd_chunk.ts /path/to/4th_chunk.ts /path/to/5th_chunk.ts > /path/to/merged.ts

Note:
All -c:v, -b:v, -profile:v, -level:v, -c:a, -b:a values were recovered and / or calculated from the original chunk using ffprobe

Any ideas? Or do I have to re-encode the whole file?
Many thanks

Add -copyts and check.

I try immediately....

With -copyts I lose the fade

Instead of st, use the start frame and sample options instead.

same thing. Ok for fade but gap remains. I believe, however, that problem is not attributable to the video stream, but rather to the audio track. I explain to you. I open the merged file with VLC.
Starting from the beginning of the stream, if I PLAY, there's the gap, but if I make a frame-by-frame (shortcut "e" on VLC), no gap occurs and everything runs smoothly. Since VLC does not handle audio on the frame-by-frame (the video becomes mute), I think it's the audio track "in some way" carries with it the video track trying to "put it in sync", creating this little hop in the junction point.

I also tried to disable the audio fade and leave the video track with -c:a copy.
What I'm sure of is that the audio track, once the chunk is encoded, doesn't start at 0 like the original chunk, but after a few ms

Explain what you mean by gap.

Let us continue this discussion in chat.


text:
Why is my Linear FOV GoPro Hero 4 Black video distorted at edges?
I installed the latest firmware as of 09-APR-2019 to my GoPro Hero 4 Black.
I recorded video in 1080 60fps in LINEAR FOV mode with ProTune enabled. Why am I seeing lens distortion at the edges? For example look at the front wheel of the car.
I have Adobe Premiere and can get GoPro Studio how can I remove this? i don't mind losing some of the frame.

UPDATE:
Further to this i have now made a comparison between LINEAR and NARROW FOV options on the Hero 4 Black below. The NARROW option (the left image) seems to remove this effect, why is this?
Is it simply because the Narrow is cropped by comparison?

Is replacing the lens with a longer-focal-distance lens an option for you? See https://video.stackexchange.com/a/26402/24544 for some details.

The distortion you are seeing has nothing to do with ProTune or other codec settings. Its perspective distortion caused by the wide focal length of the GoPro Lens + The low quality of the GoPro Lens itself.
When I say low quality, I mean that in relative terms. The GoPro lens actually produces a pretty amazing image for what it is. But even when you enable the Linear FOV mode, the camera's software can only do so much to reduce the tearing - specifically in the corners of the frame, that you are seeing. It does a decent job overall, but the lens on the GoPro in Wide FOV is roughly 17mm equivalent to a full frame lens.
If you want nearly zero distortion at that focal length... The Zeiss 15mm released a few years back is fantastic, but it's $2500 ish just for the lens itself.
The 16mm and 14mm Arri Master Primes are practically flawless in terms of edge and corner distortion, remarkable actually even at their widest f1.4 t-stop. But for that look, you have to rent or shell out $30,000 for the lens.
So that is basically the reason. You will only get "so good" with a cheap plastic lens on a $400 camera at that focal length. And there is only so much the in camera software can do to process that distortion out. Even doing a more detailed correction in post will get you so far.
The problem has nothing to do with the settings. Thats as good as it gets with the GoPro, in terms of it's wide angle ability to capture a relatively flat looking image. Flat in the middle, but the closer you get to the corners the worse it's going to get.
My recommendation is if you can't live with it, shoot from a farther distance and crop in in post. I think judging by the image had you just backed up perhaps 5 or 6 feet, you'd be able to crop in just a bit and remove "the worst of it".

Hi, thanks for your response ive updated my questio with a further comparison of Narrow vs Linear. The Narrow option looks acceptable. Can i process the Linear footage to get a video that is the euqivalent of the Narrow setting?, i don't mind losing some resolution. Does Narrow have any degree of fisheye effect?


text:
Videos of interacting art (from two different types of art genres)
I was unsure about whether to post this on the Computer Graphics stack exchange. I could also have chosen the Graphic Design stack exchange or the Arts & Crafts stack exchange.
However, as you will be reading this question, you will realize that the first night be a good but incomplete fit, and that the best place to post this is here.
I am interested in the scenario where a graphics designer and an artist (really, two types of different artists, A and B), depict, graphics, in different styles.
Now imagine that one of them goes and draws on the other's art, and give versa. Each artist just draws in their specific style.
When the eye sees this, (and hears what the artists say), the brain produces certain neurotrasmitter release interactions.
This leads me to think about how different videos would interact, if each video projected, a different kind of area in the other's with is own style.
More generally, just suppose there is one video with two styles, interacting with each other (the interaction can occur in a variety of ways).
If the video is about what is produced by the brain before pleasure, and after pleasure, in graphics, the video can be used to produce an analyzation of what is in the cloud in the user's brain after certain types, of, pleasure.
So, this describes a little bit of what I am looking for.
So, the question is, what types of video interaction can be achieved between two different types of arts using modern video editing, animation, and prediction, techniques, to produce, an art video (of this sort)?
What has been done in this area, what examples and types of examples (example, categories) of this thing exist, (even from a technical point of view)?
As I explained, this question is about art videos, rather than just art, and how computer science told support this, either by starting from pictures of painings, or creating the entire thing in the computer.
Thanks.


text:
Star Trek Continues: ffmeg dvdsub: overlapping subtitles
So I've downloaded the free fan-created Star Trek Continues Blue-Ray ISO for Episodes 1-3 and I'm trying to convert the FHD 1920x1080 to SD 960x540 to be able to watch on my phone:
ffmpeg -canvas_size 960x540 \
-i /media/STC_VOL1_BR/BDMV/STREAM/00000.m2ts \
-map_metadata -1 \
-c:v libx264 -map 0:0 -strict -2 -r 24 -s 960x540 \
-c:a libmp3lame -map 0:1 -b:a 384K \
-metadata:s:s:0 language=EN -c:s dvdsub -map 0:2 \
/media/Videos/Star\ Trek\ Continues/S01E01\ Pilgrim\ Of\ Eternity.mkv

but after a few seconds of watching the converted mkv, the subtitles become:

unreadable due to overlapping
are slightly big (no issue)
shifted to the right and bottom of the screen

What am I doing wrong?
Note: I've only ever dealt with srt subtitles and I  know that dvdsubs are images, so that's why I thought the canvas_size parameter might be of help, but it makes no difference.

I joined this site for the sole purpose of upvoting this excellent question :)


text:
FFMPEG cut video and concat put it in reverse
I received a script that cuts video into sub-clips with a specific durationand  then concats them again but for some reason the script concats the files in reverse order:
#!/bin/bash

SUBCLIPS=4
OUTPUTLENGTH=10

cliplength=$(echo "$OUTPUTLENGTH/$SUBCLIPS"| bc -l)

if [ -e "$1" ]; then
    videofile="$1"
else
    echo "file not found: $1"
    exit 1
fi
if [ "$2" ]; then
    OUTPUTFILE="$2"
else
    echo "No name given"
    exit 1
fi

ffmpeg_preamble="ffmpeg -hide_banner -i '$videofile' -s 320x240 -filter_complex \""

duration=$(ffprobe -v error -show_entries format=duration -of         default=noprint_wrappers=1:nokey=1 "$videofile")

cutfilters=""
concatfilter=""

for cutno in $( seq 1 $SUBCLIPS ); do
  cut=$(echo "(1 / ($SUBCLIPS+1)) * $cutno" | bc -l)
  cutchar= $cutno+96
  reverse=  $(printf "%sreverse")
  cutletter=$(printf "\x$(printf %x $cutchar)")
  cutpos=$(echo "$duration * $cut" |bc)
  cutfilters=$(printf "%s[0:v]trim=start=%f:duration=%f,setpts=PTS-STARTPTS[%sv];" "$cutfilters" "$cutpos" "$cliplength" "$cutletter")
  cutfilters=$(printf "%s[0:a]atrim=start=%f:duration=%f,asetpts=PTS-STARTPTS[%sa];" "$cutfilters" "$cutpos" "$cliplength" "$cutletter")
  concatfilter=$(printf "%s[%sv][%sa]" "$concatfilter" "$cutletter" "$cutletter")
done

# concat the cuts together

concatfilter=$(printf "%sconcat=n=%s:v=1:a=1[outv][outa]" "$concatfilter"     "$SUBCLIPS")

ffmpeg_webmopts=" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "
ffmpeg_postscript="\" -map [outv] -map [outa] $ffmpeg_webmopts '$OUTPUTFILE'"

# Chance to cancel before we start

printf "***(hit ctrl+c to cancel)***\n\nExecuting: %s%s%s%s\n"     "$ffmpeg_preamble" "$cutfilters" "$concatfilter" "$ffmpeg_postscript"
sleep 3
eval $(echo "$ffmpeg_preamble $cutfilters $concatfilter $ffmpeg_postscript")

How do I implement the above without reversal?

There are multiple errors in the script that I can see that are unrecoverable.  Can you copy-paste the script as is (don't try to make it pretty) and ping me afterwards

I took it from here and modified for my needs.
https://superuser.com/questions/1298270/ffmpeg-mp4-to-webm-make-a-10-second-compilation-based-on-length

Use https://shellcheck.net when adapting scripts to check for syntax errors.  Do that first and then copy-paste what you currently have, then ping me @Fabby again.


text:
How to fix interlaced mpeg2 video marked as progressive?
Is there a way to use ffmpeg (or anything else that can be used in linux) to fix an interlaced video marked as progressive, and mark it as interlaced so that I can get rid of bad interlaced frames?
Here's an example of how it is:

And how it should be:

Here's the mediainfo of the video:
Video
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@Main
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Bit rate mode                            : Variable
Maximum bit rate                         : 9 800 kb/s
Width                                    : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 23.976 (24000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits

Scan type                                : Progressive
Scan order                               : 2:3 Pulldown
Compression mode                         : Lossy
Time code of first frame                 : 01:00:05:00
GOP, Open/Closed                         : Open
GOP, Open/Closed of first frame          : Closed
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601
Do I need a reencode to fix this? Or just change its wrong flag?

How do you plan to fix it?

@Gyan I don't know how to fix it. I just have a possible diagnosis. Some forums say the problem lies on the 'progressive' flag. How do I change the flag, then? Do I need to inverse telecine it or something? If so, how do I do it? I couldn't find any solution that actually work anywhere I have searched in. That's why I am asking how to fix it. I tried reencoding it with the -ilme option and it just made it worse.

Did you ever get around this problem? I'd like to know too if there is some way to fix incorrectly marked 'progressive' frames to interlaced without re-encoding.

Sorry for the late reply. For anyone wondering, the video actually is progressive.  The next line in the mediainfo shows 2:3 pulldown, which is a software added telecine (soft telecine).  You can also see the framerate is 23.976 fps, which should never indicate interlaced video.  This means each frame is progressive, and the video file has flags on the frames so the video player can add telecine during playback so the video is 29.97 fps.  I believe VLC media player ignore the flags completely these days and only shows the progressive frames. You can also use AVISynth to do an inverse telecine with the plugin TIVTC, I suggest making a d2v file with DGIndex from DGMPGDec, but it will be a reencode.  There might also be a way to remove the 2:3 pulldown flag in the metadata, which would remove the telecine without reencoding.


text:
AMD support for ffmpeg? Can't get my dedicated GPU to work
I'd like to ask for your advice. Recently I got refurbished Dell Latitude E6540 with two GPUs: integrated Intel HD Graphics 4600 and external AMD Radeon HD 8790M:
00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Mars XTX [Radeon HD 8790M]

Basically, what I'd like to achive is use AMD power to ffmpeg (I use it mainly to convert images sequences to movies - thousands of images in 2K-4K resolution), possibly also Digikam, GIMP, Avidemux and similar software.
I use Kubuntu 18.04.2 LTS as my distro of choice with Oibaf's graphic drivers PPA. I know how to turn on AMD on it - just use DRI_PRIME=1 prefix with app name. So if I run DRI_PRIME=1 glxinfo I get (only OpenGL excerpt):
OpenGL vendor string: X.Org
OpenGL renderer string: AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.5 (Compatibility Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

But if I test my notebook with radeon-profile app (https://github.com/marazmista/radeon-profile), I get:
VGA: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
VGA: Advanced Micro Devices, Inc. [AMD/ATI] Mars XTX [Radeon HD 8790M]
OpenGL driver: not direct rendering capable.
Kernel driver: radeon
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) Haswell Mobile  (0x416)
    Version: 19.1.0
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 3.0 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

So why it is? If I call AMD by DRI_PRIME=1 radeon-profile and see kernel driver radeon, next massages are about Intel GPU? And why one of the messages says OpenGL driver: not direct rendering capable?
Next test: mpv. My personal mpv.conf is:
gpu-context=auto
hwdec=auto
vo=gpu
profile=gpu-hq
fullscreen=yes
scale=ewa_lanczossharp
cscale=ewa_lanczossharp

I call mpv with: DRI_PRIME=1 mpv --msg-level=vo/opengl=debug --log-file=mpv-debug.log big_buck_bunny_1080p_stereo.avi and I see that AMD is used:
[   0.049][v][vo/gpu] Probing for best GPU context.
[   0.049][v][vo/gpu/opengl] Initializing GPU context 'x11probe'
[   0.049][v][vo/gpu/x11] X11 opening display: :0
[   0.051][v][vo/gpu/x11] X11 running at 1920x1080 (":0" => local display)
[   0.052][v][vo/gpu/x11] Detected wm supports NetWM.
[   0.052][v][vo/gpu/x11] Detected wm supports FULLSCREEN state.
[   0.052][v][vo/gpu/x11] Detected wm supports ABOVE state.
[   0.052][v][vo/gpu/x11] Detected wm supports BELOW state.
[   0.052][v][vo/gpu/x11] Detected wm supports STAYS_ON_TOP state.
[   0.052][v][vo/gpu/x11] Display 0 (eDP-1): [0, 0, 1920, 1080] @ 60.005696 FPS
[   0.052][v][vo/gpu/x11] Current display FPS: 60.005696
[   0.120][v][vo/gpu/opengl] GLX chose FB config with ID 0xe7
[   0.120][v][vo/gpu/opengl] GLX chose visual with ID 0x13e
[   0.123][v][vo/gpu/opengl] Creating OpenGL 4.4 context...
[   0.130][v][vo/gpu] GL_VERSION='4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)'
[   0.130][v][vo/gpu] Detected desktop OpenGL 4.5.
[   0.130][v][vo/gpu] GL_VENDOR='X.Org'
[   0.130][v][vo/gpu] GL_RENDERER='AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)'
[   0.130][v][vo/gpu] GL_SHADING_LANGUAGE_VERSION='4.50'

When I call it without DRI_PRIME=1, relevant message says:
[   0.074][v][vo/gpu] GL_VERSION='4.5 (Core Profile) Mesa 19.1.0-devel (git-3c5a9ab 2019-04-17 bionic-oibaf-ppa)'
[   0.074][v][vo/gpu] Detected desktop OpenGL 4.5.
[   0.074][v][vo/gpu] GL_VENDOR='Intel Open Source Technology Center'
[   0.074][v][vo/gpu] GL_RENDERER='Mesa DRI Intel(R) Haswell Mobile '
[   0.074][v][vo/gpu] GL_SHADING_LANGUAGE_VERSION='4.50'

I also installed radeontop and intel-gpu-tools to monitor utilization of both GPUs and if I run mpv with DRI_PRIME=1, radeontop is working (values different than 0%), if without - intel_gpu_top is showing meaningful values and radeontop is empty.
Now come to the ffmpeg. I googled many sites and tried many commands to force ffmpeg to work as expected. As far, no luck, so I'm asking here. But what I found until now?
I've downloaded several clips from here: https://standaloneinstaller.com/blog/big-list-of-sample-videos-for-testers-124.html for testing, especially MP4 1920x1080 Panasonic_HDC_TM_700_P_50i movie. I reviewed instructions from the first hand: https://trac.ffmpeg.org/wiki/Hardware/VAAPI
First I tried to capture the screen: ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 1920x1080 -i :0 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 24 output.mp4 but ended with [h264_vaapi @ 0x558a43ee63c0] No usable encoding entrypoint found for profile VAProfileH264High (7).
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Then the same with different combinations of DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi prefix - same result, same error message. So I googled for No usable encoding entrypoint found for profile VAProfileH264High message but didn't found nothing which clarify it, only more confusion. So I tried different approach - vainfo.
Clear vainfo gives:
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 2.1.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD

vainfo with DRI_PRIME=1 gives:
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Mesa Gallium driver 19.1.0-devel for AMD OLAND (DRM 2.50.0, 4.18.0-17-generic, LLVM 8.0.0)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

On ArchWiki I found something interesting (https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verification): VAEntrypointVLD means that your card is capable to decode this format, VAEntrypointEncSlice means that you can encode to this format. So does it mean AMD is unable to convert (encode) to H264?
Next test - vdpauinfo. For Intel it gives error and doesn't run as expected but with DRI_PRIME=1 vdpauinfo:
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420    16384 16384  NV12 YV12
422    16384 16384  UYVY YUYV
444    16384 16384  Y8U8V8A8 V8U8Y8A8

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                      1  9216  2048  1152
VC1_MAIN                        2  9216  2048  1152
VC1_ADVANCED                    4  9216  2048  1152
MPEG4_PART2_SP                  3  9216  2048  1152
MPEG4_PART2_ASP                 5  9216  2048  1152
DIVX4_QMOBILE                  --- not supported ---
DIVX4_MOBILE                   --- not supported ---
DIVX4_HOME_THEATER             --- not supported ---
DIVX4_HD_1080P                 --- not supported ---
DIVX5_QMOBILE                  --- not supported ---
DIVX5_MOBILE                   --- not supported ---
DIVX5_HOME_THEATER             --- not supported ---
DIVX5_HD_1080P                 --- not supported ---
H264_CONSTRAINED_BASELINE       0  9216  2048  1152
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
HEVC_MAIN                      --- not supported ---
HEVC_MAIN_10                   --- not supported ---
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---

So most of H264 profiles aren't supported? I tried to add -profile:v baseline switch to ffmpeg command but ended with:
[h264_vaapi @ 0x55929d9c8300] [Eval @ 0x7ffdb7f59060] Undefined constant or missing '(' in 'baseline'
[h264_vaapi @ 0x55929d9c8300] Unable to parse option value "baseline"
[h264_vaapi @ 0x55929d9c8300] Error setting option profile to value baseline.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

And I digged again, founding this: https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1805712/comments/2
And my hopes died here. If I understand it properly, I can't use AMD GPU to encode because this chip doesn't have this capability built-in. So how can I use the power of this GPU in Linux? Currently I use open-source drivers (radeon/radeonsi) and I've read that open-source driver for AMD is good so I didn't have reason for change. I tried to avoid external solution, but maybe the time has come...? Does it change anything?
EDIT: I reply to my own last question. No, it doesn't change anything, so I came back to system drivers (from Oibaf's repo).

Since you're generating a movie from images or screen cap, decoding capabilities are irrelevant. Encoding is the relevant operation, And it appears your device does not support video encoding.

Thank you for reply. My awkward trials are probably caused by lack of knowledge how whole encoding stack works (communication between CPU and GPU, implemented features from codecs etc.).


text:
Filesystem that records longer than 4 GiB, or one hour without interruption
I would like to record footage at high resolution for one hour without interruption. I have a DSLR camera that, with 1080 pixels of vertical resolution and 50 frames per second, stops recording at 10 minutes and I have to press the record button again. Another hand-held camera can record for an hour but breaks it into chunks that, when concatenated, skip a fraction of a second.
I understand that this time limitation is because DSLR cameras use the FAT32
standard
for reading and writing files from disks, and FAT32 has a limitation of 4 GB:

The maximum possible size for a file on a FAT32 volume is 4 GiB minus 1 byte
  or 4,294,967,295 (2^32 − 1) bytes. This limit is a consequence of the file length entry in the directory table

Does another filesystem allow recordings without interruption for longer than 4 GiB or 10 minutes? And did cameras adopt such a filesystem?
Update: @Michael Liebman's suggested this Quora link that mentions "file chaining". I could solve the problem if the split files from a camera could be seamlessly joined and produce the same output as if I had been recording continuously. Does a format or camera standard allow this seamless juxtaposition?
Second update: I understand from the comments and questions that the file size limitation serves for DSLR's to avoid the EU's 5.6% import duty on cam-corders. One Sony camcorder can record continuously in AVCHD format but chops the clip into multiple files with around half a second missed in between files. Can another filesystem or video format record for camcorders footage for one hour without interruption?

If you read further down in the article you linked and here, it really isn't the filesystem or any other technical limit that is restricting the file length. It is a pure business decision to get around (possibly outdated) tariff classifications.

Unless you're planning on replacing your camera's firmware (that's a thing—check out magic lantern if you want to take the red pill) you're stuck with the disk format the manufacturers specified. Formatting your card to another file system will just mean that the camera won't recognise it.

@MichaelLiebman Great point, which I had missed and explains it. Could you write an answer? I think that quoting that Quora page that has the only two cameras commercially available that don't have the limit would be good, but I'm not sure if it goes against the site's policies on staying away from product recommendations.

@stib I read about magic lantern and I'll do it! Could you write an answer with some details? And do Nikon cameras have a similar hack (I found Nikonhacker.com but it seems stale)?

@stib The FAQ on the time limit suggests that with H264 the limit is 30 minutes or 4 GB, whichever comes first; and RAW has no limit, but the file sizes are huge. So H264 would not record continuously for one hour. This calculator suggests the filesize for one hour of footage at 1080p and 30 fps is 1 TB, is that right?

@stib Why would magic lantern have a 4 GB limitation on a card with an exFAT format?

See a similar thread on photo.stackexchange.com.

"One Sony camcorder can record continuously in AVCHD format but chops the clip into multiple files with around half a second missed in between files" — most likely there are no missing frames, it is your NLE that cannot stitch them correctly.

@miguelmorin "H264 the limit is 30 minutes or 4 GB" — there is no relation between codec type and file size. "This calculator suggests the filesize for one hour of footage at 1080p and 30 fps is 1 TB, is that right?" — you can calculate file size yourself using your camera's bitrate and duration.

@RustyCore Re: NLE, I am using iMovie, the individual files have zero sound for 0.6 seconds at the end of each clip, and the video skips maybe 0.05 seconds; do you still think it's the NLE's problem? Re: H264, that limitation for H264 comes from the magic lantern website, I'm not sure why it has a limit on H264 but not on RAW. Re: filesize, the user's manual for Nikon D3300 does not mention a bitrate (only frame rates), but I could gauge the size by recording for 1 minute when I next have access to the camera.

You might want to keep in mind the regulations concerning camera manufacturers. When recording over a certain limit in time (which I believe is 30 minutes), the sellers of the camera pay an extra tax-amount - so longer recordings are usually reserved for more professional, expensive cameras.
What might be worth a try is recording with an external recorder from a dslr or something better. Other than that, buying an expensive professional-grade camera might be your only option.

Can you provide references for the extra tax when over 30 minutes (or confirm if they are the same as mentioned in the other answers) and for the setup with an external recorder attached to a DSLR?

I found this article for Nikon about recording uncompressed footage. By my calculations, 1 hour of raw footage is 1 TB, does that sound feasible and more feasible than a professional-grade camera?

The filesystem limit and the 30 minutes EU tax limit are unrelated.
The 30 minutes limit is on most cameras, like Nikon P1000. It is typically not on camcorders.
The file size limit on FAT is 4GB. Some cameras can record to "extfs" from Linux, some on exFAT: https://en.wikipedia.org/wiki/ExFAT
But I did not find a low-end camcorder (< $1000) that can handle these. The exception is smart phones, which nowadays use Ext4 from Linux, or F2FS (Flash Friendly File System).
The continuous recording split into 4G files is relatively well done by Panasonic HC-VX9xx models at FHD. The fraction of a second pause is because the camcorder needs to "wrap up" the file (add a header and a footer) and begin a new file, which it could do in the background, but then they couldn't be so cheap :)
Panasonix X1000 does this without the drop.

In my experience, that's a indicator of the line between consumer, pro-sumer and professional cameras. At a previous workplace, it was problematic enough to justify investing in a better camera for the situation that could handle longer video lengths.
Additionally, standard FPS for video are 24 or 30 fps.
You might be able to save some time on the card by recording at 24 fps, but not enough to record for an hour by my calculations.


text:
Watermark in 64-bit AviSynth+
The Watermark filter listed in the AviSynth External filters page works for 32-bit. On my 64-bit machine, after downloading, extracting, and playing the example file in the filter page, I see:

Cannot load a 32 bit DLL in 64 bit Avisynth: '/path/to/extracted/directory/Watermark.dll'. (/path/to/extracted/directory/example.avs, line1)

The first line of example.avs has:

Load_Stdcall_plugin("Watermark.dll")

Does an equivalent plugin exist for 64-bit AviSynth+?

Presuming you are talking about the Watermark2 filter, the AviSynth wiki page for the filter has for download a 64-bit, AviSynth+ version of the filter.


text:
FFMPEG slideshow skips a picture when showing on VLC (and is OK on Quicktime)
I created a slideshow following the directions on the concat demuxer. The input file is:

file 'sentence1.jpg
duration 5
file 'sentence2.jpg
duration 5
file 'sentence3.jpg
duration 5
file '30.jpg
duration 5
file '40.jpg
duration 5
file '50.jpg
duration 5
file '60.jpg
duration 5
file '70.jpg
duration 5
file '30.jpg
duration 5
file '40.jpg
duration 5
file '50.jpg
duration 5
file '50.jpg

The result looks OK on QuickTime with 5 seconds for each of the first three pictures. For the same file, VLC shows 10 seconds for the first picture, a flash of the second, and the third for 5 seconds.
I could display the video on QuickTime or use another non-linear editor to compile the slideshow. But I'm curious about this quirk.
Has anyone faced this problem? How can I diagnose it?
The version of VLC is Version 3.0.8 Vetinari (Intel 64bit). The log of the command is:

$ ffmpeg -f concat -i slideshow2.txt  -vsync vfr -pix_fmt yuv420p output2.mp4
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.16)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, concat, from 'slideshow2.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 4032x3024, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x111f69000] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7fc2fd818000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fc2fd818000] profile High, level 6.0
[libx264 @ 0x7fc2fd818000] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output2.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 4032x3024, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[swscaler @ 0x111f69000] deprecated pixel format used, make sure you did set range correctly
frame=    5 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   10 fps=8.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   12 fps=1.0 q=-1.0 Lsize=   16739kB time=00:00:45.00 bitrate=3047.2kbits/s speed=3.73x
video:16738kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.005508%
[libx264 @ 0x7fc2fd818000] frame I:2     Avg QP:12.59  size:1762396
[libx264 @ 0x7fc2fd818000] frame P:10    Avg QP:15.19  size:1361412
[libx264 @ 0x7fc2fd818000] mb I  I16..4:  0.2% 96.8%  2.9%
[libx264 @ 0x7fc2fd818000] mb P  I16..4:  0.1% 85.8%  4.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:10.0%
[libx264 @ 0x7fc2fd818000] 8x8 transform intra:95.7% inter:85.7%
[libx264 @ 0x7fc2fd818000] coded y,uvDC,uvAC intra: 99.2% 57.5% 27.3% inter: 0.6% 0.8% 0.0%
[libx264 @ 0x7fc2fd818000] i16 v,h,dc,p: 12% 21% 28% 38%
[libx264 @ 0x7fc2fd818000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 35% 19%  4%  5%  4%  8%  5% 11%
[libx264 @ 0x7fc2fd818000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 22%  8%  7%  9%  8% 10%  8% 10%
[libx264 @ 0x7fc2fd818000] i8c dc,h,v,p: 46% 28% 22%  4%
[libx264 @ 0x7fc2fd818000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fc2fd818000] ref P L0: 64.1% 12.7% 20.0%  3.3%
[libx264 @ 0x7fc2fd818000] kb/s:2285.19

Which VLC version?

@Gyan Version 3.0.8 Vetinari (Intel 64bit), and I updated the question.

Try without -vsync vfr.

@llogan That fixes it. Could you write an answer and maybe explain why it fails?


text:
How to export AviSynth project to video file?
I am just starting on AviSynth for video production. My understanding is that AviSynth only does frameserving and not file export, but several export filters are available. TWriteAVI seems the tool for the job but the plugin link is no longer available on the host.
The title links to a forum with what looks like VB code:
#######

ForceProcessAVI(clip c,bool "Debug"=True)
 Force Process clip c, ie read from first to last frame, for TWriteAVI writes the AVI file (Video + Audio) without having to play clip.
...

I didn't see how to turn this code into an executable, as I mostly use Unix and Windows is for AviSynth only.
How can I hook this code into AviSynth, or how can I export an .avs text file to a movie file?

Forget about output filters.
Use FFmpeg  (Linux, Mac, Windows) with this simple command
ffmpeg -i your_avs_file.avs  output.mp4

(or output.avi, output.mkv, ...),
or any conversion program which accepts .avs files as input, e. g. Any Video Converter Free (for Mac and Windows).

Note 1:
The Windows link points to the site for downloading Zeranoe's FFmpeg build. Unpack the downloaded file and use it — no installation is needed, perhaps only adding the path to ffmpeg.exe into your PATH environment variable.
Note 2:
If you want build FFmpeg by yourself, don't forget add --enable-avisynth option.
Note 3:
You may directly play back your AviSynth script files (.avs) with some Media Players, e.g. with Media Player Classic.

I followed these steps and after the usual ffmpeg boilerplate, I get Unknown error occurred and no other information.


text:
Premiere Pro plays media video stream at half the speed as audio
In Premiere Pro 2020 (14.7), some media files have video playing at half the speed as the source, either in the source monitor or the timeline. Here is one example in Premiere with a still apparently at minute 6:

Here is the source file playing in VLC showing a near still at minute 3:

The same problem appears in this thread. The solution there was to re-open the project, which didn't work for me, and neither did restarting Premiere.
I have this issue whether I set ingest to create proxies or not.
How can I fix this issue?
Update: This is an issue with Adobe After Effects 2020 as well, so most likely an issue with some basic code in the 2020 version. I used a clip in Premiere 2019 and in After Effects 2020 from about 0:30 (shown in the first picture as marked in and out). After Effects rendered the video at half the speed and showing frames that are at 0:14 in the original footage. Lucky for me, I didn't need the audio for that clip in After Effects 2020.

I spent 5 hours with Adobe support and an engineer, where we tried cleaning the media cache, removing preference files, removing "Application Support" files, rendering in to out, and downgrading from 14.7 to 14.3. The issue still persisted. Adobe said it was my fault because I have the minimum 8 GB of RAM instead of the recommended 16 GB. It sounds like a bug to me.
I tried the oldest version of Premiere, 13.1.5 without creating proxies when ingesting, and it did not have that problem.


text:
Video concatenation puts sound out of sync
I have several MOV files from a DSLR camera. I concatenate them with directions from this thread:
ffmpeg -safe 0 -f concat -i files_to_combine -vcodec copy -acodec copy temp.MOV

where files_to_combine is:
file ./DSC_0013.MOV
...
file ./DSC_0019.MOV

The result has image and sound in sync for the first clip and is out of sync by fractions of a second in the second clip, and out of sync by around a second for the last clip. It is probably related to this error from the log:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] Auto-inserting h264_mp4toannexb bitstream filter

How can I trim the frames to the available sound stream, then concatenate the two videos?
The full log from the ffmpeg command is:
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dc00e000] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'files_to_combine':
  Duration: N/A, start: -0.592000, bitrate: 36888 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080, 35352 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      handler_name    : SoundHandler
Output #0, mov, to 'temp.MOV':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080, q=2-31, 35352 kb/s, 50 fps, 50 tbr, 50k tbn, 50k tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] Auto-inserting h264_mp4toannexb bitstream filter
frame=41886 fps=547 q=-1.0 Lsize= 3789826kB time=00:13:58.75 bitrate=37014.8kbits/s speed=10.9x
video:3631879kB audio:157123kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.021759%

Update (1 July 2019)
I thought that the files had a problem at the beginning or at the end, so I
trimmed one second from each end, but it still had the sound out of sync:
FILES=files_to_combine
OUTPUT=show2.MOV
rm $FILES
for i in 3 4 5 6 7 8 9; do
    rm ${i}.MOV
    duration=$(ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1  DSC_001${i}.MOV)
    trimmed=$(echo $duration - 1 | bc)
    ffmpeg -ss 1 -t $trimmed -i DSC_001${i}.MOV -vcodec copy -acodec copy ${i}.MOV
    echo file ./${i}.MOV >> $FILES
done

rm $OUTPUT
ffmpeg -safe 0 -f concat -i $FILES -vcodec copy -acodec copy $OUTPUT

When I trim a single file near the end, the sound and video do not seem out of sync:
ffmpeg -ss 00:09:20 -t 20 -i DSC_0014.MOV -vcodec copy -acodec copy end.MOV

When I concatenate only 30 seconds from each video, the result seems OK:
FILES=files_to_combine
OUTPUT=show2.MOV
rm $FILES
for i in 3 4 5 6 7 8 9; do
    rm ${i}.MOV
    duration=$(ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1  DSC_001${i}.MOV)
    start=$(echo $duration - 30 | bc)
    end=$(echo $duration - 1 | bc)
    ffmpeg -ss $start -t $end -i DSC_001${i}.MOV -vcodec copy -acodec copy ${i}.MOV
    echo file ./${i}.MOV >> $FILES
done

rm $OUTPUT
ffmpeg -safe 0 -f concat -i $FILES -vcodec copy -acodec copy $OUTPUT

This last concatenation gives this error multiple times:
[mov @ 0x7fc3c7837400] Non-monotonous DTS in output stream 0:0; previous: 9080205, current: 9080200; changing to 9080206. This may result in incorrect timestamps in the output file.

So I am guessing that the problem is small differences in timestamps that
accumulate and become more noticeable with longer durations and the
concatenation of multiple files.
For reference, the DSLR that shot these clips is a Nikon D3300 and the result
of ffprobe on one of the files is:
$ ffprobe DSC_0017.MOV -hide_banner
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fab70003800] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fab70003800] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSC_0017.MOV':
  Metadata:
    major_brand     : qt
    minor_version   : 537331968
    compatible_brands: qt  niko
    creation_time   : 2019-06-12T23:52:37.000000Z
  Duration: 00:09:53.58, start: 0.000000, bitrate: 36843 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080, 35300 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc (default)
    Metadata:
      creation_time   : 2019-06-12T23:52:37.000000Z
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2019-06-12T23:52:37.000000Z

Update (9 August 2019)
I concatenated the files in iMovie and the sound and image are not as out of sync as with FFMPEG. Maybe iMovie aligns the timestamps at the end of each clip instead of concatenating the audio and image streams separately.
I ran the concatenation again with the latest ffmpeg 4.1.4_1 on these files and others from the same camera. The audio and image are in sync in one case (the results lasts 46 minutes) out of sync in another (the result lasts 48 minutes).

instead of concatenating the audio and image streams separately. --> yes. One way around this is to add a duration directive for each file in the concat text. The duration will be that shown by ffmpeg.

@Gyan Your idea is to get the duration from ffmpeg, then include -t <seconds> as an input option for each file to concatenate? The code for that was not immediate to me, could you give some pointers?

Basically, yes, but you have to add it as a directive. See docs and an example.

I tried a concatenation including duration X after each file, where X is the duration of the clip (obtained with ffprobe) minus 1 second, and the result is even more out of sync, around 3 seconds over the course of 1 hour.

Duration cannot be less than actual duration of clip, or if it is, you have to add an outpoint directive with a value equal to or less than the duration value.

I tried the same concatenation as in my last comment, with outpoint X after each file, where X is the duration of the clip minus 1 second. The result is still out of sync by about 2 seconds over the course of 1 hour.

Usually audio recording is just a continuous steam, with no concept of video frames. The audio is just being encoded/output via a continuous buffer, which will just dump out wherever it is up to you when you stop recording video frames - it is not uncommon for there to be more (or even less) audio in the file than is actually required for the corresponding video.
I would try a de-mux/re-mux of the video files before concatenating, to see if that cleans things up. With the de-muxed files as well, you could calculate how much audio is actually there in the file vs the video play time. I don't have enough experience with ffmpeg to know if this will work, just crossing my fingers that when you re-mux the files it might do a calculation of the required audio length, and trim it appropriately for you (there might also be parameters available to force the audio to trim at the video length, if that doesn't happen by default).
An editor like iMovie is going to properly cut up the audio to exactly match the video cuts, which is why that works. You could also try outputting a single unedited clip from iMovie, and then de-mux that, and see how the audio length differs from the original. Not sure if iMovie lets you output "audio only", but be careful trying that - I know with Adobe Premiere, if I output an audio only WAV, it will differ in length (longer file) than the same clip being output with a video stream as well.
Sorry I can't offer anything more definitive than some guesses/suggestions, I'm fairly positive the root cause is audio length not matching the video in the original file, but I'm not familiar enough with ffmpeg to know the best way to resolve the issue using that tool.
Update from original poster
Import the files in question into a program like iMovie and check the beginnings and endings of each file. Does the video stream have more length than the audio stream? Or try to play it in a program like VLC: do you hear a drop in the sound at the end or the beginning?
If so, then your camera, for whatever reason, records more video than sound. You can deal with this quickly in FFMPEG by trimming each clip to the shortest stream:
ffmpeg -i input.MOV -map 0 -c copy -fflags +shortest -max_interleave_delta 0 output.MOV

You may need to play with -max_interleave_delta depending on your files. From the documentation:

‘shortest’
Stop muxing at the end of the shortest stream. It may be needed to increase max_interleave_delta to avoid flushing the longer streams before EOF.

The command is from Trim audio stream to video stream length .

That was it indeed! I opened the files in iMovie and saw that the video stream for the clips was 200 ms longer than the audio stream. I had 6 clips, so the total misalignment was around 1 second, which explains and solves the problem.

I trimmed each clip to the shortest stream (ffmpeg -i input.MOV -map 0 -c copy -fflags +shortest -max_interleave_delta 0 output.MOV, which I found on this thread), and that helps a lot. I measured the discrepancy from a segment where someone bangs a chair: it is 0.5 seconds with plain FFMPEG concatenation, it's 0.08 seconds with shortest stream clipping, and it's zero in iMovie. I would like to solve this smaller discrepancy too. I think that would make more sense as a new question. What do you think?

@miguelmorin - I would agree, post it up as a new question. You're trying to solve  a different problem now, and you have more specific info at this point (it would probably be messy to re-edit this older post and get an appropriate response). It also sounds like a more specific ffmpeg issue with your current solution now, it sounds like ffmpeg isn't trimming the audio with the video as cleanly as iMovie.

@PeterBarton  Usually audio recording is just a continuous steam, with no concept of video frames. --> no, compressed audio is framed and thus quantized. See https://superuser.com/a/1155353


text:
Newlines in AviSynth+ subtitles
This page uses newline characters (\n) to introduce newlines in a subtitle in AviSynth:

subtitle("First line\nNext line\nLast line", ...)

I tried this code on AviSynth+ and it fails.
Newlines would be useful for credits that take multiple lines without having to repeat the settings and tune the alignment.
What is the simplest way to include newlines in subtitles?

To use newlines in the built-in Subtitle filter, you must specify the lsp (linespacing) argument:
subtitle("First line\nNext line\nLast line", lsp=12)

See the Subtitle wiki page for more info on the argument.

Yes, I had found the answer at VideoHelp and forgot to update it here.


text:
How can I make a cheap video with a train filmed from in front of the locomotive, while this is running?
I want to make a video with a train running, filmed from in front of the locomotive (see the link below the picture to understand exactly what I desire). I guess they shot from a rail-car pushed by the steam engine, but such a solution is not viable for me. I can not modify in any way the configuration of the train.  Any idea how to do it in an affordable way?

Selfie of a train locomotive while running (see minute 1:26 to 2:50)

It's a great shot, but unless you can get the permit to shoot that close to a moving train or from inside a moving train, I don't see how you can pull it off. It's potentially very dangerous. That sort of shot is hard to pull off for medium size productions, let alone solo productions, as yours seem to be. The best solution, I think, would be for you to buy stock footage showing what you describe/what appears in the film you linked to.

I can think of two possible solutions:

You build some kind of rig similair to a selfie stick. Mount it somewhere on the locomotive and try to not get it in the shot or digitally remove it
Choose a place where a road is next to the traintrack, mount the camera to a car (Or other vehicle) and drive along the track.

I see a few difficulties with both tho.
For the first one, you will need to buy/create the rig which could be rather difficult, especially if you have a bigger camera. You also won't be able to control the camera, expect if you have wireless control. You would also need to look with a camera hanging out quite a bit from the locomotive, that there are no other trains, trees, signals, tunnels... which are in the range of the camera.
For the second option, you would need to first find that road which could be difficult especially if you can't change the track where the train drives.
Depending on the road, you would also need to get some stabilisation system, so that the image doesn't shake to much. This might be needed for the train as well.

In the meantime, I have seen this video: https://www.youtube.com/watch?v=z0shDqUFyt8 with a train shot from a drone. It might be possible, I do not know, to drive the drone from inside the locomotive, and keep it stable at a certain distance from the windshields, while the train is moving at slow speed, like 20-30 km/h.


text:
Combining two video fields into one (to create an interlaced video)
I have two separate video fields (top.avi and bottom.avi) and I would like to merge them to create an interlaced video.
Is it possible to do this with ffmpeg? (or any other tool for Windows or Linux)
ffmpeg log:
Input #0, avi, from 'top.avi':
  Metadata:
    encoder         : Lavf58.20.100
  Duration: 00:03:16.03, start: 0.000000, bitrate: 13509 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 640x224, 13506 kb/s, SAR 1:1 DAR 20:7, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc

Input #1, avi, from 'bottom.avi':
  Metadata:
    encoder         : Lavf58.20.100
  Duration: 00:03:16.03, start: 0.000000, bitrate: 13507 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 640x224, 13503 kb/s, SAR 1:1 DAR 20:7, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc

Share the log of ffmpeg -i top.avi -i bottom.avi

@Gyan Ok, here you go.

Use
ffmpeg -i top.avi -i bottom.avi -filter_complex vstack,il=l=i:c=i -c:v ffv1 il.avi
See docs for http://www.ffmpeg.org/ffmpeg-filters.html#vstack and http://www.ffmpeg.org/ffmpeg-filters.html#il

Thank you so much Gyan, that is exactly what I was looking for.

Could anyone please explain this a bit?


text:
MP4 Video created with ffmpeg C++ api does not show in OSX
I am writing a MP4 video from scratch using the C++ API (libav* 4.1.1). This video can be played back just fine using ffplay or VLC. But the Finder Preview and the Quicktime Player on OSX (10.13 and 10.14 tested) don't work, the finder hangs and Quicktime player shows black and silent.
This is the output of ffplay:
ffplay version 4.1.1 Copyright (c) 2003-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'demo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:01:23.29, start: 0.000000, bitrate: 566 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 800x576 [SAR 1:1 DAR 25:18], 498 kb/s, 23.99 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

The video settings are chosen from a working MP4 video, and I can't spot any difference in ffprobe or ffplay.
This is, how I setup the streams (condensed):
// container:
avformat_alloc_output_context2 (&formatContext, NULL, NULL, filename);
// formatContext->oformat->flags has AVFMT_GLOBALHEADER set automatically

// video stream:
codec = av_guess_codec (formatContext->oformat, nullptr, filename, nullptr, AVMEDIA_TYPE_VIDEO);
auto* encoder = avcodec_find_encoder (codec);

stream->time_base = av_make_q (1, settings.timebase);
auto* context = avcodec_alloc_context3 (encoder);
context->width = settings.frameSize.width;
context->height = settings.frameSize.height;
context->pix_fmt = AV_PIX_FMT_YUV420P;
context->sample_aspect_ratio = av_make_q (1, 1);
context->color_range = AVCOL_RANGE_MPEG;
context->bit_rate  = 480000;
context->gop_size  = 10;
context->time_base = av_make_q (1, settings.timebase);
avcodec_parameters_from_context (stream->codecpar, context);

AVDictionary* options = nullptr;

if (encoder->id == AV_CODEC_ID_H264) {
    av_dict_set (&options, "preset", "slow", 0);
    av_dict_set (&options, "tune", "film", 0);
    av_opt_set (context->priv_data, "profile", "baseline", AV_OPT_SEARCH_CHILDREN);
}
if (formatContext->oformat->flags & AVFMT_GLOBALHEADER)
            context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

int ret = avcodec_open2 (context, encoder, &options);
av_dict_free (&options);

// audio stream:
codec = av_guess_codec (formatContext->oformat, nullptr, filename, nullptr, AVMEDIA_TYPE_AUDIO);
auto* encoder = avcodec_find_encoder (codec);

auto* stream = avformat_new_stream (formatContext, NULL);

auto channelLayout = AV_CH_LAYOUT_STEREO;

stream->time_base = av_make_q (1, settings.timebase);
auto* context = avcodec_alloc_context3 (encoder);
context->sample_rate = settings.timebase;
context->sample_fmt = AV_SAMPLE_FMT_FLTP;
context->channel_layout = channelLayout;
context->channels = av_get_channel_layout_nb_channels (channelLayout);
context->bit_rate = 64000;
context->frame_size = settings.defaultNumSamples;
context->bits_per_raw_sample = 32;
context->time_base = av_make_q (1, settings.timebase);
avcodec_parameters_from_context (stream->codecpar, context);

if (formatContext->oformat->flags & AVFMT_GLOBALHEADER)
            context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

int ret = avcodec_open2 (context, encoder, NULL);

// preparing for writing:
if (!(formatContext->oformat->flags & AVFMT_NOFILE))
    if (avio_open (&formatContext->pb, filename, AVIO_FLAG_WRITE) < 0)
        return false;

auto ret = avformat_write_header (formatContext, nullptr);

// send audio and video frames, writing using
av_interleaved_write_frame (formatContext, packet);

// closing container:
// [flushing sending nullptr frames]

av_write_trailer (formatContext);

The full source code is available on github:
https://github.com/ffAudio/foleys_video_engine/blob/973019d0c85e740b6f7bfdda190de49ce8d0ce6a/ReadWrite/FFmpeg/FFmpegWriter.cpp
If necessary, I can add the parts, how I fill the frames and packets as well.

Are there only certain settings known to work?
Did I miss some setting to be declared, like frame duration?
Something completely different?

EDIT: this is the output of qtff-movdump:
➜  src git:(master) ✗ ./movdump ~/Movies/demo.mp4
ftyp: s=        32 (0x00000020), o=         0 (0x00000000)
  major_brand: isom (69 73 6f 6d)
  minor_version: 0x00000200
  compatible_brands: isom (69 73 6f 6d), iso2 (69 73 6f 32), avc1 (61 76 63 31), mp41 (6d 70 34 31)
free: s=         8 (0x00000008), o=        32 (0x00000020)
mdat: s=   5858977 (0x005966a1), o=        40 (0x00000028)
  ...skipped 5858969 bytes
moov: s=     44032 (0x0000ac00), o=   5859017 (0x005966c9)
    mvhd: s=       108 (0x0000006c), o=   5859025 (0x005966d1)
      version: 0
      flags: 0x000000
      creation_time: 1904-01-01T00:00:00Z (0 sec since 1904-01-01)
      modification_time: 1904-01-01T00:00:00Z (0 sec since 1904-01-01)
      timescale: 1000
      duration: 83292 (83.292000 sec)
      preferred_rate: 1.000000
      preferred_volume: 1.000000
      reserved: (size 10)  00 00 00 00 00 00 00 00 00 00  |..........|
      matrix:
        1.000000 0.000000 0.000000
        0.000000 1.000000 0.000000
        0.000000 0.000000 1.000000
      preview_time: 0
      preview_duration: 0 (0.000000 sec)
      poster_time: 0
      selection_time: 0
      selection_duration: 0 (0.000000 sec)
      current_time: 0
      next_track_id: 3
    trak: s=     17539 (0x00004483), o=   5859133 (0x0059673d)
        tkhd: s=        92 (0x0000005c), o=   5859141 (0x00596745)
          version: 0
          flags: 0x000003
          creation_time: 1904-01-01T00:00:00Z (0 sec since 1904-01-01)
          modification_time: 1904-01-01T00:00:00Z (0 sec since 1904-01-01)
          track_id: 1
          reserved: 0x00000000
          duration: 83292 (83.292000 sec)
          reserved: (size 8)  00 00 00 00 00 00 00 00  |........|
          layer: 0
          alternate_group: 0
          volume: 0.000000
          reserved: 0x0000
          matrix:
            1.000000 0.000000 0.000000
            0.000000 1.000000 0.000000
            0.000000 0.000000 1.000000
          track_width: 800.000000
          track_height: 576.000000
        edts: s=        36 (0x00000024), o=   5859233 (0x005967a1)
            elst: s=        28 (0x0000001c), o=   5859241 (0x005967a9)
              version: 0
              flags: 0x000000
              edit_list_table (         1):
                     i    duration       time          rate
                  0000       83292          0      1.000000
        mdia: s=     17403 (0x000043fb), o=   5859269 (0x005967c5)
            mdhd: s=        32 (0x00000020), o=   5859277 (0x005967cd)
              version: 0
              flags: 0x000000
              creation_time: 1904-01-01T00:00:00Z (0 sec since 1904-01-01)
              modification_time: 1904-01-01T00:00:00Z (0 sec since 1904-01-01)
              timescale: 24000
              duration: 1998997 (83.291542 sec)
              language: 0x55c4 (und)
              quality: 0
            hdlr: s=        45 (0x0000002d), o=   5859309 (0x005967ed)
              version: 0
              flags: 0x000000
              component_type: .... (00 00 00 00)
              component_sub_type: vide
              component_manufacturer: 0
              component_flags: 0x00000000
              component_flags_mask: 0x00000000
              component_name: 'VideoHandler' + 0x00
            minf: s=     17318 (0x000043a6), o=   5859354 (0x0059681a)
                vmhd: s=        20 (0x00000014), o=   5859362 (0x00596822)
                  version: 0
                  flags: 0x000001 (no lean ahead)
                  graphics_mode: 00
                  opcolor: RGB(0x0000,0x0000,0x0000)
                dinf: s=        36 (0x00000024), o=   5859382 (0x00596836)
                    dref: s=        28 (0x0000001c), o=   5859390 (0x0059683e)
                      version: 0
                      flags: 0x000000
                      entries (         1):
                        url : s=        12 (0x0000000c), o=   5859406 (0x0059684e)
                          version: 0
                          flags: 0x000001 (self reference)
                          data: (0 bytes) url:
                stbl: s=     17254 (0x00004366), o=   5859418 (0x0059685a)
                    stsd: s=       126 (0x0000007e), o=   5859426 (0x00596862)
                      version: 0
                      flags: 0x000000
                      sample_descriptions (0x00000001):
                        size: 0000006e
                        data_format: avc1 (61 76 63 31)
                        reserved: (size 6)  00 00 00 00 00 00  |......|
                        data_ref_index: 0x0001
                        version: 0
                        revision: 0x0000
                        vendor: .... (00 00 00 00)
                        temporal_quality: 0x00000000
                        spatial_quality: 0x00000000
                        width: 800
                        height: 576
                        horizontal_resolution: 72.000000
                        vertical_resolution: 72.000000
                        data_size: 0
                        frame_count: 1
                        compressor_name: '' + 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
                        depth: 24
                        color_table_id: 0xffff
                        avcC: s=         8 (0x00000008), o=   5859528 (0x005968c8)
Exception: num_read <= CURRENT_ATOM.rem_size failed at line 177

What does movdump show as different between the files, especially on mvhd timescale and stsd?

Thank you @Gyan for pointing me to that tool. I didn't see an output for mvhd and stsd, but that might be to my poor understanding of proper terminology. I'll add the relevant output in the question above.

movdump turns out to be a generic name. I meant the one here: https://github.com/bbc/qtff-parameter-editor

Thanks @Gyan, that looks better now. I replaced the output in the post.
It might also be a hint, that the movdump stops with an exception.

Your video stream config is corrupt: avcC: s=         8 (0x00000008), this indicates that no extradata was found by the muxer for the video stream.

You should set global header before opening encoders.

That is strange, I verified by setting a breakpoint, that AVFMT_GLOBALHEADER is set in formatContext->oformat->flags and I copy the flag into the streams using context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; - also the docs of AVCodecContext state, that extradata is filled by libavcodec and in AVFormatContext I don't see extradata.

You do it after int ret = avcodec_open2 (context, encoder, NULL);. Do it before and copy parameters from context after opening.

Thanks, I edited the post above: I could verify, that AVFMT_GLOBALHEADER is automatically set after calling avformat_alloc_output_context2() guessing the format from the mp4 filename.
I moved copying the flag to the streams to before calling avcodec_open2 (context, encoder, &options); according to your suggestion, but it didn't change the output, neither of movdump nor does it play, unfortunately.