B
B
Bobur Bakhritdinov2015-12-03 17:25:09
linux
Bobur Bakhritdinov, 2015-12-03 17:25:09

ffmpeg avi to mp4 h 264?

There are avi files on the server from 1 to 2 GB in size, I want to convert avi format to mp4 with h 264 support, there are about 200 avi video files on the server, I type the command:

ffmpeg -i file.avi -c:v libx264 -pix_fmt yuv420p -movflags faststart file.mp4

Converts 1 video about 10 minutes, on the server 8 GB of RAM.
I want to convert the file without losing quality and quickly convert, otherwise I will convert 200 films for 10-20 minutes until the end of my life. the size doesn't matter, I'm fine with mp4 files with the size of avi. for example avi file size is 1.37gb and after converting mp4 size is about 1.30 / 1.20gb! The quality of video files and the speed of conversion are important!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2015-12-03
@bakhritdinov_b

The processor is important here, I can suggest playing with the presets.
Here is an option similar to yours
Here's a faster option, but the quality is a little worse
You can add the option -t 00:00:30 to convert only the first 30 seconds for the test

M
monah_tuk, 2015-12-03
@monah_tuk

Comrade Nc_Soft gave quite workable commands, and actually your original one too.
UPD: as noted by Nc_Soft , it was fixed about threads (I read 0 as 1, it happens).
I note that -threads 0 should be duplicated before -i and after: the position of the option plays a role: before -i - parameters for entering (how the decoder will be parallelized), after -i - parameters for exiting (how the encoder will be parallelized). The value of the parameter is the number of threads. 0 - the optimal number will be selected (usually by the number of cores, taking into account hyperthreading), specify more than it is - you will start paying a lot for context switching.
With codec parameters it is better to study: ffmpeg.org/ffmpeg-codecs.html#libx264_002c-libx264rgband play around with the settings you want. Quality, like color and taste, is a very subjective parameter.
Another option for speeding up (if the processor is idle and you run into IO): at least write the result to tmpfs, and then put it where you need it. Well, or move completely to the SSD.
Threat wondering who signed me up as an expert?

S
s0ci0pat, 2015-12-03
@s0ci0pat

Converts the processor, not the RAM.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question