Ffmpeg. трюки и хитрости
Содержание:
- Filtering
- CPU usage / File size
- Examples
- Способ 6: Проверка целостности системных файлов
- Source Code
- Best practices for resolving ffmpeg issues
- Developer Documentation
- FFmpeg-related Sponsoring Programs
- FFmpeg Developer Meetings
- Community Contributed Documentation
- Path Configuration
- NVENC
- 4 Development
- Способ 7: Установка FFmpeg
- Point to point streaming
- Buffering/Latency
- Helper methods
- Streaming your desktop
- Patent Mini-FAQ
- ffmpeg сканер
- Другие процессы
- Codecs
- Replace Audio on a Video without re-encoding.
Filtering
- Filtering Guide, including syntax for filter options
- Fancy Filtering Examples
- Scaling (re-sizing) video
- Xfade – Crossfades, wipes, and other transitions
- Postprocessing – Postprocessing low-quality video with FFmpeg
- Stereoscopic – 3D movies with ffmpeg
- Null – Filter for testing decoding speed
- WaveformMonitor – Waveform Monitor in FFmpeg
- Vectorscope – Vectorscope in FFmpeg
- Histogram – Histogram in FFmpeg
- Afade audio filter curves illustrated
- Remap – Copies pixels from source frame to target frame based on mapping files/streams
- Audio Channel Manipulation – Upmix, downmix, split, and manipulate audio channels
- Audio Volume Manipulation – Change audio volume and perform normalization (peak, RMS, EBU R128)
CPU usage / File size
In general, the more CPU you use to compress, the better the output image will be, or the smaller of a file the output will be for the same quality.
Basically, the easiest way to save cpu is to decrease the input frame rate/size, or decrease the output frame rate/size.
Also you could (if capturing from live source), instruct the live source to feed a «smaller stream» (ex: webcam stream 640×480 instead of 1024×1280), or you could set a lower output «output quality» setting (q level), or specify a lower output desired bitrate (see Encode/H.264 for a background). Or try a different output codec, or specify new parameters to your codec (for instance, a different profile or preset for libx264). Specifying $ -threads 0 instructs the encoder to use all available cpu cores, which is the default. You could also resize the input first, before transcoding it, so it’s not as large. Applying a smoothing filter like hqdn3d before encoding might help it compress better, yielding smaller files.
You can also set a lower output frame rate to of course decrease cpu usage.
If you’re able to live capture in a pixel format that matches your output format (ex: yuv420p output from a webcam, instead of mjpeg), that might help with cpu usage, since it avoids an extra conversion. Using 64-bit instead of 32-bit executables (for those that have that choice) can result in a slight speedup. If you’re able to use -vcodec copy that, of course, uses the least cpu of all options since it just sends the frames verbatim to the output.
Sometimes you can change the «pixel formats» somehow, like using rgb16 instead of rgb24, to save time/space (or yuv420 instead of yuv444 or the like, since 420 stores less information it may compress better and use less bandwidth). This may not affect latency.
Examples
Scaling
Starting with something simple. Resize a 640×480 input to a 320×240 output.
ffmpeg -i input -vf scale=iw/2:-1 output
is input width. In this example the input width is 640. 640/2 = 320. The tells the scale filter to preserve the aspect ratio of the output, so in this example the scale filter will choose a value of 240. See the for additional information.
Multiple input overlay in 2×2 grid

