108 votes
Accepted

Best settings for FFMpeg with NVENC

Here is a rough guide to tuning the encoder: We'll start from the basics, as it would be detrimental to jump into the conclusion that a quick barrage of options will suddenly improve expected output ...
Dennis Mungai's user avatar
28 votes
Accepted

FFmpeg/avidemux: fix packed B-frames

B-frames are a frame type used in video compression to represent frames of a video. B-frames can use information from both previous and future frames to represent each video frame. Older DivX-...
xiii1408's user avatar
  • 396
19 votes
Accepted

ffmpeg: How do I re-encode a video to H.264 video and AAC audio?

Add -c:a aac: ffmpeg -i input.avi -c:v libx264 -preset slow -crf 20 -c:a aac -b:a 160k -vf format=yuv420p -movflags +faststart output.mp4 input.avi is the input file. -c:v libx264 selects the video ...
llogan's user avatar
  • 59.7k
12 votes

Using FFmpeg to locate moov atom

The way to do this using ffmpeg is described in this answer to another question. Run the following Bash command: $ ffmpeg -v trace -i file.mp4 2>&1 | grep -e type:\'mdat\' -e type:\'moov\' ...
Trevor's user avatar
  • 299
11 votes

Best settings for converting from h264 to hevc?

There is no best settings because quality is subjective, but the usual guidelines of libx265 (assuming you are using this encoder) is similar to libx264: Use the highest -crf value that gives you an ...
llogan's user avatar
  • 59.7k
11 votes

What is the different of h264 and libx264

There is no encoder named h264. Using -codec:v h264/-c:v h264/-vcodec h264 is just an alias that points to which H.264 encoder is the default. The default encoder depends on how your ffmpeg was ...
llogan's user avatar
  • 59.7k
10 votes

Are HEVC and H265 same? In FFmpeg they give different results why?

Are HEVC and H265 same? Yes. They are two names for the same video format. In ffmpeg they give different results why? libx265 and hevc_qsv are two different encoders that both output the H.265/HEVC ...
llogan's user avatar
  • 59.7k
9 votes
Accepted

How to increase video's FPS and speed correctly with ffmpeg?

The order should be reversed, ffmpeg -i in -filter:v "setpts=PTS/6,fps=30" out With the fps filter first, ffmpeg will insert 25 duplicate frames each second in order to convert 5 fps to 30, and then ...
Gyan's user avatar
  • 36.4k
8 votes

Video cut with missing frames in FFmpeg

Use ffmpeg -ss 01:19:22 -t 00:1:43 -i "in.mp4" -c copy -avoid_negative_ts make_zero out.mp4 Most compressed video uses temporal compression, so frames rely on other frames for full decoding. If you ...
Gyan's user avatar
  • 36.4k
7 votes
Accepted

H.264 video support in Chromium, missing codec?

By default, Chromium does not support proprietary codecs (like h.264, aac). Official info: https://www.chromium.org/audio-video So, on macOS, you need to compile Chromium with the proprietary codecs ...
Jerry's user avatar
  • 381
6 votes
Accepted

How to convert raw 264 file to MP4 provided by Luowice IP camera?

Found an explaination on the proprietary format here with a small soft to convert to mp4. If it can help
Alain1A45's user avatar
  • 348
6 votes
Accepted

ffmpeg warning: "Timestamps are unset in a packet" when converting H264 to mp4

Since the stream is created by ffmpeg, there is no reason for it not to contain required Timestamps. Except that raw H.264 bitstreams do not have timestamps. This change was introduced a while ago, ...
slhck's user avatar
  • 228k
6 votes
Accepted

Checking for GPU and H264 hardware decoding support

Judging by the tag applied to your question and the mention of containerization through Docker, I'm assuming that you intend to run this on Ubuntu. Details on specific hardware were omitted in your ...
Dennis Mungai's user avatar
5 votes

Best settings for FFMpeg with NVENC

My experience with using nvenc is that you need to tell it what bitrate you want -- it defaults to VBR, which is fine, but no amount of tuning makes up for the fact that it always wants to give you a ...
serilain's user avatar
  • 241
5 votes

ffmpeg: how to create an interlaced h.264 video?

x264 via ffmpeg can set interlaced mode in two ways: 1) via private param i.e. -x264opts (or -x264-params) interlaced=1 2) or via libavcodec generic flag, -flags +ildct
Gyan's user avatar
  • 36.4k
5 votes

ffmpeg: how to create an interlaced h.264 video?

