Having issues finding the options to lower Quality with Animation Codec - ffmpeg

I'm trying to find if its possible to specify quality when converting to animation codec.
I've used this bit of code and don't see anything about quality.
ffmpeg -h encoder=qtrle
I know this is my generic command to get to animation codec
ffmpeg -i input.mp4 -codec copy -c:v qtrle output.mov
Any advice?

The Animation encoder has no quality or bitrate options. It is a lossless encoder which implements Run Length Encoding and a fixed procedure for compression with no variables for ratecontrol.

Related

Cross device h264 compatible html5 video

I'm trying to serve a large video of timelapses generated from a series of images.
Using FFmpeg I have encoded the video as an h264 mp4.
ffmpeg -framerate 24 -i "/app/download/%d.jpeg" -c:v libx264 -crf 23 -preset fast -tune animation -report -vf "format=yuv420p" -y /app/output.mp4
I'm running into compatibility issues where the videos are not playable on iOS (safari) as well as on Windows (all browsers except chrome). Where I'm getting the following error:
Error Code: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) Details: mozilla::MediaResult __cdecl mozilla::WMFVideoMFTManager::ValidateVideoInfo(void): Can't decode H.264 stream because its resolution is out of the maximum limitation
See the full FFmpeg log here: https://pastebin.com/QUEPh3q2
I'm just looking for some resource or knowledge of how to encode my media for maximum compatibility while still preserving high quality and resolution.
Problem:
Which options I should be using in FFmpeg to maximize compatibility?
From comments: "My videos are maximally of size 4056x3040 or 3040x4056".
I don't have Apple device(s) but you might be hitting some image size limitation on Windows.
Firefox uses the built-in Windows H264 decoder where the maximum height is 2304.
Replace the old command:
ffmpeg -framerate 24 -i "/app/download/%d.jpeg" -c:v libx264 -crf 23 -preset fast -tune animation -report -vf "format=yuv420p" -y /app/output.mp4
With this new one:
ffmpeg -framerate 24 -i "/app/download/%d.jpeg" -vf scale=3069:2300,setsar=1:1 -c:v libx264 -pix_fmt yuv420p -profile:v high -crf 23 -preset fast -movflags +faststart -report -y /app/output.mp4
The above command changes the size to 3069x2300 (within Windows resolution limits) but I recommend a smaller size like 1441x1080 for maximum device / O.S / browser compatibility.
I would leave out -tune animation, add it back if its removal affects your specific image quality.
Now added is +faststart which allows the MP4 header to be at front of file (usually is placed last at back) meaning playback can begin without first downloading all videos just to reach header data (which has the decoder settings needed to begin playback).
I think your bigger issue will be trying to send 4056x3040 video over mobile networks. You're going to have lots of stalling and poor playback over many types of connections that cannot support the bandwidth you'll need. Nor does a mobile device have a big enough screen to actually playback the video dimensions you would be sending.
I'd suggest you look at HLS streaming - and adaptive bitrates. That way, you can create your huge version, a 1080p version, a 720p version (etc.) the video player will deliver the correctly sized video to the device - no wasted data/pixels, fewer stalls, and it still looks great.

How to remove ffmpeg artifacts in the output timelapse video?

I used a number of jpeg files to create a timelapse video with ffmpeg. Individually they are visually ok.
These source images are captured by a mirrorless DSL camera in JPEG format.
If I upload the timelapsevideo to youtube, the video is clear and without any artifact: https://www.youtube.com/watch?v=Qs-1ahCrb0Y
However if I play the video file locally on MacOS in Photo or Quicktime apps or in iOS, there are artifacts in the video. Here are some of the examples:
1.
2.
This is the ffmpeg command I used to generate the video:
ffmpeg -framerate 30 -pattern_type glob -i "DSCF*.JPG" -pix_fmt yuv420p -profile baseline output.mp4
What additional parameter I can use to remove those artifacts?
Edit:
File info
The video plays without issue in VLC.
The H.264 codec standard defines levels. The level represents the resources required by a decoder to smoothly process a stream. Usually, levels are only pertinent for hardware players. However, some software players may have been designed with a level ceiling. Apparently, that's the case with Apple's players.
Your video's frame size is 6000x4000 for which the player has to support level 6.0, which is a recent addition to the standard (~2 years). I suggest you halve the resolution,
ffmpeg -framerate 30 -pattern_type glob -i "DSCF*.JPG" -vf scale=iw/2:ih/2,format=yuv420p -profile baseline out.mp4

FFMPEG h264_videotoolbox output is strange

I want to use h264_videotoolbox codec to encode my video in FFMPEG lib.I input image format is AV_PIX_FMT_YUV420P, but output video frame like follow.
I tried libx264 and all work correctly.
Do you guys know what happen?Why encoded frame like that?
My test code:
https://github.com/BeiKeJieDeLiuLangMao/videotoolbox
Resolution
Data should align to 32.

FFmpeg Video First Frame Time Code value

I would like to ask someone how knows FFmpeg good
As you can see I already know how to set timecodes that contain in green borders,
but I don't know is there any opportunity set the Video timecode.
Thank you for you help
Only possible with ffmpeg if you are ready to re-encode the video stream as MPEG-2 e.g.
ffmpeg -i input -c:v mpeg2video -gop_timecode "03:04:05:06" output

How to transcode video stream by changing only the resolution?

I would like to transcode video stream using ffmpeg tool and change only the video stream resolution, i.e. the video and audio parameters should remain the same.
According to the man page of the ffmpeg the following command line should provide the desired result:
ffmpeg -i input.mp4 -vcodec copy -acodec copy -s WxH output.avi
The Video codec of the input stream is compatible with avi container.
The actual result is that the resolution remains unchanged and it seems that the stream is just repacked in avi container.
The resolution of the output stream is changed successfully without -vcodec copy option, but the video codec is changed: h264 (Constrained Baseline) - > mpeg4 (Simple Profile).
When you copy a video stream, you cannot change any of its paramters, sinceā€¦ well, you're copying it. ffmpeg won't touch it in any way, so it can't change the dimensions, frame rate, et cetera.
Also, ffmpeg always chooses a default video codec if you don't specify one. For AVI files, that's mpeg4.
If you want H.264 video, choose -c:v libx264 instead (or -vcodec libx264 which is the same). If you need to keep the original profile, use -profile:v baseline.
Two things:
When you change the size, you will recode the video. This lowers the quality and might considerably harm the video. To compensate for this, you might need to set a higher quality level. You do this by setting the Constant Rate Factor to anything below the default of 23, e.g. with -crf 20. Experiment and see how your video looks like. If you have the time, add the -preset slow (or slower, veryslow), which will give you better compression.
Not that it matters in your case, since your input uses the Constrained Baseline profile, but note that H.264 in AVI is not properly supported, at least when using B pictures. Baseline doesn't support B pictures though, so you should be fine. It could happen that file can't be played back on some devices or players if you use the Main profile or anything above. I would rather mux it into an MP4 or MKV container, especially if your input file is MP4 anyway.

Resources