Here four inputs are filtered together using the option. In this case all of the inputs are the (the ) but could be other inputs.
Within the filtergraph the first input is unchanged, and the other three inputs are individually filtered using , , and . The and filters are then used to stack each video into the desired location.
ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex \ "negate; \ hflip; \ edgedetect; \ hstack=inputs=2; \ hstack=inputs=2; \ vstack=inputs=2" -map "" -c:v ffv1 -t 5 multiple_input_grid.avi
This next example is the same as above, but uses the and filters instead. The pad filter is used to make an appropriate sized background, and overlay is used to place each video into the correct location. This method is slower than using hstack + vstack as shown above.
ffmpeg -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex \ "pad=iw*2:ih*2; \ negate; \ hflip; \ edgedetect; \ overlay=w; \ overlay=0:h; \ overlay=w:h" -map "" -c:v ffv1 -t 5 multiple_input_grid.avi
Be aware that frames are taken from each input video in timestamp order, so it is a good idea to pass all overlay inputs through a filter to have them begin in the same zero timestamp, such as .
Burnt in Timecode
Using the video filter.
PAL 25 fps non drop frame:
ffmpeg -i in.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/DroidSans.ttf: timecode='09\:57\:00\:00': r=25: \ x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -an -y out.mp4
NTSC 30 fps drop frame
(change the : to a ; before the frame count)_________________________________________________________
\
ffmpeg -i in.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/DroidSans.ttf: timecode='09\:57\:00\;00': r=30: \
x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -an -y out.mp4
Synthetic Input
The generates a test video pattern showing a color pattern, a scrolling gradient, and a timestamp. This is useful for testing purposes.
This example will create a 10 second output, 30 fps (300 frames total), with a frame size of 1280×720:
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 output.mpg
can also be used to view the resulting filtergraph:
ffplay -f lavfi -i "testsrc=duration=10:size=1280x720:rate=30"
You can also specify testsrc as a filter:
ffmpeg -filter_complex testsrc OUTPUT
Another type of testsrc is using the :
ffmpeg -f lavfi -i "smptebars=duration=5:size=1280x720:rate=30" output.mp4
Or a color
./ffmpeg -f lavfi -i color=c=red:size=100x100
There are other options for generating synthetic video input, see here and here («generic equation» filter).
Other Filter Examples
- Fancy Filtering Examples – Examples for various psychedelic effects and other weird filtering.
- Null describes the nullsink filter.
Способ 6: Проверка целостности системных файлов
Вероятность повреждения определенных системных файлов, что вызовет неполадки при использовании ffmpeg.dll, крайне мала, однако она все-таки присутствует. Избавиться от этой проблемы можно очень просто, поскольку пользователь не выполняет практически никаких действий. От него требуется только запустить процедуру сканирования и исправления через утилиту SFC, а все остальное будет осуществлено автоматически. Однако если стандартный инструмент SFC не справился со своей задачей и вывел на экран ошибку, дополнительно следует запустить уже исправление уже его через DISM, и потом снова вернуться к SFC. Обо всем этом читайте в другом нашем материале, перейти к которому можно, кликнув по указанной ниже ссылке.

