I have an Ubuntu PC with no video card.
I use avconv for video conversion:
avconv -i video.wmv -c:v libx264 -c:a libmp3lame -b:v 1800K video.mp4
My CPU (Intel Core i7-4770K) processes 1.5-2Gb video in around 7-10 minutes.
In the avconv github sources I saw the options
Hardware accelerators:
--enable-d3d11va enable D3D11VA code
--enable-dxva2 enable DXVA2 code
--enable-vaapi enable VAAPI code
--enable-vda enable VDA code
--enable-vdpau enable VDPAU code
I am thinking of compiling avconv with --enable-vdpau and putting a video card into the PC.
Does this allow avconv to use the video card for video conversion?
How can this increase the speed of video conversion (I mean my command)?
Can you help me to do this test, if you have avconv in your PC with a video card?
Here is an example of WMV.
If you don't want to compile anything from source or use PPAs for extra packages, you can first see what the distribution has to offer:
$ avconv -codecs | grep vdpau
avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
DEV.L. mpeg1video MPEG-1 video (decoders: mpeg1video mpeg1video_vdpau )
DEV.L. mpeg2video MPEG-1 video (decoders: mpeg2video mpegvideo_vdpau )
DEV.L. mpeg4 MPEG-4 part 2 (decoders: mpeg4 mpeg4_vdpau ) (encoders: mpeg4 libxvid )
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 )
D.V.L. vc1 SMPTE VC-1 (decoders: vc1 vc1_vdpau )
D.V.L. wmv3 Windows Media Video 9 (decoders: wmv3 wmv3_vdpau )
Look carefully at the letters "D" - for decoding, "E" for encoding. As you see, VDPAU is only for decoding - it won't help you with encoding the video back. You'd have to measure if this:
avconv -vcodec wmv3_vdpau -i video.wmv -c:v libx264 -c:a libmp3lame -b:v 1800K video.mp4
... gives you any improvement in the tanscoding time.
From my experience the VDPAU is great for watching video - Mplayer2 and VLC support it for display, and I got Mplayer2 to use it also for h264 decoding. The same 1080p clip can play with 80% CPU load on 2 cores with software decoding, and 5-10% CPU load when both the decoding and presentation (video output) is done via VDPAU.
For encoding you could research AMD's VCE, Intel's QuickSync and Nvidia's NVENC (alphabetical order).
Meantime, from ffmpeg:
I had problems with getting avconv to use VDPAU for decoding. Then I stumbled upon this (recommended reading for this kind of question anyway):
https://trac.ffmpeg.org/wiki/HWAccelIntro
-> it seems that the VDPAU decoders support state is:
Actually yes, but is deprecated and should not be used.
So, the final answer is - a card with VDPAU is likely of no advantage in your situation.
Related
I have installed ffmpeg 3.0 from https://github.com/FFmpeg/FFmpeg, I am trying to convert a video coded with mepeg4 part 2 to H264, but I got Unknown encoder 'libx264'
error
Here is my comannd: (I tried h264, x264, libx264, none of them worked)
ffmpeg -i Fashion.divx -acodec aac -vcodec libx264 out.mp4
I checked the list of supported codec
Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
-------
D.VI.. 012v Uncompressed 4:2:2 10-bit
Here is h264:
D.V.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau)
I am using ffmpeg 3.0, from that list, it seems that encoding with h264 is not supported, only decoding h264 is supported, right?
I tried to enable h.264 with this guide
How to quickly compile FFmpeg with libx264 (x264, H.264)
./configure --enable-gpl --enable-libx264
bu I get
./configure --enable-gpl --enable-libx264
ERROR: libx264 not found
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
what should I do to make encode video in h.264 work?
Ok, I just found out I need to install libx264 separately, here is the command
sudo apt-get install yasm libvpx. libx264.
Indeed after install libx264, I get
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 libx264rgb )
Hehe, you've already answered your own question:
Here is h264:
D.V.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau)
As the listing suggests, the encoder's name is h264, the codec's name can be found between the braces.
So your command should look like this:
ffmpeg -i Fashion.divx -acodec libfaac -vcodec h264 out.mp4
My FFmpeg version has libx264, so the -codecs option prints me this:
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 libx264rgb )
As you can see, I could use -vcodec libx264 or -vcodec libx264rgb.
I am trying to convert an mp3 file to the format expected by the audio tag in the Amazon Alexa SSML markup language as described here: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference
The documentation recommends using https://www.ffmpeg.org/ffmpeg.html
I tried this command but can't find the right codec to use:
ffmpeg -y -i input.mp3 -ar 44100 -ab 48k -codec:a mpeg2 -ac 1 output.mp3
I know I need to convert the file because Alexa fails with the following error: The audio is not of a supported MPEG version
Its a little confusing, and frankly a little odd that amazon requires this. mp3 files can be mpeg1 or mpeg2 or mpeg-2.5 (non standard, but widely supported). For this purpose, the main differences between the versions are bitrate and sample rate. Amazon requires 48kbps (which is supported in all mpeg versions). Next, mpeg-2 only supports sample rates of 22050 Hz, 24000 Hz, and 16000 Hz. So resampling to one of those frequencies should force ffmpeg to MPEG-2 layer 3.
ffmpeg -y -i input.mp3 -ar 16000 -ab 48k -codec:a libmp3lame -ac 1 output.mp3
more info here and here:
http://www.mp3-tech.org/programmer/frame_header.html
https://en.wikipedia.org/wiki/MP3
Here's what I had to do to get it working:
ffmpeg -i input.mp3 -b:a 48k -ar 16000 output.mp3
Here's the output when I play it with mpg123:
$ mpg123 output.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.22.4; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Playing MPEG stream 1 of 1: output.mp3 ...
MPEG 2.0 layer III, VBR, 16000 Hz joint-stereo
[0:02] Decoding of output.mp3 finished.
This is my current ezstream config
<ezstream>
<url>http://localhost:8000/test</url>
<sourcepassword>password</sourcepassword>
<format>MP3</format>
<filename>playlist.m3u</filename>
<reencode>
<enable>1</enable>
<encdec>
<format>MP3</format>
<match>.mp3</match>
<decode>madplay -b 16 -R 44100 -S -o raw:- "#T#"</decode>
<encode>lame --preset cbr 32 -r -s 44.1 --bitwidth 16 - -</encode>
</encdec>
</reencode>
</ezstream>
It's mounting to an icecast server, its decoding and encoding mp3 to a lower bitrate, I'm trying to encode it to aac instead of mp3 in hopes that the quality improves as i heard that aac is better than mp3 for lower bitrates.
What i would like to know is if i can use an aac encoder such as FFmpeg instead of the lame mp3 encoder and get an aac to the end user instead of mp3, if so what parameters should i pass to FFmpeg so that it works with my current config.
I personally recommend the Opus codec. It's much better than MP3, including and especially at lower bit rates. Also no need to worry about buying an encoder license.
You can use avconv/ffmpeg instead of ezstream.
avconv -re -i http://someserver/stream.mp3 -c:a opus -b:a 20k \
-application audio -vbr on -frame_duration 60 \
-content_type audio/ogg \
icecast://source:bar#server:8000/test-20.opus
This example will work with latest avconv and with latest Icecast (2.4.1).
There are packages for all major distros on http://icecast.org/download if your distro doesn't have that version.
BTW: If you insist on AAC, bought an encoder license etc. It's trivial to adapt the above example.
Icecast doesn't officially support AAC due to licensing.
Icecast is a streaming media server which currently supports Ogg (Vorbis and Theora), Opus, WebM and MP3 audio streams.
Unofficially it might work in pass-trough mode, but you need to try and see for yourself.
For FFmpeg AAC ecoding you should use the Fraunhofer FDK AAC library (libfdk_aac). You also need a streamable format like AAC in ADTS.
Based on your example it seems it uses stdout to transcode. If you converted the MP3 to PCM using madplay you should be able to encode it to AAC using something like this:
<encode>ffmpeg -f s16le -ar 44.1k -ac 2 -i - -b:a 32k -ar 44.1k -f adts -</encode>
This question already has answers here:
What are all codecs and formats supported by FFmpeg?
(4 answers)
Closed 1 year ago.
Is there a list somewhere for ffmpeg which lists what the libraries we enter into the -acodec/ -vcodec parameters support?
eg: ffmpeg -vcodec x264 -acodec libmp3lame
I would like a list showing which formats x264/libmp3lame support.
Also is there a list that shows all possible inputs to the -vcodec & -acodec parameters.
You can use ffmpeg -codecs to get a list.
$ ffmpeg -codecs
Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
-------
D.VI.S 012v Uncompressed 4:2:2 10-bit
D.V.L. 4xm 4X Movie
D.VI.S 8bps QuickTime 8BPS video
.EVIL. a64_multi Multicolor charset for Commodore 64 (encoders: a64multi )
.EVIL. a64_multi5 Multicolor charset for Commodore 64, extended with 5th color (colram) (encoders: a64multi5 )
D.V..S aasc Autodesk RLE
D.VIL. aic Apple Intermediate Codec
DEVI.S alias_pix Alias/Wavefront PIX image
DEVIL. amv AMV Video
D.V.L. anm Deluxe Paint Animation
<snip>
In your case, it looks like you would be interested in this line:
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_crystalhd h264_v4l2m2m h264_vdpau h264_cuvid ) (encoders: libx264 libx264rgb h264_nvenc h264_omx h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
and this line:
DEA.L. mp3 MP3 (MPEG audio layer 3) (decoders: mp3 mp3float ) (encoders: libmp3lame libshine )
If you want just the video codecs, you can filter them with 'V':
ffmpeg -codecs | grep '^ ..V'
and audio with 'A':
ffmpeg -codecs | grep '^ ..A'
The advantage of this method is that it shows you what codecs your copy of ffmpeg supports. There is also a list of codecs that the most recent version of ffmpeg supports here:
https://ffmpeg.org/ffmpeg-codecs.html
Related:
Determine FFmpeg codecs available for container
How can I determine if a codec / container combination is compatible with FFmpeg?
https://superuser.com/questions/655951/which-codecs-are-supported-by-ffmpeg-libraries-in-system
i have been searching for a while but no luck. you should search one by one.
becuase many containers support variety of codecs, but unfortunately, ffmpeg dose not support that perfectly. even if you can transcode, you can't playback it.
following link is which containers support what codecs. remind that this lists are not matched with ffmpeg perfectly.
http://en.wikipedia.org/wiki/Comparison_of_container_formats
following lists are my tested results in ffmpeg 2.2, which containers support h264/mp3 codecs. perhaps this is what you want :)
H264(libx264) available containers : mp4, flv, ts, mkv, mts, mov, 3gp, 3g2
mp3(libmp3lame) available containers : mp4, wmv, flv, avi, mkv, mpg, mts, mov
I have a *.mp4 video file(MPEG4 video codec) and I am trying to convert this to a H264 video codec format(raw h.264 format) using ffmpeg on Linux(Version - FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1, Copyright (c) 2000-2009 Fabrice Bellard,) using command line as shown below,
ffmpeg -i input .mp4 output.h264
but I get an error saying -
Unsupported codec for output stream #0.0
Then when i try this option:
ffmpeg -i input .mp4 -formats h264 output.h264
it still does not work, and gives -
Seems stream 0 codec frame rate differs from container frame rate: 59.94 (5994/100) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rapture.mp4':
Duration: 00:02:06.44, start: 0.000000, bitrate: 26574 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 1920x1080, 29.97 tbr, 29.97 tbn, 59.94 tbc
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16
And then it prints out help on the formats which we get when we do ffmpeg -formats
When I checked the help, ffmpeg -formats, I see below information related to H264 file format and codec:
File format :
DE h264 raw H.264 video format
Codecs:
D V D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
My questions :
How can I convert the video to a H264 encoded video (raw H264 video format)
When I do ffmpeg -formats, I see many acronyms for the codecs supported, I see many acronyms before the codec name/type such as - D V D S E A, what do they stand for?
How to use the ffmpeg options -vcodec and -formats?
I used these options to convert to the H.264/AAC .mp4 format for HTML5 playback (I think it may help other guys with this problem in some way):
ffmpeg -i input.flv -vcodec mpeg4 -acodec aac output.mp4
UPDATE
As #LordNeckbeard mentioned, the previous line will produce MPEG-4 Part 2 (back in 2012 that worked somehow, I don't remember/understand why). Use the libx264 encoder to produce the proper video with H.264/AAC. To test the output file you can just drag it to a browser window and it should playback just fine.
ffmpeg -i input.flv -vcodec libx264 -acodec aac output.mp4
I believe you have libx264 installed and configured with ffmpeg to convert video to h264... Then you can try with -vcodec libx264... The -format option is for showing available formats, this is not a conversion option I think...
I believe that by now the above answers are outdated (or at least unclear) so here's my little go at it.
I tried compiling ffmpeg with the option --enable-encoders=libx264 and it will give no error but it won't enable anything (I can't seem to find where I found that suggestion).
Anyways step-by-step, first you must compile libx264 yourself because repository version is outdated:
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar --bzip2 -xvf last_x264.tar.bz2
cd x264-snapshot-XXXXXXXX-XXXX/
./configure
make
sudo make install
And then get and compile ffmpeg with libx264 enabled.
I'm using the latest release which is "Happiness":
wget http://ffmpeg.org/releases/ffmpeg-0.11.2.tar.bz2
tar --bzip2 -xvf ffmpeg-0.11.2.tar.bz2
cd ffmpeg-0.11.2/
./configure --enable-libx264 --enable-gpl
make
sudo install
Now finally you have the libx264 codec to encode, to check it you may run
ffmpeg -codecs | grep h264
and you'll see the options you have were the first D means decoding and the first E means encoding
"C:\Program Files (x86)\ffmpegX86shared\bin\ffmpeg.exe" -y -i "C:\testfile.ts" -an -vcodec libx264 -g 75 -keyint_min 12 -vb 4000k -vprofile high -level 40 -s 1920x1080 -y -threads 0 -r 25 "C:\testfile.h264"
The above worked for me on a Windows machine using a FFmpeg Win32 shared build by Kyle Schwarz. The build was compiled on: Feb 22 2013, at: 01:09:53
Note that -an defines that audio should be skipped.
I have a Centos 5 system that I wasn't able to get this working on. So I built a new Fedora 17 system (actually a VM in VMware), and followed the steps at the ffmpeg site to build the latest and greatest ffmpeg.
I took some shortcuts - I skipped all the yum erase commands, added freshrpms according to their instructions:
wget http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/9/freshrpms-release/freshrpms-release-1.1-1.fc.noarch.rpm
rpm -ivh rpmfusion-free-release-stable.noarch.rpm
Then I loaded the stuff that was already readily available:
yum install lame libogg libtheora libvorbis lame-devel libtheora-devel
Afterwards, I only built the following from scratch: libvpx vo-aacenc-0.1.2 x264 yasm-1.2.0 ffmpeg
Then this command encoded with no problems (the audio was already in AAC, so I didn't recode it):
ffmpeg -i input.mov -c:v libx264 -preset slow -crf 22 -c:a copy output.mp4
The result looks just as good as the original to me, and is about 1/4 of the size!