Finally I got excellent results with ffmpeg \ -y \ -hide_banner \ -i "${INPUT_FILE}" \ \ [... audio ...]\ \ -vf tinterlace=interleave_top,fieldorder=tff \ -crf 28 \ -preset placebo \ [... ...
Thomas R.'s user avatar
  • 121
4 votes
Accepted

How can I use Avidemux to recompress H264 videos with similar quality?

There are several command line or GUI tools that show some of the simplified encoding parameters of an H264 video, eg. ffmpeg or mediainfo: $ mediainfo myvideo.mp4 [... look for the "Video" section .....
detly's user avatar
  • 513
4 votes
Accepted

ffmpeg encoding options to maximise Windows 7 compatibility?

The basic command below will get you a vanilla MP4 ffmpeg -i in -c:v libx264 -profile:v main -pix_fmt yuv420p -c:a aac -ac 2 -movflags +faststart out.mp4 I would have omitted the profile and the ...
Gyan's user avatar
  • 36.4k
4 votes

Converted MP4 video file to H.264, but there is no sound

.264 represents a raw H264 bitstream so no audio will be present. If you want the video in input to be transcoded to a H264 stream, use ffmpeg -i input.mp4 -vcodec libx264 -acodec aac output.mp4 But ...
Gyan's user avatar
  • 36.4k
4 votes
Accepted

Windows 10 Remote Desktop With RemoteFX and Hardware h.264 Using Nvidia NVENC

Finally managed to get it to work. There were several parts to the solution. Hardware encoding is ONLY ever used with AVC444 encoding. If your client isn't explicitly telling the server it is AVC444 ...
Gordan Bobić's user avatar
4 votes

ffmpeg - losslessly compress upscaled video

The short answer is no, you cannot do it completely losslessly. When video is scaled, an upsampling filter is used which modifies all pixels. There is no such thing as "good pixels" and &...
tater's user avatar
  • 375
3 votes
Accepted

FFMPEG HLS - Create playlist only or predict segment times before encoding

Unless you're manually forcing a keyframe cadence in some way, the output keyframe placement can't be guessed without passing the frames through the encoder. You can force more precise keyframe ...
Gyan's user avatar
  • 36.4k
3 votes
Accepted

Smart Trim an h.264 .MP4 Video file in ffmpeg

This can be achieved using the segment muxer and concat demuxer. Step 1 Segment the input Suppose you wish to extract 00:50 to 02:20 from the captured source. Let's say the GOP size is 3 seconds. ...
Gyan's user avatar
  • 36.4k
3 votes

ffmpeg-transcoded H.264 video does not play in Chrome

Use -movflags +faststart as an output option: ffmpeg -i input.mp4 -c copy -movflags +faststart output.mp4 It will relocate some data to the beginning of the file facilitating playback during ...
llogan's user avatar
  • 59.7k
3 votes

Converting or playing a .264 video file?

You can use ffmpeg to easily and quickly convert the .h264 file into mp4 ffmpeg -i yourfile.h264 -codec copy video.mp4 I personally did this just today and it worked perfectly. Source: http://...
Areeb Soo Yasir's user avatar
3 votes

Can a GPU be used to Encode h264?

https://trac.ffmpeg.org/wiki/HWAccelIntro FFmpeg provides a subsystem for hardware acceleration. Hardware acceleration allows to use specific devices (usually graphical card > or other specific ...
Ruslan Berozov's user avatar
3 votes

Properly fix videos which were encoded with old version of x264

Thank you for posting this question, it helped me understand the nature of the problem I was having too. I have a solution which seems to work. In my case I am using ffmpeg from the Ubuntu ...
cxrodgers's user avatar
  • 131
3 votes
Accepted

ffmpeg not working using h264_vaapi

Installing the non-free drivers resolved the problem for me: apt install intel-media-va-driver-non-free i965-va-driver-shaders Debian Bug report logs - #910486 ffmpeg: vaapi encoding does not ...
OBit's user avatar
  • 61
3 votes
Accepted

ffmpeg save images with frame type

Use ffmpeg -i input.mp4 -filter_complex "setpts=N/TB,select='1*eq(pict_type,PICT_TYPE_I)+2*eq(pict_type,PICT_TYPE_P)+3*eq(pict_type,PICT_TYPE_B)':n=3[i][p][b]" -vsync 0 -map "[i]" -r 1 -frame_pts 1 ...
Gyan's user avatar
  • 36.4k

Only top scored, non community-wiki answers of a minimum length are eligible