Подробнее: Использование и восстановление проверки целостности системных файлов в Windows
Source Code
You may get the newest version of everything by following these instructions from the ffmpeg wiki.
In addition to the listed x264, you can add additional ones by running:
sudo apt-get install checkinstall yasm texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev frei0r-plugins-dev libdc1394-22 libdc1394-22-dev libgsm1 libgsm1-dev libopenjpeg-dev libschroedinger-1.0-0 libschroedinger-dev libschroedinger-doc libspeex-dev libvdpau-dev vflib3-dev librtmp-dev libva-dev libjack-jackd2-dev libass4 libass-dev libmodplug1 libmodplug-dev libvo-aacenc0 libvo-aacenc-dev libvo-amrwbenc0 libvo-amrwbenc-dev libopenal1 libopenal-dev
then changing your ./configure paramaters to:
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-x11grab --enable-vdpau --enable-runtime-cpudetect --enable-vaapi --enable-vda --enable-gnutls --enable-libass --enable-libmodplug --enable-libpulse --enable-librtmp --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-openal
Best practices for resolving ffmpeg issues
A clean and tidy computer is the key requirement for avoiding problems with ffmpeg. This means running a scan for malware, cleaning your hard drive using 1cleanmgr and 2sfc /scannow, 3uninstalling programs that you no longer need, checking for Autostart programs (using 4msconfig) and enabling Windows’ 5Automatic Update. Always remember to perform periodic backups, or at least to set restore points.
Should you experience an actual problem, try to recall the last thing you did, or the last thing you installed before the problem appeared for the first time. Use the 6resmon command to identify the processes that are causing your problem. Even for serious problems, rather than reinstalling Windows, you are better off repairing of your installation or, for Windows 8 and later versions, executing the 7DISM.exe /Online /Cleanup-image /Restorehealth command. This allows you to repair the operating system without losing data.
To help you analyze the ffmpeg.exe process on your computer, the following programs have proven to be helpful: ASecurity Task Manager displays all running Windows tasks, including embedded hidden processes, such as keyboard and browser monitoring or Autostart entries. A unique security risk rating indicates the likelihood of the process being potential spyware, malware or a Trojan. BMalwarebytes Anti-Malware detects and removes sleeping spyware, adware, Trojans, keyloggers, malware and trackers from your hard drive.
Developer Documentation
- Development Policies and Guides
- Guide for Using Git
- Notes on Maintaining FFmpeg Source Code and Being a Maintainer
- FATE – Our Continuous Integration Platform / regression testing system
- Cleanup – A list of components that may be considered candidates for removal
- Debugging
- How to conduct merges from Libav
- How to apply patches from Patchwork
- Google Summer of Code
- GSoC 2021
- GSoC 2020
- GSoC 2019
- GSoC 2018
- GSoC 2017
- GSoC 2016
- GSoC 2015
- GSoC 2014
- Outreachy
- Outreachy — Dec 2016
- Outreachy — May 2016
- Outreachy — May 2015
- OPW — Dec 2014
FFmpeg Developer Meetings
- FFmeeting/2020-12
- FFmeeting/2020-02
- FFmeeting/2019-12
- FFmeeting/2016-05
- FFmeeting/2015-09
- FFmeeting/2014-10
- FFmeeting/2014-01
Community Contributed Documentation
The guides below have been written by users and for users to supplement the official FFmpeg Documentation. If you’re confused about something refer to the official documentation and if you’re still having problems we can help.
Path Configuration
Option 1
The default value of an empty string (expecting ffmpeg to be found through PATH) can be overwritten via the class:
// setting global options
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "./bin", TemporaryFilesFolder = "/tmp" });
// or
GlobalFFOptions.Configure(options => options.BinaryFolder = "./bin");
// on some systems the absolute path may be required, in which case
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = Server.MapPath("./bin"), TemporaryFilesFolder = Server.MapPath("/tmp") });
// or individual, per-run options
await FFMpegArguments
.FromFileInput(inputPath)
.OutputToFile(outputPath)
.ProcessAsynchronously(true, new FFOptions { BinaryFolder = "./bin", TemporaryFilesFolder = "/tmp" });
Option 2
The root and temp directory for the ffmpeg binaries can be configured via the file, which will be read on first use only.
{
"BinaryFolder": "./bin",
"TemporaryFilesFolder": "/tmp"
}
Supporting both 32 and 64 bit processes
If you wish to support multiple client processor architectures, you can do so by creating two folders, and , in the directory.
Both folders should contain the binaries ( and ) built for the respective architectures.
By doing so, the library will attempt to use either .
If these folders are not defined, it will try to find the binaries in .
( is only appended on Windows)
Older versions of ffmpeg might not support all ffmpeg arguments available through this library. The library has been tested with version to
NVENC
NVENC can be used for H.264 and HEVC encoding. FFmpeg supports NVENC through the and encoders. In order to enable it in FFmpeg you need:
- A supported GPU
- Supported drivers for your operating system
- The NVIDIA Codec SDK or compiling FFmpeg with —enable-cuda-llvm
- configured with (default if the drivers are detected while configuring)
Note:
FFmpeg uses its own slightly modified runtime-loader for NVIDIA’s CUDA/NVENC/NVDEC-related libraries. If you get an error from complaining about missing , this project is what you need. It has a working Makefile with an install target: . FFmpeg will look for its pkg-config file, called . Make sure it is in your .
This means that running the following before compiling ffmpeg should suffice:
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git cd nv-codec-headers make sudo make install
After compilation, you can use NVENC.
Usage example:
ffmpeg -i input -c:v h264_nvenc -profile high444p -pixel_format yuv444p -preset default output.mp4
You can see available presets, other options, and encoder info with or .
Note: If you get the error make sure you’re encoding to a supported pixel format. See encoder info as shown above.
4 Development
Yes. Check the doc/examples directory in the source
repository, also available online at:
https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples.
Examples are also installed by default, usually in
.
Also you may read the Developers Guide of the FFmpeg documentation. Alternatively,
examine the source code for one of the many open source projects that
already incorporate FFmpeg at (projects.html).
It depends. If your compiler is C99-compliant, then patches to support
it are likely to be welcome if they do not pollute the source code
with s related to the compiler.
Yes. Please see the Microsoft Visual C++
section in the FFmpeg documentation.
No. These tools are too bloated and they complicate the build.
FFmpeg is already organized in a highly modular manner and does not need to
be rewritten in a formal object language. Further, many of the developers
favor straight C; it works for them. For more arguments on this matter,
read .
The build process creates , , etc. which
contain full debug information. Those binaries are stripped to create
, , etc. If you need the debug information, use
the *_g versions.
Yes, as long as the code is optional and can easily and cleanly be placed
under #if CONFIG_GPL without breaking anything. So, for example, a new codec
or filter would be OK under GPL while a bug fix to LGPL code would not.
FFmpeg builds static libraries by default. In static libraries, dependencies
are not handled. That has two consequences. First, you must specify the
libraries in dependency order: must come before
, must come after everything else, etc.
Second, external libraries that are used in FFmpeg have to be specified too.
An easy way to get the full list of required libraries in dependency order
is to use .
c99 -o program program.c $(pkg-config --cflags --libs libavformat libavcodec)
See doc/example/Makefile and doc/example/pc-uninstalled for
more details.
FFmpeg is a pure C project, so to use the libraries within your C++ application
you need to explicitly state that you are using a C library. You can do this by
encompassing your FFmpeg includes using .
See
FFmpeg is a pure C project using C99 math features, in order to enable C++
to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS
You have to create a custom AVIOContext using ,
see libavformat/aviobuf.c in FFmpeg and libmpdemux/demux_lavf.c in MPlayer or MPlayer2 sources.
see https://www.ffmpeg.org/~michael/
Even if peculiar since it is network oriented, RTP is a container like any
other. You have to demux RTP before feeding the payload to libavcodec.
In this specific case please look at RFC 4629 to see how it should be done.
is NOT the average frame rate, it is the smallest frame rate
that can accurately represent all timestamps. So no, it is not
wrong if it is larger than the average!
For example, if you have mixed 25 and 30 fps content, then
will be 150 (it is the least common multiple).
If you are looking for the average frame rate, see .
Make sure you have the fate-suite samples and the Make variable
or environment variable or the
option is set to the right path.
Do you happen to have a character in the samples path to indicate a
home directory? The value is used in ways where the shell cannot expand it,
causing FATE to not find files. Just replace by the full path.
This document was generated on September 9, 2021 using makeinfo.
Hosting provided by telepoint.bg
Способ 7: Установка FFmpeg
Мы поставили этот вариант на последнее место, поскольку подойдет он только тем пользователям, кто занимается собственноручной разработкой программного обеспечения и желает исправить возникшую ошибку. Заключается способ в скачивании сборки софта FFmpeg и интеграции его в свой продукт. Если вы занимаетесь программированием, то точно знаете, как именно интегрировать элементы в свой код, поэтому мы продемонстрируем лишь получение необходимой сборки инструмента.
Теперь вы знакомы с доступными вариантами исправления проблемной библиотеки ffmpeg.dll в Windows. Как видите, существует их достаточное количество, поэтому юзеру останется лишь поочередно выполнять каждый из них, чтобы в итоге найти эффективный конкретно для себя.
Опишите, что у вас не получилось.
Наши специалисты постараются ответить максимально быстро.
Point to point streaming
If you want to stream «from one computer to another», you could start up a server on one, and then stream from FFmpeg to that server, then have the client connect to that server (server could either be on client or server side computers). Or you could do a point to point type stream, like:
ffmpeg -i INPUT -acodec libmp3lame -ar 11025 --f rtp rtp://host:port
where host is the receiving IP. Then receive the stream using VLC or ffmpeg from that port (since rtp uses UDP, the receiver can start up any time).
or
ffmpeg -i INPUT -f mpegts udp://host:port
Alternatively, increase your buffer size, like mplayer ffmpeg://udp://host:port?buffer_size=10000000 (the default is system dependent and typically far too low for any reasonable buffering. On linux though you can only set it to like 200K max anyway, so this isn’t good enough—make sure to use the circular buffer, and that the following works: ffmpeg://udp://host:port?buffer_size=10000000?fifo_size=100000 (the fifo_size should not emit a warning, and implies that you have a secondary thread that collects incoming packets for you if there is no warning).
Another option is to use some transmission type that uses TCP for your transport. (The RTMP protocol, popular in streaming to servers, uses TCP probably for this reason—you just can’t use that for point to point streaming).
One option to use TCP is like this:
ffmpeg -i INPUT -f mpegts tcp://host:port
which I would guess will try and (as a client) establish a connection do that host on that port (assuming it has a server waiting for the incoming connection). You could receive it like this:
ffmpeg -i tcp://local_hostname:port?listen
(basically, one side needs to specify «listen» and the other needs to not to).
To use with mplayer as a receiver it would be like
ffmpeg -i ... -f mpegts "tcp://127.0.0.1:2000"
and on the mplayer side
mplayer ... ffmpeg://tcp://127.0.0.1:2000?listen
(start mplayer first)
Another option is to use RTP (which by default uses UDP) but by specifying it use TCP:
ffmpeg -i input -f rtsp -rtsp_transport tcp rtsp://localhost:8888/live.sdp
(For meanings of options see .
Then you may receive it like this (ffplay or ffmpeg):
ffplay -rtsp_flags listen rtsp://localhost:8888/live.sdp?tcp # ending "?tcp" may not be needed -- you will need to start the server up first, before the sending client
ffmpeg also has a «listen» option for rtmp so it may be able to receive a «straight» rtmp streams from a single client that way.
With tcp based streams you can probably use any formatting/muxer, but with udp you need to be careful and use a muxer that supports ‘connecting anytime’ like mpegts.
If you are forced to use udp (for instance you need to broadcast to a multicast port for whatever reason) then you may be able to avoid the packet loss by (sending less data or sending the same frames over and over again so they have a higher chance of being received).
See also the section on i-frames in .
Final working p2p client, with multicast:
server:
ffmpeg -f dshow -framerate 20 -i video=screen-capture-recorder -vf scale=1280:720 -vcodec libx264 -pix_fmt yuv420p -tune zerolatency -preset ultrafast -f mpegts udp://236.0.0.1:2000
client:
mplayer -demuxer +mpegts -framedrop -benchmark ffmpeg://udp://236.0.0.1:2000?fifo_size=100000&buffer_size=10000000 # (see note above about linux needing fifo_size as well as buffer_size).
Buffering/Latency
By default FFmpeg captures frames from the input, and then does whatever you told it to do, for instance, re-encoding them and saving them to an output file. By default if it receives a video frame «too early» (while the previous frame isn’t finished yet), it will discard that frame, so that it can keep up the the real time input. You can adjust this by setting the parameter, though note that if your encoding process can’t keep up, eventually you’ll still start losing frames just the same (and using it at all can introduce a bit of latency). It may be helpful to still specify some size of buffer, however, otherwise frames may be needlessly dropped possibly.
See StreamingGuide for some tips on tweaking encoding (sections latency and cpu usage). For instance, you could save it to a very fast codec, then re-encode it later.
There is also an option .
Basically if you’re capturing from a live mic, the default behavior for this hardware device is to «buffer» 500ms (or 1000ms) worth of data, before it starts sending it down the pipeline. This can introduce startup latency, so setting this to 50ms (msdn suggests 80ms) may be a better idea here. The timestamps on the data will be right, it will just have added (unneeded) latency if you don’t specify this.
Helper methods
The provided helper methods makes it simple to perform common operations.
Easily capture snapshots from a video file:
// process the snapshot in-memory and use the Bitmap directly var bitmap = FFMpeg.Snapshot(inputPath, new Size(200, 400), TimeSpan.FromMinutes(1)); // or persists the image on the drive FFMpeg.Snapshot(inputPath, outputPath, new Size(200, 400), TimeSpan.FromMinutes(1));
Join images into a video:
FFMpeg.JoinImageSequence(@"..\joined_video.mp4", frameRate: 1,
ImageInfo.FromPath(@"..\1.png"),
ImageInfo.FromPath(@"..\2.png"),
ImageInfo.FromPath(@"..\3.png")
);
Combine an image with audio file, for youtube or similar platforms
FFMpeg.PosterWithAudio(inputPath, inputAudioPath, outputPath); // or var image = Image.FromFile(inputImagePath); image.AddAudio(inputAudioPath, outputPath);
Other available arguments could be found in namespace.
Streaming your desktop
Examples below use for Linux. Windows users can use or . macOS can use . See FFmpeg Wiki: Capture Desktop for additional examples.
Without scaling the output
If you want the output video frame size to be the same as the input:
$ ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -framerate 30 -video_size 1280x720 \ -i :0.0+0,0 -c:v libx264 -preset veryfast -b:v 1984k -maxrate 1984k -bufsize 3968k \ -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 \ -f flv rtmp://live.twitch.tv/app/<stream key>
Scaling the output
If you want the output video frame size to be smaller than the input then you can use the :
$ ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -framerate 30 -video_size 1680x1050 \ -i :0.0+0,0 -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 3000k \ -vf "scale=1280:-1,format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 \ -f flv rtmp://live.twitch.tv/app/<stream key>
The in the scale filter example will automatically calculate the correct value to preserve the height. In this case the output will have a frame size of 1280×800.
With webcam overlay/picture-in-picture (PiP)
This will place your webcam overlay in the top right:
$ ffmpeg -f x11grab -video_size 1680x1050 -framerate 30 -i :0.0 \ -f v4l2 -video_size 320x240 -framerate 30 -i /dev/video0 \ -f alsa -ac 2 -i hw:0,0 -filter_complex \ "scale=1024:-1,setpts=PTS-STARTPTS; \ scale=120:-1,setpts=PTS-STARTPTS; \ overlay=W-w-10:10,format=yuv420p" -map "" -map 2:a -c:v libx264 -preset veryfast \ -b:v 3000k -maxrate 3000k -bufsize 4000k -c:a aac -b:a 160k -ar 44100 \ -f flv rtmp://live.twitch.tv/app/<stream key>
You can see additional details your webcam with something like: ffmpeg -f v4l2 -list_formats all -i /dev/video0 or with v4l2-ctl —list-formats-ext. See the documentation on the video4linux2 (v4l2) input device for more info.
Your webcam may already support whatever frame size you want to overlay onto the main video, so scaling the webcam video as shown in this example can be omitted (just set the appropriate v4l2 -video_size and remove the scale=120:-1,).
With webcam overlay and logo
This will place your webcam overlay in the top right, and a logo in the bottom left:
$ ffmpeg -f x11grab -video_size 1680x1050 -framerate 30 -i :0.0 \ -f v4l2 -video_size 320x240 -framerate 30 -i /dev/video0 \ -f alsa -ac 2 -i hw:0,0 -i logo.png -filter_complex \ "scale=1024:-1,setpts=PTS-STARTPTS; \ scale=120:-1,setpts=PTS-STARTPTS; \ overlay=W-w-10:10; \ overlay=W-w-10:H-h-10,format=yuv420p" -map "" -map 2:a -c:v libx264 -preset veryfast \ -maxrate 3000k -bufsize 4000k -c:a aac -b:a 160k -ar 44100 \ -f flv rtmp://live.twitch.tv/app/<stream key>
Patent Mini-FAQ
A lot of legal questions surrounding patents arise when discussing multimedia
technology. This
mini-FAQ attempts to address these issues. Note that much of this discussion
is based on precedent, or what has happened in the past under similar
circumstances. Very little consideration is given to what could happen.
If you use your imagination, you can visualize any dire scenario and cease
doing any productive work.
Q: Does FFmpeg use patented algorithms?
A: We do not know, we are not lawyers so we are not qualified to answer
this. Also we have never read patents to implement any part of FFmpeg,
so even if we were qualified we could not answer it as we do not know
what is patented. Furthermore the sheer number of software patents makes it
impossible to read them all so no one (lawyer or not) could answer
such a question with a definite no, those who do lie.
What we do know is that various standards FFmpeg supports contain vague
hints that any conforming implementation might be subject to some patent
rights in some jurisdictions, examples for such statements are:
For H.264:
And for MPEG-4:
Q: Is it safe to use such patented algorithms?
A: Patent laws vary wildly between jurisdictions, and in many countries
patents on algorithms are not recognized. Plus the use of patents to
prevent the usage of a format or codec on a specific operating system
or together with specific other software might violate antitrust laws.
So whether you are safe or not depends on where you live and how judges
interpret the law in your jurisdiction.
Q: Bottom line: Should I be worried about patent issues if I use FFmpeg?
A: Are you a private user working with FFmpeg for your own personal purposes?
If so, there is remarkably little reason to be concerned. Are you using FFmpeg
in a commercial software product? Read on to the next question…
Q: Is it perfectly alright to
incorporate the whole FFmpeg core into my own commercial product?
A: You might have a problem here. There have been cases where companies
have used FFmpeg in their products. These companies found out that once
you start trying to make money from patented technologies, the owners of
the patents will come after their licensing fees. Notably, MPEG LA is
vigilant and diligent about collecting for MPEG-related technologies.
Hosting provided by telepoint.bg
ffmpeg сканер
Security Task Manager показывает все запущенные сервисы Windows, включая внедренные скрытые приложения (например, мониторинг клавиатуры или браузера, авто вход). Уникальный рейтинг надежности указывает на вероятность того, что процесс потенциально может быть вредоносной программой-шпионом, кейлоггером или трояном.
Бесплатный aнтивирус находит и удаляет неактивные программы-шпионы, рекламу, трояны, кейлоггеры, вредоносные и следящие программы с вашего жесткого диска. Идеальное дополнение к Security Task Manager.
Reimage бесплатное сканирование, очистка, восстановление и оптимизация вашей системы.
Другие процессы
ytdownloader.exe amdxata.sys netsession_win_ce5ba24.dll ffmpeg.exe fpcsevtsvc.exe powerbiosserver.exe snapman.sys tablacusapp.exe tfwah.dll expresscache.exe slimservicefactory.exe
Codecs
The most popular streaming codec is probably libx264, though if you’re streaming to a device which requires a «crippled» baseline h264 implementation, you can use the x264 «baseline» profile. Some have have argued that the mp4 video codec is better than x264 baseline, because it encodes about as well with less cpu. You may be able to use other codecs, like mpeg2video, or really any other video codec you want, typically, as long as your receiver can decode it, if it suits your needs.
Also note that encoding it to the x264 «baseline» is basically a «compatibility mode» for older iOS devices or the like, see here.
The mpeg4 video codec sometimes also comes «within a few percentage» of the compression of x264 «normal settings», but uses much less cpu to do the encoding. See for some graphs (which may be slightly outdated). Basically in that particular test it was 54 fps to 58 fps (libx264 faster), and libx264 file was 5.1MB and mpeg4 was 6MB, but mpeg4 used only half as much cpu for its computation, so take it with a grain of salt.
Replace Audio on a Video without re-encoding.
preferred method
strip audio stream away from video
combine the two streams together (new audio with originally exisiting video)
or add an offset to audio
You say you want to «extract audio from them (mp3 or ogg)». But what if the audio in the mp4 file is not one of those? you’d have to transcode anyway. So why not leave the audio format detection up to ffmpeg?
To convert one file:
To convert many files:
You can of course select any ffmpeg parameters for audio encoding that you like, to set things like bitrate and so on.
Use and change the extension from to for mp3 encoding.
If what you want is to really extract the audio, you can simply «copy» the audio track to a file using -acodec copy. Of course, the main difference is that transcoding is slow and cpu-intensive, while copying is really quick as you’re just moving bytes from one file to another. Here’s how to copy just the audio track (assuming it’s in mp3 format):
Note that in this case, the audiofile format has to be consistent with what the container has (i.e. if the audio is AAC format, you have to say audiofile.aac). You can use the ffprobe command to see which formats you have, this may provide some information:
A possible way to automatically parse the audio codec and name the audio file accordingly would be:
ffprobe «$file» 2>&1 |sed -rn ‘s/.Audio: (…), ./\1/p’
Note that this command uses sed to parse output from ffprobe for each file, it assumes a 3-letter audio codec name (e.g. mp3, ogg, aac) and will break with anything different.
Encoding multiple files
You can use a Bash «for loop» to encode all files in a directory:
m4a to mp3 conversion with ffmpeg and lame
A batch file version of the same command would be: