PDA

View Full Version : HOWTO: Install and use the latest FFmpeg and x264



Pages : 1 2 3 4 5 6 7 8 [9] 10

rulet
December 7th, 2011, 02:19 PM
what about the quality at full screen size, the same, better,worse ?

Well, looking at the video, the quality seems like the same.

qyot27, I don't care which operating system to use, I use both -- linux and windows. So there is no problem for me to use avisynth on windows. Have you used avisynth? I've read a little about avisynth but never used it before. If I understand right, to use avisynth for recoding in another file format or compression in the same file format I just need a script for avisynth and a player which plays that videofile?

qyot27
December 7th, 2011, 02:46 PM
I've been using AviSynth since 2004.

First, you'd install AviSynth, and put any external plugins you wish to use in its 'plugins' folder (AviSynth has internal functions for many types of filtering operations as well). You write a script, it treats the script as it would treat any other type of video file. Any filtering done in the script appears in the output as though it was always there. The media player software isn't necessary, but it helps for the task of previewing the changes in the script (VirtualDub works for that purpose too).

For instance, you might have the following script (let's say, test.avs):

AVISource("test.avi") #for example's sake, let's say test.avi's resolution is 1920x1080
BilinearResize(848,480)
FlipVertical()
The first line loads test.avi, the second line resizes it to 848x480, the third line flips the video upside-down. As far as any program you give that script to is concerned, the video has always been 848x480 and upside down.

rulet
December 7th, 2011, 02:59 PM
I see, thanks. Looks like many options possible to use in script, anyway I need to read documentation and examples.
Does avisynth support any file format(mp4, mkv, flv e.t.) and codecs? By the way, do I need to install codec-packs to use it for any file format?

popper
December 7th, 2011, 03:06 PM
I've been using AviSynth since 2004.

...
For instance, you might have the following script (let's say, test.avs):

AVISource("test.avi") #for example's sake, let's say test.avi's resolution is 1920x1080
BilinearResize(848,480)
FlipVertical()
The first line loads test.avi, the second line resizes it to 848x480, the third line flips the video upside-down. As far as any program you give that script to is concerned, the video has always been 848x480 and upside down.

Eek :( , you gave him a re-scaling example ,just encouraging them to do it even more :( LOL

qyot27
December 7th, 2011, 03:42 PM
Does avisynth support any file format(mp4, mkv, flv e.t.) and codecs? By the way, do I need to install codec-packs to use it for any file format?
The file format support is determined by what source filter you use and how that source filter works. For instance, AVISource opens AVI files, but it does so using the Video for Windows framework. So if you can open and play the .avi file in a program that uses VfW to do its loading (for instance, VirtualDub) then AVISource will work fine. But if it can't be loaded with VfW, then AVISource can't load it either.

DirectShowSource works the same way - if the video doesn't work in Windows Media Player (or WMP6.4, or Media Player Classic, if MPC isn't using internal decoding), it won't work in DirectShowSource. A combination of ffdshow and Haali's Media Splitter can cover this for almost anything you'd run across. If you have to go with a codec pack, the only one I would ever recommend is the Combined Community Codec Pack. But like I said, DirectShowSource won't work on Linux by virtue of Wine not supporting DirectShow, so this only applies to Windows. DirectShowSource is technically an external plugin, but it comes with AviSynth by default.

MPEG2Source opens MPEG-2 (and MPEG-1) files. Or well, it actually opens .d2v files that you create with DGIndex - the .d2v is an index that DGIndex creates for MPEG-1 or -2 files. This would more than likely be what you'd use for stuff sourced from DVD, or some types of captures from cable or capture cards or camcorders. It's self-contained, so all you need to do is have DGDecode.dll in AviSynth's plugins folder.

FFmpegSource and FFmpegSource2 open the file using the FFmpeg libraries (libavcodec and libavformat, etc.). Like mplayer or VLC, they're self-contained, so you don't need anything else but ffmpegsource.dll and/or FFMS2.dll in AviSynth's plugins folder. These source filters can open anything that FFmpeg can, so this would be what you'd use for MKV, FLV, MOV, MP4, or so on.

AVISource is an internal function. MPEG2Source and the FFmpegSource functions are external plugins, and you need to download and unzip them and place them in AviSynth's plugins folder first.


Eek , you gave him a re-scaling example ,just encouraging them to do it even more LOL
It would have happened sooner or later. :P

rulet
December 7th, 2011, 04:00 PM
FFmpegSource and FFmpegSource2 open the file using the FFmpeg libraries (libavcodec and libavformat, etc.). Like mplayer or VLC, they're self-contained, so you don't need anything else but ffmpegsource.dll and/or FFMS2.dll in AviSynth's plugins folder. These source filters can open anything that FFmpeg can, so this would be what you'd use for MKV, FLV, MOV, MP4, or so on.


Ok, that is more clear now. Saying more specific, if I will use ffmpegsource.dll and/or FFMS2.dll for decoding or compession, I don't need to install any additional system codecs for MKV, FLV, MOV, MP4, WMV f.e.?

FakeOutdoorsman
December 7th, 2011, 07:49 PM
I just need recoding for compession for now, in other words, the most smallest file with the best quality. Maybe you have any ideas how to compress it better then in that command which I've wrote.

I can't give you an exact command because I know nothing of your input and "best quality" is subjective. A typical procedure to find a good balance between quality, file size, and encoding time for just about any input:


Use the highest crf value that still gives you an acceptable quality. A good starting number is 24.
Use the slowest preset you have patience for (see x264 --help for a list of presets).
Use these settings for the rest of your video set you are encoding.

Ignore the placebo preset. It's a waste of time and probably gives about a ~1% improvement over veryslow at a huge time cost. You don't have to encode the whole input when testing your crf/preset combinations. Just choose random sections with the -ss and -t options.


" -flags2 -bpyramid -wpredp 0" are there for the older [B]VLC browser plugin to be able to play
The option "-flags2 -bpyramid" is probably being ignored. See the FFmpeg output that includes the x264 settings being applied during encoding.


internal ffmpeg jaggy "yadif" de-interlace filter
What do you mean by "jaggy"? Is the jagginess visible on a single frame, or is it more of a temporal jerkiness?

qyot27
December 7th, 2011, 11:10 PM
Ok, that is more clear now. Saying more specific, if I will use ffmpegsource.dll and/or FFMS2.dll for decoding or compession, I don't need to install any additional system codecs for MKV, FLV, MOV, MP4, WMV f.e.?
Correct (except that AviSynth doesn't do compression - you'd still need to give the script to x264 or FFmpeg to do that). Both versions of FFmpegSource use an index to ensure frame accuracy, but have differences in other areas (ffmpegsource.dll, which is version 1.21, is a couple of years outdated, although it still decodes various items just fine; FFMS2 is in active development).

For FFMS2, the process would look something like this:

ffmsindex -t -1 filename.flv
This would create the index. The plugin itself will create an index if one isn't already present, but since it takes the time to do that the first time you load the script, it can give the impression of hanging. It's generally easier to take care of any indexing beforehand, so there's no extra time spent. And, ffmsindex gives you a nice progress meter.

The script would look like this (the FFmpegSource2 function is provided by the FFMS2.avsi file, which fuses the FFVideoSource and FFAudioSource functions that FFMS2 provides into a single function that's more familiar to old 1.x users):

FFmpegSource2("filename.flv",atrack=-1)
or, if you don't want audio,

FFVideoSource("filename.flv")

FFMS2 also has the advantage of being able to convert variable frame rate video to constant frame rate, using the fpsnum and fpsden parameters, like this:

FFmpegSource2("filename.flv",atrack=-1,fpsnum=30000,fpsden=1001)
which will ensure the framerate is at 29.97fps. This can be important in order to maintain audio sync for some formats that can be of questionable framerate (WMV, most notoriously, but MKV, MP4, etc. can show it at times too, depending on one's files).

rulet
December 8th, 2011, 01:26 AM
.

rulet
December 8th, 2011, 01:27 AM
Correct (except that AviSynth doesn't do compression - you'd still need to give the script to x264 or FFmpeg to do that).


So with avisynth it's not possible to do compression at all, or possible with some filters? If it's possible, can you give an example(for that mp4 file f.e.)?
By the way, that functions that can do avisynth, isn't that that can do kdenlive also? Or avisynth can do it faster?

qyot27
December 8th, 2011, 05:50 PM
AviSynth doesn't compress anything. Basically, the script is a list of changes intended for the file you are opening, and then any program you give the script to sees all of those changes having already been made. I've heard of 'output' plugins that will write to new video or audio files, but I've never messed with them myself. I really just don't see the point.

The functions AviSynth has access to may not be faster, but there's a whole lot more of them to choose from, and some of those choices are better quality/more accurate.

A script named input.avs:

FFVideoSource("filename.mp4")

The compression step (on Windows):

x264.exe --preset veryslow --crf 18 -o output-test.mkv input.avs

The compression step (on Linux):

wine avs2yuv input.avs - | x264 --stdin y4m --preset veryslow --crf 18 -o output-test.mkv -

Iloru
December 8th, 2011, 09:35 PM
Lots of great information and all in one place. I will definitely be bookmarking this. :)

FakeOutdoorsman
December 9th, 2011, 03:30 AM
Generate a life pattern based on a generalization of John Conway's life game:

ffplay -f lavfi life

rulet
December 9th, 2011, 05:04 PM
A script named input.avs:

FFVideoSorce("filename.mp4")

The compression step (on Windows):

x264.exe --preset veryslow --crf 18 -o output-test.mkv input.avs


Ok, I've installed avisynth, then dowloaded x264.exe 32bit 10bit-depth(what is general difference with 32bit 8bit-depth?) from here (http://x264.nl/), puted x264.exe in C:\Program Files\AviSynth 2.5\plugins, and also downloaded FFmpegSource 2.16 from here (http://code.google.com/p/ffmpegsource/downloads/detail?name=ffms-2.16.7z&can=2&q=), and puted files FFMS2.avsi ffms2.dll ffmsindex.exe in C:\Program Files\AviSynth 2.5\plugins. Then copied in C:\Program Files\AviSynth 2.5\plugins test videofile 1.mp4. I created input.avs file(and puted it in the same folder) with this content:


FFVideoSource("1.mp4")
I cutted mp4 file(just extracted small peace for recode testing)
Then I entered in C:\Program Files\AviSynth 2.5\plugins folder and run a command:


x264.exe --preset slow --crf 18 -o output-test.mp4 input.avs


That gave an output mp4 file smaller in about two times, but with no sound(guess I should extract the audio before and compress it separately because avisynth doesn't support it?). But the video is very bad(small colored squares), so I think I have to use another preset. Maybe I have to use FFmpegSource 2.16 AVS cplugin instead of FFmpegSource 2.16?

... wait a minute, mplayer under linux(without gui) is able to play normally that output file(but again with no audio) which played with squares on windows, but totem and vlc uder linux doesn't play it.
Here is mediainfo information about this output file:


General
Complete name : output-test.mp4
Format : MPEG-4
Format profile : JVT
Codec ID : avc1
File size : 26.2 MiB
Duration : 30mn 0s
Overall bit rate : 122 Kbps
Encoded date : UTC 2011-12-09 15:40:38
Tagged date : UTC 2011-12-09 15:40:38

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 10@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 30mn 0s
Bit rate : 121 Kbps
Maximum bit rate : 1 833 Kbps
Width : 800 pixels
Height : 598 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 15.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 10 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.017
Stream size : 26.0 MiB (99%)
Writing library : x264 core 120 r2120 0c7dab9
Encoding settings : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=15 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=81 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2011-12-09 15:40:38
Tagged date


I wonder what is the best way to do the compession with ffmpeg? Mediainfo of input 1.mp4 test file is:


General
Complete name : 1.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 42.5 MiB
Duration : 30mn 0s
Overall bit rate : 198 Kbps
Encoded date : UTC 2011-12-08 15:25:12
Tagged date : UTC 2011-12-08 15:25:12

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 30mn 0s
Bit rate : 143 Kbps
Width : 800 pixels
Height : 598 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 15.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.020
Stream size : 30.6 MiB (72%)
Language : English
Encoded date : UTC 2011-12-07 08:18:34
Tagged date : UTC 2011-12-08 15:25:14
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 30mn 0s
Bit rate mode : Constant
Bit rate : 53.6 Kbps
Nominal bit rate : 48.0 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 11.5 MiB (27%)
Language : English
Encoded date : UTC 2011-12-07 08:18:34
Tagged date : UTC 2011-12-08 15:25:14

perspectoff
December 9th, 2011, 05:21 PM
First of all, mencoder is better than ffmpeg.

Secondly, I did all the instructions in this thread only to find that everything I wanted to do (including a reasonably current version of x264) was already included in the repository packaging of FFMPEG from Lucid onwards.

I wasted a lot of time reading this thread; it is only for cutting edge changes and for the average user is no longer necessary at all.

FakeOutdoorsman
December 9th, 2011, 07:33 PM
First of all, mencoder is better than ffmpeg.
Please elaborate how MEncoder, which is barely maintained, is better than FFmpeg. In what ways is it better?


Secondly, I did all the instructions in this thread only to find that everything I wanted to do (including a reasonably current version of x264) was already included in the repository packaging of FFMPEG from Lucid onwards.
The Ubuntu maintainer for FFmpeg and x264 is doing a better job at keeping the repository packages relatively recent (although Ubuntu doesn't actually provide FFmpeg packages anymore). This was not always the case and was a major reason for the creation of this guide. Of course the repository packages are inflexible and can not provide the features and additions that a user may acquire from compiling. However, this guide can not predict what all users will want and it's the user's responsibility to first see if the packages from the repository will meet their needs.


I wasted a lot of time reading this thread;
I hope you didn't read the whole thread. It's long.


...it is only for cutting edge changes and for the average user is no longer necessary at all.
Of course I will disagree with this, and you may be underestimating the average Linux user.

qyot27
December 10th, 2011, 08:30 PM
Ok, I've installed avisynth, then dowloaded x264.exe 32bit 10bit-depth(what is general difference with 32bit 8bit-depth?) from here (http://x264.nl/), puted x264.exe in C:\Program Files\AviSynth 2.5\plugins, and also downloaded FFmpegSource 2.16 from here (http://code.google.com/p/ffmpegsource/downloads/detail?name=ffms-2.16.7z&can=2&q=), and puted files FFMS2.avsi ffms2.dll ffmsindex.exe in C:\Program Files\AviSynth 2.5\plugins. Then copied in C:\Program Files\AviSynth 2.5\plugins test videofile 1.mp4. I created input.avs file(and puted it in the same folder) with this content
x264.exe can be put in C:\WINDOWS (ffmsindex.exe could be put there as well, unless you want to go and modify the Path environment variable). Having x264 in C:\WINDOWS will allow you to use it from any place in the file system, and the video and script files need not be in the same folder as the program. Nor do the video file and script have to be in AviSynth's plugins folder. Just the plugins need to be in that folder.

The difference between 8-bit and 10-bit is the internal precision of the codec (more or less) and generally speaking, the higher the bit depth, the less of a problem with banding you'll have and you'll also feasibly get better compression for the same level of quality. 10-bit support is rather new (relatively speaking; encoding it with x264 has been possible since July of 2010, but solid decoding support came a few months later and some users are still using decoders from a couple years ago, which are too old to support it), and some of the problems on playback you describe below may simply be the result of not having properly updated decoding software on Windows.


That gave an output mp4 file smaller in about two times, but with no sound(guess I should extract the audio before and compress it separately because avisynth doesn't support it?). But the video is very bad(small colored squares), so I think I have to use another preset. Maybe I have to use FFmpegSource 2.16 AVS cplugin instead of FFmpegSource 2.16?
There's no super-huge difference between FFMS2's trunk and C plugin branches (that is, if one doesn't consider the compiler to be a huge difference). The biggest difference is the need to use LoadCPlugin() at the beginning of your script* to load the C plugin, as C plugins don't autoload. The C plugin also has a couple of observable quirks under special circumstances, but these aren't exactly common.

*inserting the LoadCPlugin call into FFMS2.avsi before the function starts works too.

The lack of audio is because you didn't tell FFMS2 to load audio (if you want audio with FFMS2, use FFmpegSource2 and the atrack= parameter). Also, unless you get audio-supporting builds of x264, then no, x264 doesn't support audio. If you see that the build supports L-SMASH (which is an alternative MP4 muxer), then it's almost certain to support audio.


... wait a minute, mplayer under linux(without gui) is able to play normally that output file(but again with no audio) which played with squares on windows, but totem and vlc uder linux doesn't play it.
Likely just an issue of the restricted-extras package not being installed? Or like I said before, you might need to make sure the versions of the software are new enough to support 10-bit H.264.

rulet
December 10th, 2011, 08:40 PM
Likely just an issue of the restricted-extras package not being installed? Or like I said before, you might need to make sure the versions of the software are new enough to support 10-bit H.264.

No, everything is installed, and new versions, this issue concerning just this output mp4 file.

qyot27
December 11th, 2011, 12:35 AM
Then, based on the mediainfo output, try to make sure the height and width are multiples of 16 (actually, I think H.264 can use multiples of 4 or 8, but 16 makes that completely safe). 800 is fine (if nonstandard), but 598 is not; it's not even a multiple of 4. I wouldn't be at all surprised if that's responsible for at least some issue.

800x600 would probably be fine.

rulet
December 11th, 2011, 09:48 AM
So, do I have to rescale it with avisynth adding some parameters in input.avs file?

qyot27
December 11th, 2011, 05:51 PM
The original source file, yes. Don't try to do that with the test file, because it's not good to recompress lossy sources over and over again.

There's several types of resizing filters. I used BilinearResize() in the previous examples because it's fast, but there are others that can give a sharper result. The documentation lists these others, but yes, you would use that filter to make sure the script is giving x264 a video stream that's 800x600, not 800x598.

katya_sehgal
December 11th, 2011, 07:59 PM
I followed every step here, but I get 'file not found' (in red font).
My MTS file is in an external hard drive. I gave the command


ffmpeg -i 00001.mts -sameq output.avi

rulet
December 12th, 2011, 01:22 PM
qyot27, I haven't tried scaling with avisynth yet, but I found that avidemux can do resizing of a picture(and it has a gui for it) and do it well. And also avidemux has abilitity to use avisynth scripts(haven't tried yet), I wonder if it works with the latest versions of avisynth scripts(in avidemus gui it says of "avisynth version 0.7a internal", suppouse it's old as I see on avisynth site v.2.5)? And as I understand using avisynth with avidemux needs wine or windows?

... I used ffmpeg command for compessing(as I understand, newest versions of ffmpeg don't use -vpre slow syntax):


ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 22 -threads 0 2.mp4

That gave smoller size video file in 15%.The output 2.mp4 file is playable in vlc and totem also, despite the fact that it has size 800X598, not 800X600. But it's interesting that when I rescaled an output file to 800X600 it gave thumbnail picture of a file in nautilus, while wnen in 800X598 -- it doesn't(but that issue with thumbnails happens also with videos with the picture size of which multiples of 16) .

when I run a command:


ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 2.mp4

that gaves a file smaller in about 40%, and I don't see quality loss(maybe that's because of a low frame rate in 15fps of an input vide), although for this videofile the quality is not so important.

I have a question -- does -vpre slow is an exacly equivalent to -preset slow -tune film?

katya_sehgal
December 12th, 2011, 01:50 PM
I have learned about Handbrake and EKD and will use them since I need to convert mts files urgently.
However, I am keen on learning ffmpeg. I have followed all instructions but get the 'file not found' error. My videos are on an external hard drive.

P.S: Do I start a new thread for this?

rulet
December 12th, 2011, 04:21 PM
katya_sehgal, have you entered(in terminal) into that folder which contains your mts file?

FakeOutdoorsman
December 12th, 2011, 08:38 PM
I have a question -- does -vpre slow is an exacly equivalent to -preset slow -tune film?

No. The previous method of using presets with libx264 was via text files that attempted to use the same options that are set as if using "x264 --preset". Not all x264 options were available to the text files, so the text file based presets were not quite complete (although the "important" options were there). Now the presets are accessed directly via libx264 and the text preset files were removed. So, no, even -vpre slow may be not an exact equivalent to -preset slow.

To simplify, consider a tune to be like a mini preset that applies or overwrites several preset options to better suit the output depending on your input (-tune animation for animation input for example).

rulet
December 12th, 2011, 10:13 PM
Generate a life pattern based on a generalization of John Conway's life game:

ffplay -f lavfi life

Yea, and question, what is that?

FakeOutdoorsman
December 12th, 2011, 10:19 PM
Yea, and question, what is that?

Just a "toy" filter based on Conway's Game of Life (http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life).

popper
December 13th, 2011, 02:31 AM
I have learned about Handbrake and EKD and will use them since I need to convert mts files urgently.
However, I am keen on learning ffmpeg. I have followed all instructions but get the 'file not found' error. My videos are on an external hard drive.

P.S: Do I start a new thread for this?

your not in the external drives directory and didn't use an explicit path to the file to tell ffmpeg where to find it, so cd to the files directory you want to encode first, then in the shell run something like (assuming you have a current ffmpeg/avconv and not an old one that cant take this new syntax, update if you don't ASAP)

ffmpeg -threads 0 -i "00001.mts" -f mp4 -vcodec libx264 -preset slow -vprofile high -crf 18 -acodec copy "outfile.MP4"

or if you want to de-interlace the file add -vf yadif filter like so

ffmpeg -threads 0 -i "00001.mts" -f mp4 -vcodec libx264 -preset slow -vprofile high -crf 18 -acodec copy -vf yadif "outfile.MP4"

stay away from using the antiquated avi container and use mp4 or mkv today is my advice unless you need it for a given device that cant take anything else, but then it probably cant take high profile AVC/H.264 ether then.

qyot27
December 13th, 2011, 04:04 AM
I wonder if it works with the latest versions of avisynth scripts(in avidemus gui it says of "avisynth version 0.7a internal", suppouse it's old as I see on avisynth site v.2.5)?
The '0.7a' is referring to the component that allows Avidemux to use AviSynth, not the version of AviSynth (if 0.7a was even a valid version of AviSynth, that version would be close to/over a decade old).


And as I understand using avisynth with avidemux needs wine or windows?
I would assume so.

rulet
December 13th, 2011, 01:22 PM
How to do batch encoding for all files in one directory?, f.e. by this command:


ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 2.mp4

I found one example here (http://ubuntuforums.org/showthread.php?t=867670&page=2) in post 15, bu I don't know exactly how it will look in my case,
or is there a better command line or script?

popper
December 13th, 2011, 06:45 PM
How to do batch encoding for all files in one directory?, f.e. by this command:



I found one example here (http://ubuntuforums.org/showthread.php?t=867670&page=2) in post 15, bu I don't know exactly how it will look in my case,
or is there a better command line or script?

for a windows bat you can use my http://ubuntuforums.org/showpost.php?p=11493036&postcount=1983
a few pages back.

change the avconv/ffmpeg -threads 4 -i "%%A" ....... "%dstPATH%%%~nA.MP4" part of the bat file to suit for your working line, and the ("%srcPATH%*.mkv") part to ("%srcPATH%*.avs") taking a .avs script or whatever your input as it says on that post

so for your line above it would be

ffmpeg -threads 4 -i "%%A" -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 "%dstPATH%%%~nA.MP4"

and the ("%srcPATH%*.mkv") would be changed to ("%srcPATH%*.mp4") to encode all the .mp4 files found in the dir when you double clicked the bat file also placed in there.

qyot27
December 13th, 2011, 08:23 PM
I do any batch encoding the 'dumb' way, by explicitly declaring each and every command discretely, even if it is the same command over and over again. Helps me keep it straight in my head (and it's not as tedious as it sounds - spreadsheets help, as do conditional formatting performed using gedit and/or userland-level utils). It also makes sure that the files are processed in exactly the order I want them to be, which sometimes is important.

rulet
December 13th, 2011, 10:04 PM
@echo on

set srcPATH=.\
set dstPATH=.\somewhere

FOR %%A in ("%srcPATH%*.mkv") DO (
avconv.exe -threads 4 -i "%%A" -f mp4 -vcodec libx264 -crf 18 -minrate 600k -maxrate 1500k -bufsize 1500k -refs 3 -preset slow -vprofile Baseline -level 3.0 -flags2 -bpyramid -wpredp 0 -strict experimental -acodec aac -ac 2 -ab 128k -vf hqdn3d,unsharp=5:5:0.5,scale=640:480 "%dstPATH%%%~nA.MP4"
)
pause

REM -vf yadif, gradfun, hqdn3d, unsharp=5:5:0.5, setdar=16:9, scale=640:480


Is that the bat-script which you talking about(I changed to "somewhere")?
Actually, I asked about command-line or bash-script on linux, but thanks anyway.
As I understand, there is no difference in result(quality) using ffmpeg algorithms on windows or linux?
And I don't understand, do I have to install ffmpeg system-wide to use that bat-file(on windows), and what is avconv.exe, is it a replacement of ffmpeg?

Is that would be right bash-script for linux for the command that I mentioned above?:


#!/bin/bash

for i in 'ls *.mp4'
do
ffmpeg -i -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 ${i%.mp4}.mp4
done

qyot27
December 14th, 2011, 01:36 AM
As I understand, there is no difference in result(quality) using ffmpeg algorithms on windows or linux?
Correct. The biggest difference would mainly be in whatever impact might be made by the threading system involved. Linux and Windows can use pthreads, but Windows can also use win32threads. And while I know there is sometimes a slight effect on encoding quality by the use of multithreaded encoding, I don't know how or if it differs between threading methods.


And I don't understand, do I have to install ffmpeg system-widely to use that bat-file(on windows)
ffmpeg needs to be on the PATH, which does essentially mean it's 'installed system-wide'. It could be in C:\Program Files\ffmpeg, but as long as that folder has been added to the PATH then the system will see it.


and what is avconv.exe, is it a replacement of ffmpeg?
It's not a replacement, it's written by the libav fork for their own obstinate reasons. You can safely ignore it if all you're interested in is using FFmpeg (especially if this (http://git.videolan.org/?p=ffmpeg.git;a=commit;h=c83ef636a665b2e17f1b6745a 98ec7a5719264df) commit means what I think it does).

rulet
December 14th, 2011, 02:38 AM
Talking about "system-wide" istallation on windows -- is the difference between "shared" and "static" builds which are here (http://ffmpeg.zeranoe.com/builds) that shared build is fo system-wide installation and static is not?

qyot27
December 14th, 2011, 03:26 AM
Talking about "system-wide" istallation on windows -- is the difference between "shared" and "static" builds which are here (http://ffmpeg.zeranoe.com/builds) that shared build is fo system-wide installation and static is not?
See the explanation here:
http://ubuntuforums.org/showpost.php?p=11452692&postcount=1934

Both static and shared can be system-wide. The difference is where the 'mass' is.

katya_sehgal
December 14th, 2011, 06:39 PM
katya_sehgal, have you entered(in terminal) into that folder which contains your mts file?


your not in the external drives directory and didn't use an explicit path to the file to tell ffmpeg where to find it, so cd to the files directory you want to encode first, then in the shell run something like (assuming you have a current ffmpeg/avconv and not an old one that cant take this new syntax, update if you don't ASAP)

ffmpeg -threads 0 -i "00001.mts" -f mp4 -vcodec libx264 -preset slow -vprofile high -crf 18 -acodec copy "outfile.MP4"

or if you want to de-interlace the file add -vf yadif filter like so

ffmpeg -threads 0 -i "00001.mts" -f mp4 -vcodec libx264 -preset slow -vprofile high -crf 18 -acodec copy -vf yadif "outfile.MP4"

stay away from using the antiquated avi container and use mp4 or mkv today is my advice unless you need it for a given device that cant take anything else, but then it probably cant take high profile AVC/H.264 ether then.


I have managed to enter the drive correctly and enter the command. I get this now.


http://tinypic.com/view.php?pic=30w2uq0&s=5


I am willing to learn. But currently, I need to convert files immediately. WinFF hangs and Arista is non-responsive. I could not get past EKD.
Is there any way I can use a GUI and edit?

@popper: tried your command too.

FakeOutdoorsman
December 14th, 2011, 07:31 PM
I have managed to enter the drive correctly and enter the command. I get this now.
http://tinypic.com/view.php?pic=30w2uq0&s=5

Your input has 6 audio channels. You chose AVI as your output container, and FFmpeg will automatically choose MP3 audio by default for AVI if you do not manually select your desired audio format. The MP3 encoder, libmp3lame, apparently does not support 6 channels, so it complains:

[libmp3lame] Invalid number of channels 6, must be <= 2.
I see you have some MTS files from a Panasonic video camera (an AG-HMC150 maybe?). What are you trying to do with these? If you explain what you are trying to do we can maybe give you a better example command suited for your task.

AVI is generally not a recommended output container format for most cases due to its age and lack of support for some modern video and audio formats. The sameq option is also not recommended and is probably the most misused option. Previously, the FFmpeg documentation implied that this option, "makes the output the same quality as the input", but this is not the case and is format specific. The documentation has been updated; although it's still not descriptive, but I can only blame myself for that one. An unfortunate side effect is that recommendations to use this option have been widely circulated on various forums, blogs, etc.

katya_sehgal
December 14th, 2011, 08:02 PM
Your input has 6 audio channels. You chose AVI as your output container, and FFmpeg will automatically choose MP3 audio by default for AVI if you do not manually select your desired audio format. The MP3 encoder, libmp3lame, apparently does not support 6 channels, so it complains:

[libmp3lame] Invalid number of channels 6, must be <= 2.
I see you have some MTS files from a Panasonic video camera (an AG-HMC150 maybe?). What are you trying to do with these? If you explain what you are trying to do we can maybe give you a better example command suited for your task.

AVI is generally not a recommended output container format for most cases due to its age and lack of support for some modern video and audio formats. The sameq option is also not recommended and is probably the most misused option. Previously, the FFmpeg documentation implied that this option, "makes the output the same quality as the input", but this is not the case and is format specific. The documentation has been updated; although it's still not descriptive, but I can only blame myself for that one. An unfortunate side effect is that recommendations to use this option have been widely circulated on various forums, blogs, etc.

Yes, I got the recommendation from a forum. Also, I installed WinFF from terminal and got a different software from the one I got from Software Centre!

Followed instructions from here:

http://www.omgubuntu.co.uk/2010/09/winff-provides-an-interface-to-command-line-ffmpeg-conversion/

Now when I convert I get this:


http://tinypic.com/view.php?pic=15o88lj&s=5


What I am doing.


I want to convert MTS to smaller formats with as little loss as possible. So that the video play smoothly in OpenShot. From OpenShot, I will cut the video.

I am okay with anything other than avi if OpenShot is okay with it. Read good things about MKV.

You are right about the camera, Panasonic: TM200

FakeOutdoorsman
December 14th, 2011, 08:16 PM
...I installed WinFF from terminal and got a different software from the one I got from Software Centre!
Are you using FFmpeg directly, or via WinFF? If you prefer to use WinFF, then you should probably use ffmpeg from the repository because, last I checked, the WinFF presets are not updated to work with recent FFmpeg.


Now when I convert I get this:
http://tinypic.com/view.php?pic=15o88lj&s=5
You are attempting to encode with the libxvid encoder, but this guide does not install that encoder because the "mpeg4" encoder in FFmpeg usually does the job. I don't know your command, so I can't give you an exact replacement.


I want to convert MTS to smaller formats with as little loss as possible. So that the video play smoothly in OpenShot. From OpenShot, I will cut the video.
I have no experience with OpenShot. Does it not like the MTS files? FFmpeg can perform simple cuts. If all you are doing is cutting you could use FFmpeg, otherwise an editor, such as OpenShot I guess, would be more appropriate. I'm not sure what formats OpenShot will accept. Maybe I'll try it myself.

katya_sehgal
December 14th, 2011, 08:21 PM
Are you using FFmpeg directly, or via WinFF? If you prefer to use WinFF, then you should probably use ffmpeg from the repository because, last I checked, the WinFF presets are not updated to work with recent FFmpeg.


You are attempting to encode with the libxvid encoder, but this guide does not install that encoder because the "mpeg4" encoder in FFmpeg usually does the job. I don't know your command, so I can't give you an exact replacement.


I have no experience with OpenShot. Does it not like the MTS files? FFmpeg can perform simple cuts. If all you are doing is cutting you could use FFmpeg, otherwise an editor, such as OpenShot I guess, would be more appropriate. I'm not sure what formats OpenShot will accept. Maybe I'll try it myself.

I am using FFMPEG via WinFF.

I installed FFMPEG by following the guide on page one of this forum.

I then installed WINFF through the terminal.

I would prefer using OpenShot to edit. It works with MTS, but MTS lags. It is not smooth during preview (same in Windows).

Do you suggest I delete ffmpeg (that I got from this forum guide) and use only WinFF?


Edit: I am using ffmpeg via WinFF, in the case I was not clear. The posts prior to the last 2, i was using only ffmpeg and not WinFF.

FakeOutdoorsman
December 14th, 2011, 08:42 PM
Do you suggest I delete ffmpeg (that I got from this forum guide) and use only WinFF?
Yes, but only if for some reason you must use WinFF and its presets.

OpenShot is laggy with the MTS files for me too, unsurprisingly, but you can re-encode the MTS files to a lossless intermediate file that will run much more smoothly in OpenShot:

ffmpeg -i input.mts -c:v ffvhuff -c:a copy output.mkv
I hope you have adequate disk space because this will create some huge files. If this is unacceptable then I can give another example that will use a lossy encoder but should, I'm guessing, still play somewhat smoothly in OpenShot.

You can make a custom WinFF preset based on my example and then you'll be able to use your compiled FFmpeg and WinFF. WinFF itself can use any FFmpeg version, but its default presets won't work with all versions of FFmpeg.

katya_sehgal
December 14th, 2011, 09:08 PM
Yes, but only if for some reason you must use WinFF and its presets.

OpenShot is laggy with the MTS files for me too, unsurprisingly, but you can re-encode the MTS files to a lossless intermediate file that will run much more smoothly in OpenShot:

ffmpeg -i input.mts -c:v ffvhuff -c:a copy output.mkv
I hope you have adequate disk space because this will create some huge files. If this is unacceptable then I can give another example that will use a lossy encoder but should, I'm guessing, still play somewhat smoothly in OpenShot.

You can make a custom WinFF preset based on my example and then you'll be able to use your compiled FFmpeg and WinFF. WinFF itself can use any FFmpeg version, but its default presets won't work with all versions of FFmpeg.

thank you, I think I may need the lossy encoder as well, and would need to understand it as well.
shall get back to you after using this command. trust you will be around later.

Edit: I understand that ffmpeg would give me flexibility over presets that WINFF won't. I would prefer FFMPEG. But the need to get going makes me opt for WinFF. I hope to get the commands for FFMPEG and understand them

FakeOutdoorsman
December 14th, 2011, 10:02 PM
thank you, I think I may need the lossy encoder as well, and would need to understand it as well.
Lossy command:

ffmpeg -i input.mts -c:v mpeg2video -qscale 2 -c:a copy output.mkv

-c:v mpeg2video: codec, video using encoder named mpeg2video
-qscale: quality level for video output. A value of 2 for MPEG-1/2/4, in my opinion, can usually be considered "roughly visually lossless".
-c:a copy: copy the audio from input to output. Does not encode, but it is more like a "copy and paste".

I just realized my MTS samples are all stereo (2 channels), so I'm unsure if my example commands will work with 6 channel or if OpenShot can handle 6 channel inputs.

katya_sehgal
December 15th, 2011, 09:21 AM
FakeOutdoorsman, hello.
I tried your codes. Got the following error:


http://tinypic.com/view.php?pic=2nw3ecn&s=5

And same result with the lossy code:

[*** @ 0x9731320] Only SUBTITLE_*** type supported.

FakeOutdoorsman
December 15th, 2011, 08:23 PM
I know nothing of subtitles, but you can add -sn to the command (before output.mkv) to disable subtitles. That should work, but I don't know if you want to keep the subtitle stream.

katya_sehgal
December 15th, 2011, 08:36 PM
I know nothing of subtitles, but you can add -sn to the command (before output.mkv) to disable subtitles. That should work, but I don't know if you want to keep the subtitle stream.

I added -sn. It is happening! [for newcomers= happiness]
I must ask, how do I do the entire folder?

katya_sehgal
December 15th, 2011, 08:41 PM
Importantly, you had mentioned that there are various websites with outdated information. Would you recommend any one website (I will search the forums of course)? Where I can read and try to interpret? For example, changing output folder once and for all.

As per your estimation, this website is outdated...


http://linuxers.org/tutorial/ffmpeg-basics-beginners
It has the command
ffmpeg -i input.avi -sameq output.mpg

Would this be the best and the simplest one?

http://ffmpeg.org/ffmpeg.html

FakeOutdoorsman
December 15th, 2011, 10:48 PM
I must ask, how do I do the entire folder?
You can use a "for loop" (example (http://ubuntuforums.org/showpost.php?p=10559378&postcount=5)) or I think you can create a custom preset in WinFF and then use that to select and encode all of the files.


Would you recommend any one website (I will search the forums of course)? Where I can read and try to interpret?
The problem with most sites that give examples is that they don't keep up with FFmpeg development, but that would be an incredible task as development is very active. This forum (and this thread in particular), the #ffmpeg IRC channel, and the ffmpeg-user (http://ffmpeg.org/contact.html) mailing list are all good resources.


For example, changing output folder once and for all.
You can output to any existing directory (assuming you have proper permissions and can write to the desired directory).


Would this be the best and the simplest one?
http://ffmpeg.org/ffmpeg.html
It's a good one, and in theory should be kept up to date, but it's not always very easy to understand and can seem overwhelming. Another is FFmpeg FAQ (http://ffmpeg.org/faq.html).

katya_sehgal
December 17th, 2011, 06:10 PM
You can use a "for loop" (example (http://ubuntuforums.org/showpost.php?p=10559378&postcount=5)) or I think you can create a custom preset in WinFF and then use that to select and encode all of the files.


The problem with most sites that give examples is that they don't keep up with FFmpeg development, but that would be an incredible task as development is very active. This forum (and this thread in particular), the #ffmpeg IRC channel, and the ffmpeg-user (http://ffmpeg.org/contact.html) mailing list are all good resources.


You can output to any existing directory (assuming you have proper permissions and can write to the desired directory).


It's a good one, and in theory should be kept up to date, but it's not always very easy to understand and can seem overwhelming. Another is FFmpeg FAQ (http://ffmpeg.org/faq.html).

Your posts are very valuable. I am currently practicing.
This is what I have come up with.

ffmpeg -i 00001.MTS -ab 320k -c:v mpeg2video -qscale 12 -r 25 -sn output5.mkv

and

ffmpeg -i 00001.MTS -c:v mpeg2video -qscale 15 -r 25 -sn output5.mkv

I am not getting how I can bring the audio bitrate down. It is 1439 k. I had tried -ab 320k and -b:a 320 k. I have a feeling that qscale overpowers this function? Before I convert the folder, I need to learn these various commands.
I hope you are around.

decryption
December 18th, 2011, 05:56 AM
First of all - thanks to the OP for an awesome post. I found it very useful.

I have a Dell Precision 490 workstation, running Ubuntu 11.10, with two dual core Xeon 5160 CPUs (so 2 physical CPUs, with 2 cores each), which I am using to encode TV recordings (MPEG2) to H264 using ffmpeg & x264. ffmpeg is encoding at approx 180fps and everything works well, but CPU usage is little low, hovering around 30% per core, when I would expect close to 100%. Anyone know why this is?

These are the inputs I'm giving ffmpeg


time ffmpeg -i ch31.m2t -s 640x360 -acodec libfaac -ac 1 -ar 44100 -b:a 56k -vcodec libx264 -preset superfast -b:v 744k ch31_superfast_800.mp4

Output of uname -a


Linux dell 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Output of grep -i core /proc/cpuinfo


core id : 0
cpu cores : 2
core id : 0
cpu cores : 2
core id : 1
cpu cores : 2
core id : 1
cpu cores : 2

Output of mpstat -P ALL


Linux 3.0.0-14-generic (dell) 18/12/11 _x86_64_ (4 CPU)

15:46:52 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
15:46:52 all 16.37 10.29 1.20 3.46 0.00 0.13 0.00 0.00 68.54
15:46:52 0 21.43 10.91 1.74 1.06 0.00 0.39 0.00 0.00 64.47
15:46:52 1 15.64 9.95 1.08 5.29 0.00 0.07 0.00 0.00 67.97
15:46:52 2 14.65 10.29 1.03 5.88 0.00 0.03 0.00 0.00 68.11
15:46:52 3 13.79 10.03 0.97 1.59 0.00 0.02 0.00 0.00 73.60


Output of top whilst ffmpeg is running


top - 15:35:59 up 1:11, 3 users, load average: 0.00, 0.15, 0.29
Tasks: 162 total, 2 running, 159 sleeping, 0 stopped, 1 zombie
Cpu0 : 29.9%us, 1.7%sy, 31.6%ni, 36.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 30.4%us, 1.3%sy, 25.8%ni, 42.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 38.7%us, 2.0%sy, 22.7%ni, 36.0%id, 0.7%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 27.2%us, 1.0%sy, 27.9%ni, 43.5%id, 0.3%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4056484k total, 3939144k used, 117340k free, 16532k buffers
Swap: 4190204k total, 9348k used, 4180856k free, 3024616k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3559 decrypti 20 0 321m 91m 4708 R 240 2.3 45:52.11 ffmpeg

katya_sehgal
December 18th, 2011, 09:30 PM
FakeOutdoorsman, hello. (please, anyone is welcome to provide inputs)
From whatever I have managed to grasp, I have formed this.


for f in *.MTS; do ffmpeg -i "$f" -ab 320k -b:v 10000k -c:v mpeg2video -r 25 -sn "${f%.MTS}.mkv"; done

It is working as I just checked. Do you think this is good?
Should I go for a higher bitrate if I want to put video on DVD?
And any other information I may have missed?

Thank you. I have made a log of my learning. It includes experiments with ffmpeg.

qyot27
December 19th, 2011, 03:21 AM
FakeOutdoorsman, hello. (please, anyone is welcome to provide inputs)
From whatever I have managed to grasp, I have formed this.



It is working as I just checked. Do you think this is good?
Should I go for a higher bitrate if I want to put video on DVD?
And any other information I may have missed?

Thank you. I have made a log of my learning. It includes experiments with ffmpeg.
The bitrates used in the command given above are already non-compliant; higher bitrates would still be non-compliant. Authoring programs that are worth using will reject streams like that, and even if they did allow it to go through, actual DVD players would likely choke on such streams.

To quote Wikipedia (emphasis mine):

DVD-Video discs have a raw bitrate of 11.08 Mbit/s, with a 1.0 Mbit/s overhead, leaving a payload bitrate of 10.08 Mbit/s. Of this, up to 3.36 Mbit/s can be used for subtitles and a maximum of 9.80 Mbit/s can be split amongst audio and video. In the case of multiple angles the data is stored interleaved, and so there's a bitrate penalty leading to a max bitrate of 8 Mbit/s per angle to compensate for additional seek time. This limit is not cumulative, so each additional angle can still have up to 8 Mbit/s of bitrate available.
That means that the listed values above that come to 10320kbps are 520kbps over the cumulative limit for video+audio. In most cases, you shouldn't need bitrates that high for DVD anyway (although I remember ffmpeg's ratecontrol for MPEG-2 being rather unpleasant, but still).

Even just going from my normal MPEG-2 encoder (HCenc, for Windows - I use it under Wine if I'm on Linux), 6000kbps is typically more than adequate for the video stream. I'd drop the audio bitrate too; my rule of thumb there is 192kbps for 2 channels, and either 384kbps or 448kbps for 5.1 (as all three of those values are what you typically see for AC-3 streams on professional DVDs).

And why are you outputting to MKV? If you're using MPEG-2, just use .mpg (which should get understood as being MPEG-2 PS, although it may not be NAV-enabled like most DVD authoring programs like them to be).

katya_sehgal
December 19th, 2011, 09:19 AM
The bitrates used in the command given above are already non-compliant; higher bitrates would still be non-compliant. Authoring programs that are worth using will reject streams like that, and even if they did allow it to go through, actual DVD players would likely choke on such streams.

To quote Wikipedia (emphasis mine):

That means that the listed values above that come to 10320kbps are 520kbps over the cumulative limit for video+audio. In most cases, you shouldn't need bitrates that high for DVD anyway (although I remember ffmpeg's ratecontrol for MPEG-2 being rather unpleasant, but still).

Even just going from my normal MPEG-2 encoder (HCenc, for Windows - I use it under Wine if I'm on Linux), 6000kbps is typically more than adequate for the video stream. I'd drop the audio bitrate too; my rule of thumb there is 192kbps for 2 channels, and either 384kbps or 448kbps for 5.1 (as all three of those values are what you typically see for AC-3 streams on professional DVDs).

And why are you outputting to MKV? If you're using MPEG-2, just use .mpg (which should get understood as being MPEG-2 PS, although it may not be NAV-enabled like most DVD authoring programs like them to be).

Thank you qyot27. I shall be editing on OpenShot with these clips and when they are edited, I shall convert them to the settings you have mentioned. Would that do fine?

As for avi, it is an outdated container as I have been told. What would be the best? In Windows, I was used to avi.

I am converting from MTS to another container so that OpenShot is smooth (as it is not with the heavy MTS files). Would my settings do for editing? Or do you suggest I edit in mpg?
Would it be advisable to edit with my current settings and later trans-code to 6000 k.

rulet
December 19th, 2011, 09:58 AM
What will be command-line or bash-script for batch encoding for all video files in one directory? f.e. for this command:


ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 2.mp4

qyot27
December 19th, 2011, 05:27 PM
Thank you qyot27. I shall be editing on OpenShot with these clips and when they are edited, I shall convert them to the settings you have mentioned. Would that do fine?

As for avi, it is an outdated container as I have been told. What would be the best? In Windows, I was used to avi.

I am converting from MTS to another container so that OpenShot is smooth (as it is not with the heavy MTS files). Would my settings do for editing? Or do you suggest I edit in mpg?
Would it be advisable to edit with my current settings and later trans-code to 6000 k.
For editing purposes, you should be using a lossless or high bitrate I-frame only lossy format. For those purposes, AVI is not outdated and will work just as well as other containers. The limitations of AVI only really start to show when you start working with B-frames, variable frame rate video, or variable bit rate audio - features of video formats like H.264 and audio formats like AAC and Vorbis (and MP3, although VBR was a late development there).

My suggestion, with that in mind, is to use HuffYUV or FFV1. Normally this would be in AVI, but OpenShot might support those formats in MOV or MKV as well (it depends on how it handles opening files).

Once the video is exported from the editing program, and you want to author a DVD, then you would convert to DVD compliant MPEG-2 video and either AC3 or MP2 audio. This would generally be put in the MPEG-2 PS container, optionally with NAV sectors since many DVD authoring programs (particularly open source ones) tend to prefer that. I don't know if ffmpeg writes NAV sectors when it outputs to .mpg, but if it doesn't, you could encode the video and audio separately and then mux them with mplex (from the mjpegtools package):

mplex -f8 -V input.m2v input.ac3 -o final-output.mpg
-f8 writes NAV sectors, -V allows the container to be variable bitrate-aware, which MPEG2 generally is, especially on DVD.

rulet
December 19th, 2011, 07:37 PM
What will be command-line or bash-script for batch encoding for all video files in one directory? f.e. for this command:
ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 2.mp4

I found the asnwer, the command is:


mkdir output ; for file in *.mp4 ; do ffmpeg -i $file -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 output/$file ; done

Now I have a question, how to recode all avi files in one directory into mp4 with compression?

FakeOutdoorsman
December 20th, 2011, 03:15 AM
FakeOutdoorsman, hello. (please, anyone is welcome to provide inputs)
From whatever I have managed to grasp, I have formed this.

for f in *.MTS; do ffmpeg -i "$f" -ab 320k -b:v 10000k -c:v mpeg2video -r 25 -sn "${f%.MTS}.mkv"; done
It is working as I just checked. Do you think this is good?
Not for your workflow. For each step you want to minimize data/quality loss. That is why qyot27 and I both recommended a lossless format to edit. Imagine opening a jpg file in GIMP, editing it, and then re-saving as jpg again. Conventional jpg files are lossy and each time you edit and save a file you will reduce the quality of the output. You may not always notice a difference, but it's good to avoid this entirely if you can. The lossless format should work better in OpenShot (less jerky than the MTS) and look the same as the MTS.

Secondly, there is no reason for you to be re-encoding the audio for your file that you will edit in OpenShot (unless OpenShot doesn't like it for some reason). My earlier examples showed how to copy the audio from the input to the output.


Now I have a question, how to recode all avi files in one directory into mp4 with compression?
Change:

for file in *.mp4
to:

for file in *.avi

katya_sehgal
December 22nd, 2011, 12:59 PM
Not for your workflow. For each step you want to minimize data/quality loss. That is why qyot27 and I both recommended a lossless format to edit. Imagine opening a jpg file in GIMP, editing it, and then re-saving as jpg again. Conventional jpg files are lossy and each time you edit and save a file you will reduce the quality of the output. You may not always notice a difference, but it's good to avoid this entirely if you can. The lossless format should work better in OpenShot (less jerky than the MTS) and look the same as the MTS.

Secondly, there is no reason for you to be re-encoding the audio for your file that you will edit in OpenShot (unless OpenShot doesn't like it for some reason). My earlier examples showed how to copy the audio from the input to the output.


Change:

for file in *.mp4
to:

for file in *.avi


You have been kind Fakeoutdoorsman and qyot27. I am learning much. Over the last 2 days, I have edited a small sequence in mkv.

I want to know if this is a ffmpeg error.


The video lags, especially during transitions in OpenSHot. I have a feeling that it could be because of configuration. But then, I am using a 3-4 GB RAM system with good space and Intel core 2 duo.
I am convincing a family person to consider Ubuntu on their desktop. I will check if the same error persists there.

I read in the forums about MLT (melt) and saw that I have it in my Ubuntu. Is there anything else I am missing in ffmpeg that can prevent lagging? And would the desktop fare better?


For each step you want to minimize data/quality loss. That is why qyot27 and I both recommended a lossless format to edit. Imagine opening a jpg file in GIMP, editing it, and then re-saving as jpg again. Conventional jpg files are lossy and each time you edit and save a file you will reduce the quality of the output. You may not always notice a difference, but it's good to avoid this entirely if you can. The lossless format should work better in OpenShot (less jerky than the MTS) and look the same as the MTS.


A fine example.
Is MKV (qscale 2) too heavy for laptop?


Once the video is exported from the editing program, and you want to author a DVD, then you would convert to DVD compliant MPEG-2 video and either AC3 or MP2 audio. This would generally be put in the MPEG-2 PS container, optionally with NAV sectors since many DVD authoring programs (particularly open source ones) tend to prefer that. I don't know if ffmpeg writes NAV sectors when it outputs to .mpg, but if it doesn't, you could encode the video and audio separately and then mux them with mplex (from the mjpegtools package):


I shall follow this once I am onto the DVD. I have made notes on this.


Even just going from my normal MPEG-2 encoder (HCenc, for Windows - I use it under Wine if I'm on Linux), 6000kbps is typically more than adequate for the video stream. I'd drop the audio bitrate too; my rule of thumb there is 192kbps for 2 channels, and either 384kbps or 448kbps for 5.1 (as all three of those values are what you typically see for AC-3 streams on professional DVDs).


So many people are asking about this elsewhere. This rule of thumb is useful and I will do this.

I am happy about OpenShot. And if it runs smoothly, it will help the digital medium.
If the lag problem is not of ffmpeg, then I will seek some change in hardware. Do let me know.
Cheers.

rulet
December 22nd, 2011, 11:30 PM
Change:

for file in *.mp4
to:

for file in *.avi

Yes, but I getting an error using this command for avi:


ffmpeg -i input.avi -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 output.mp4
ffmpeg version git-2011-12-04-f88d5df, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 4 2011 11:21:47 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
libavutil 51. 30. 0 / 51. 30. 0
libavcodec 53. 40. 0 / 53. 40. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 50. 0 / 2. 50. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[avi @ 0x90fcac0] parser not found for codec camtasia, packets or times may be invalid.
[avi @ 0x90fcac0] parser not found for codec pcm_s16le, packets or times may be invalid.
Input #0, avi, from 'input.avi':
Duration: 00:01:04.00, start: 0.000000, bitrate: 743 kb/s
Stream #0:0: Video: camtasia (tscc / 0x63637374), bgr24, 1028x739, 15 tbr, 15 tbn, 15 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, s16, 352 kb/s
Incompatible pixel format 'bgr24' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0x9104160] w:1028 h:739 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x9102800] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x911a7c0] w:1028 h:739 fmt:bgr24 -> w:1028 h:739 fmt:yuv420p flags:0x4
[libx264 @ 0x9102240] height not divisible by 2 (1028x739)
Output #0, mp4, to 'output.mp4':
Stream #0:0: Video: h264, yuv420p, 1028x739, q=-1--1, 90k tbn, 15 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, 352 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (camtasia -> libx264)
Stream #0:1 -> #0:1 (copy)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height


What do I have to change in the command?

andrew.46
December 25th, 2011, 10:18 AM
Looks like there is some unhappiness with your dimensions:


[scale @ 0x911a7c0] w:1028 h:739 fmt:bgr24 -> w:1028 h:739 fmt:yuv420p flags:0x4
[libx264 @ 0x9102240] height not divisible by 2 (1028x739)

Mind you when I took more attention to such things encoding with x264 demanded that width and height should be divisible by 16 but this is obviously no longer the case. I suspect that you will need to investigate either the scale or the pad filter...

rulet
December 25th, 2011, 02:20 PM
Looks like there is some unhappiness with your dimensions:


[scale @ 0x911a7c0] w:1028 h:739 fmt:bgr24 -> w:1028 h:739 fmt:yuv420p flags:0x4
[libx264 @ 0x9102240] height not divisible by 2 (1028x739)

Mind you when I took more attention to such things encoding with x264 demanded that width and height should be divisible by 16 but this is obviously no longer the case. I suspect that you will need to investigate either the scale or the pad filter...

Yea, thank's, seems you are right. I cropped the height of this test video to 738 by the command:


ffmpeg -i input.avi -vf crop=1028:738:0:0 output.avi

And then recoded it to mp4 with that command without errors.

...Is it possible to do cropping and recoding with one command? What it will look with this example?

FakeOutdoorsman
December 25th, 2011, 07:49 PM
...Is it possible to do cropping and recoding with one command?
Yes.

What it will look with this example?
Combining your commands it would look like:

ffmpeg -i input.avi -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -vf crop=1028:738:0:0 output.mp4
I removed -threads 0 since that is default now.

rulet
December 26th, 2011, 11:14 AM
It gives an error:


ffmpeg -i input.avi -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -vf crop=1028:738:0:0 output.mp4
ffmpeg version git-2011-12-04-f88d5df, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 4 2011 11:21:47 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
libavutil 51. 30. 0 / 51. 30. 0
libavcodec 53. 40. 0 / 53. 40. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 50. 0 / 2. 50. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[avi @ 0xa676ac0] parser not found for codec camtasia, packets or times may be invalid.
[avi @ 0xa676ac0] parser not found for codec pcm_s16le, packets or times may be invalid.
Input #0, avi, from 'input.avi':
Duration: 00:01:04.00, start: 0.000000, bitrate: 743 kb/s
Stream #0:0: Video: camtasia (tscc / 0x63637374), bgr24, 1028x739, 15 tbr, 15 tbn, 15 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, s16, 352 kb/s
Incompatible pixel format 'bgr24' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0xa67e160] w:1028 h:739 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
[crop @ 0xa694600] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'Parsed_crop_0'
[scale @ 0xa6949a0] w:1028 h:739 fmt:bgr24 -> w:1028 h:739 fmt:yuv420p flags:0x4
[crop @ 0xa694600] w:1028 h:739 -> w:1028 h:738
[libx264 @ 0xa67c240] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0xa67c240] profile Main, level 3.1
[libx264 @ 0xa67c240] 264 - core 119 r2106 07efeb4 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:-1:-1 analyse=0x1:0x111 me=umh subme=8 psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=29.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0xa67bd40] Tag [1][0][0][0]/0x00000001 incompatible with output codec id '65536'
Output #0, mp4, to 'output.mp4':
Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 1028x738, q=-1--1, 90k tbn, 15 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, 352 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (camtasia -> libx264)
Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?)


... But when I pointing output file as mkv or avi, it recodes. Maybe options, mentioned in this command, incompatible with mp4?

qyot27
December 27th, 2011, 01:06 AM
... But when I pointing output file as mkv or avi, it recodes. Maybe options, mentioned in this command, incompatible with mp4?

[mp4 @ 0xa67bd40] Tag [1][0][0][0]/0x00000001 incompatible with output codec id '65536'
-acodec copy is the problem. MP4 doesn't support PCM audio, or at least ffmpeg doesn't like trying to put it in MP4. Compress it with AAC, MP3, or AC3.

GhettoYhetti
December 29th, 2011, 09:28 PM
Attempting to use ffmpeg to get video taken by my vid-cam to burn to DVD using the following:

ffmpeg -i MAH00212.MP4 -target ntsc-dvd -s hd1080 -aspect 16:9 ./sandbox/2011-CM.mpg
ffmpeg version 0.7.2-4:0.7.2-1ubuntu1, Copyright (c) 2000-2011 the Libav developers
built on Oct 2 2011 15:13:26 with gcc 4.6.1
configuration: --extra-version='4:0.7.2-1ubuntu1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
avutil configuration: --extra-version='4:0.7.2.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avcodec configuration: --extra-version='4:0.7.2.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avformat configuration: --extra-version='4:0.7.2.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
swscale configuration: --extra-version='4:0.7.2.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
postproc configuration: --extra-version='4:0.7.2.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 5. 0 / 53. 5. 0
libavformat 53. 2. 0 / 53. 2. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MAH00212.MP4':
Metadata:
major_brand : MSNV
minor_version : 20054127
compatible_brands: MSNVmp42isom
creation_time : 2011-12-25 14:39:34
Duration: 00:04:03.26, start: 0.000000, bitrate: 8955 kb/s
Stream #0.0(und): Video: h264 (Main), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 8821 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
creation_time : 2011-12-25 14:39:34
Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 128 kb/s
Metadata:
creation_time : 2011-12-25 14:39:34
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'

This results in video and no sound.

I am assuming the possible "library mismatch" is causing my issue?

andrew.46
December 29th, 2011, 10:41 PM
When you use '-target ntsc-dvd' by default FFmpeg tries to use mpeg2video video and ac3 sound, looks like the problem might be more likely the conversion to ac3 sound. The 'library mismatch' and 'auto-selecting format 'flt'' warnings are both red herrings, you need to give the rest of the terminal output which unfortunately has been snipped :(.

salmjuh
December 30th, 2011, 11:50 AM
Hi

I have done everything by the book, but when recording videos from RTSP feed, I get "MOOV ATOM" errors:

ffmpeg -i rtsp://10.10.22.31:8555 -aspect 16:9 -copyts -vcodec libx264 -b_strategy 2 -flags2 +bpyramid -coder 1 -flags +loop -deblockalpha 0 -deblockbeta 0 -flags2 +wpred -me_method hex -subq 8 -keyint_min 20 -crf 17 -threads 0 -y /tmp/test.mp4

Some times file is OK and sometimes it's not but there is broken "moov atom":


root@Vod1:~# ffmpeg -i /tmp/test.mp4
ffmpeg version N-31684-g6071e4d, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 29 2011 09:01:07 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
libavutil 51. 33.100 / 51. 33.100
libavcodec 53. 49.100 / 53. 49.100
libavformat 53. 29.100 / 53. 29.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 55.100 / 2. 55.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 5.100 / 0. 5.100
libpostproc 51. 2.100 / 51. 2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1a3b7e0] moov atom not found
/tmp/test.mp4: Operation not permitted
root@Vod1:~#

root@Vod1:~# x264 -V
x264 0.120.2120 0c7dab9
(libswscale 2.1.100)
(libavformat 53.29.100)
built on Dec 29 2011, gcc: 4.6.1
configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later

Some times the recording is OK, sometimes it's broken.

Hope someone can help me with this.

Cheers,
Jii

FakeOutdoorsman
December 31st, 2011, 01:47 AM
Hi

I have done everything by the book, but when recording videos from RTSP feed, I get "MOOV ATOM" errors:


ffmpeg -i rtsp://10.10.22.31:8555 -aspect 16:9 -copyts -vcodec libx264 -b_strategy 2 -flags2 +bpyramid -coder 1 -flags +loop -deblockalpha 0 -deblockbeta 0 -flags2 +wpred -me_method hex -subq 8 -keyint_min 20 -crf 17 -threads 0 -y /tmp/test.mp4

Some times file is OK and sometimes it's not but there is broken "moov atom".

Is there a reason that you're not using an encoding preset instead of declaring a bunch of individual options? Example:

ffmpeg -i rtsp://10.10.22.31:8555 -aspect 16:9 -copyts -vcodec libx264 -preset fast -crf 18 output.mp4

phiri
January 4th, 2012, 01:46 PM
I seem to have issues with optional Step# 4 (Install libvpx (optional))
It would seem as though the repository is down; or could I be doing something wrong?


lphiri@mufasa:~/proj$ git clone http://git.chromium.org/webm/libvpx.git
Initialized empty Git repository in /home/lphiri/proj/libvpx/.git/

error: Failed connect to git.chromium.org:80; Operation now in progress while accessing http://git.chromium.org/webm/libvpx.git/info/refs

fatal: HTTP request failed


I tried the other protocols (https and git) and I am still getting errors.

ron999
January 4th, 2012, 02:51 PM
Hi
libvpx is working OK for me.:D
Delete the libvpx folder and try again.

ron@ubuntu:~$ git clone http://git.chromium.org/webm/libvpx.git
Cloning into libvpx...
remote: Counting objects: 13892, done.
remote: Compressing objects: 100% (3311/3311), done.
remote: Total 13892 (delta 10755), reused 13466 (delta 10392)
Receiving objects: 100% (13892/13892), 5.06 MiB | 422 KiB/s, done.
Resolving deltas: 100% (10755/10755), done.

phiri
January 4th, 2012, 07:30 PM
Hi
libvpx is working OK for me.:D
Delete the libvpx folder and try again.

ron@ubuntu:~$ git clone http://git.chromium.org/webm/libvpx.git
Cloning into libvpx...
remote: Counting objects: 13892, done.
remote: Compressing objects: 100% (3311/3311), done.
remote: Total 13892 (delta 10755), reused 13466 (delta 10392)
Receiving objects: 100% (13892/13892), 5.06 MiB | 422 KiB/s, done.
Resolving deltas: 100% (10755/10755), done.

Yep. Its working now; the repo must have been down at the time. Thank you.

liutszho
January 5th, 2012, 03:39 AM
Hi all!

Just tried playing with ffmpeg in making prores today.

Was really happy with the new feature, worked for both Windows and Linux (Ubuntu 11.10)

However, when I brought them back to my mac Final Cut Pro, I notice a slight color shift when compared to the original clip, seems like saturation was bumped up a bit. It is also apparent in the RGB Mixer scopes too.

I tried using "-pxl_fmt yuv422p" and "-dct8x8" but none of them fixed the issue.

Here is the command I entered: ffmpeg -i prores_test.mov -vcodec prores prores_test_output.mov

I even tried "-vcodec copy" but it did not work :(

And here is the info for both clips through ffmpeg:

ORIGINAL CLIP
-----------------

ffmpeg version git-2012-01-05-7f83db3, Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 4 2012 17:58:18 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 34.100 / 51. 34.100
libavcodec 53. 53.100 / 53. 53.100
libavformat 53. 29.100 / 53. 29.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 57.101 / 2. 57.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 5.100 / 0. 5.100
libpostproc 51. 2.100 / 51. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'prores_test.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2012-01-04 21:32:19
Duration: 00:00:03.00, start: 0.000000, bitrate: 168154 kb/s
Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x1080, 166554 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbc
Metadata:
creation_time : 2012-01-04 21:32:19
handler_name : ?Apple Alias Data Handler
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 1 channels, s16, 768 kb/s
Metadata:
creation_time : 2012-01-04 21:32:19
handler_name : ?Apple Alias Data Handler
Stream #0:2(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 1 channels, s16, 768 kb/s
Metadata:
creation_time : 2012-01-04 21:32:19
handler_name : ?Apple Alias Data Handler
Stream #0:3(eng): Data: none (tmcd / 0x64636D74)
Metadata:
creation_time : 2012-01-04 21:32:24
handler_name : ?Apple Alias Data Handler

OUTPUTTED CLIP
-----------

ffmpeg version git-2012-01-05-7f83db3, Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 4 2012 17:58:18 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 34.100 / 51. 34.100
libavcodec 53. 53.100 / 53. 53.100
libavformat 53. 29.100 / 53. 29.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 57.101 / 2. 57.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 5.100 / 0. 5.100
libpostproc 51. 2.100 / 51. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'prores_test_output.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 2012-01-04 21:32:19
encoder : Lavf53.29.100
Duration: 00:00:03.02, start: 0.000000, bitrate: 144974 kb/s
Stream #0:0(eng): Video: prores (apcn / 0x6E637061), yuv422p10le, 1920x1080, 146154 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 2997 tbc
Metadata:
creation_time : 2012-01-04 21:32:19
handler_name :
DataHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, s16, 83 kb/s
Metadata:
creation_time : 2012-01-04 21:32:19
handler_name :
DataHandler


Anyone else run into this?

qyot27
January 5th, 2012, 05:04 AM
However, when I brought them back to my mac Final Cut Pro, I notice a slight color shift when compared to the original clip, seems like saturation was bumped up a bit. It is also apparent in the RGB Mixer scopes too.
Sounds like a range issue. I'm not versed in that area well enough to actually figure out what action to take, but it may be a problem on ffmpeg's side (which may or may not have a parameter to adjust how it gets treated), or it could be due to Final Cut having some kind of errant setting regarding range or not liking the bitstream that ffmpeg outputs.

kesten
January 17th, 2012, 12:19 AM
Hi,
Sorry i didn't go through all 208 pages to see if this has been answered already ;)
But i find that generally, ffmpeg and ubuntu change so quickly, unless it's less than 3 months (?weeks) old, a post never works.

I did a sudo apt-get for ffmpeg today (jan 15 2012)

ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mkv

gives errors:

Stream #1.0: Video: rawvideo, bgra, 1024x768, 754974 kb/s, 30 tbr, 1000k tbn, 30 tbc
Unknown encoder 'libx264'

despite the fact that i have them installed...
/usr/lib/libx264.a
/usr/lib/libx264.so
/usr/lib/libx264.so.116


complete error message at
http://paste.ubuntu.com/806805/

thanks,

kesten

FakeOutdoorsman
January 17th, 2012, 01:00 AM
This thread is about using recent, compiled ffmpeg, not the repository version. You probably need to install one more package to enable libx264 in the repository ffmpeg. See Option B here:

HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoders in FFmpeg (http://ubuntuforums.org/showthread.php?t=1117283)

mc4man
January 26th, 2012, 02:33 AM
Just to note some continuing nonsense & an upcoming change as of 12.04

ffmpeg (the package) is becoming a transitional package that pulls in libavtools.
libavtools contains, among other things, the new 'preferred' commands -
/usr/bin/avconv
/usr/bin/avplay
/usr/bin/avprobe
/usr/bin/avserver

AND symlinks to them using FFmpeg's names

/usr/bin/ffmpeg
/usr/bin/ffplay
/usr/bin/ffprobe
/usr/bin/ffserver

So the 1st section will need to remove ffmpeg & libavtools to achieve what previously was done by removing ffmpeg.

When running ffmpeg from a terminal you not surprisingly get this inaccurate & somewhat misleading message -


This program is not developed anymore and is only provided for compatibility. Use avconv instead (see Changelog for the list of incompatible changes).


Of interest here - when attempting to build a ffmpeg supported current audacious-plugins, (which ffmpeg support is not available in Debian/Ubuntu packages), it appears audacious is basing min shared libavcodec53 version on FFmpeg's, ie. 53.40.0. Even the latest PP package, (libav) of 01/24/12 is only up to 53.34.0, so configure fails (can be fixed but not the point.
I would suspect that aud won't be the only that bases off of FFmpeg....

FakeOutdoorsman
January 26th, 2012, 02:47 AM
So the 1st section will need to remove ffmpeg & libavtools to achieve what previously was done by removing ffmpeg.
Thanks for the update. I haven't investigated 12.04 yet. I hope they iron out some of the Unity issues. Natty's performance was atrocious on some older, yet still useful computers that I recycled for relatives and friends.


When running ffmpeg from a terminal you not surprisingly get this inaccurate & somewhat misleading message -


This program is not developed anymore and is only provided for compatibility. Use avconv instead (see Changelog for the list of incompatible changes).
I'm not very fond of the wording. To general users it may imply that the "ffmpeg" project is dead.

mc4man
January 26th, 2012, 03:05 AM
I'm not very fond of the wording. To general users it may imply that the "ffmpeg" project is dead.

I think, just because, I'll file a bug on that shortly. Want to first find where it is in the source, (upstream or Debian/Ubuntu) & possibly offer a better/truer message of which haven't thought of one yet.
(odds of garnering a response are probably less than 50-50 anyway, the who cares is likely minuscule

FakeOutdoorsman
January 26th, 2012, 03:30 AM
It was upstream in ffmpeg.c, but ffmpeg was removed from libav [1 (http://git.libav.org/?p=libav.git;a=commit;h=0fec2cb15cc6ff1fcc724c774e c36abadcb7b6ad)] a few days ago (along with the message), and FFmpeg removed [2 (http://git.videolan.org/?p=ffmpeg.git;a=commit;h=def678956a19767e4ef714c8f 4d43dd96f4ce967)] avconv [3 (http://git.videolan.org/?p=ffmpeg.git;a=commit;h=935c659c030f7aaf9bd99c19f 2a51863ef83f002)] today. I doubt that Reinhard, the Ubuntu maintainer, will give a rodent's posterior, but don't let that stop you.

Edit: Supplying a patch should give the report some more weight. I've attached one here, but feel free to re-word.

thynan
January 26th, 2012, 11:42 AM
Hi!

First, i want to thank you for this great thread - it really has lots of useful information in it. But unfortunately, after hours and hours of trying, i still am not able to install the following: ffmpeg with ffmpeg-php.

I've seen this discussed before, but none of the solutions helped me. What i'm trying to do now is the following: install ffmpeg with --enable-shared, beacause that seems to be a prerequisite for ffmpeg-php to work.

But i always get an error when i run ./configure for ffmpeg with --enable-shared. The solution in from this forum was, to also run ./configure of x264 and libvpx with --enable-sahred and --enable-pic. But i still cant compile ffmpeg with --enable-shared.

Here is the error message: "LD libavcodec/libavcodec.so.53 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libtheoraenc.a(encode.o): relocation R_X86_64_32S against `oc_enc_frag_sad_c' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libtheoraenc.a: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [libavcodec/libavcodec.so.53] Error 1"

My System is Ubuntu Server 10.04 - and i'm following the exact steps from the guid ein this thread.

Has someone successfully installed ffmpeg with --enable-shared on 10.04? And if so - how?

I hope i havent overread a working solution on this board, but i've read and googled for hours and found nothing that worked for me. :(

undercash
January 26th, 2012, 12:22 PM
hi

i m not sure but you need to use the old ffmpeg api to make this works as shared with ffmpeg-php, the FFmpeg 0.7.11 "Peace" I think

and it works best with this last release of ffmpeg-php: http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/?view=tar

or this: https://groups.google.com/group/ffmpeg-php/browse_thread/thread/ae3d1f2e9ac1e3a9?hl=fr&pli=1

but if you use that ffmpeg-php link I sent you this problem disappear

FakeOutdoorsman
January 26th, 2012, 07:48 PM
But unfortunately, after hours and hours of trying, i still am not able to install the following: ffmpeg with ffmpeg-php.

ffmpeg-php is not a FFmpeg project and I have no experience with it, but I agree with undercash that ffmpeg-php will not work with recent FFmpeg. Most of the ffmpeg-php code is two years old.

An easier solution may be to use the php5-ffmpeg package in the repository.

thynan
January 30th, 2012, 02:27 PM
hi

i m not sure but you need to use the old ffmpeg api to make this works as shared with ffmpeg-php, the FFmpeg 0.7.11 "Peace" I think

and it works best with this last release of ffmpeg-php: http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/?view=tar

or this: https://groups.google.com/group/ffmpeg-php/browse_thread/thread/ae3d1f2e9ac1e3a9?hl=fr&pli=1

but if you use that ffmpeg-php link I sent you this problem disappear


Thank you very much undercash, that worked for me! I installed FFmpeg 0.7.11 with --enable-shared, and then used the ffmpeg-php release from your first link. I did some tests, and it seems to work fine.

@FakeOutdoorsman: thanks for the tip. I already tried php5-ffmpeg however, and it did not work for me. May well be that the problem was somewhere in my configuration, and not in php5-ffmpeg itself tough - i had a relatively messy ffmpeg installation at the time i tried that version.

So for anybody who reads this post with the same problem than i had: first try to install php5-ffmpeg, because it's real easy to install, and if that doesn't work, try the solution that undercash suggested.

Yokouchi
February 4th, 2012, 08:03 PM
Sorry if it's been posted before (can't find anything); new to Linux.

Running 10.04 LTS and upgraded ffmpeg/x264/etc to be able to better handle watermarking in ffmpeg. Converting MOV files (dvvideo) to h.264.

Since upgrading, my video output is totally grey. Some artefacts appear, but essentially it's a mid-grey.

Where to start troubleshooting? Have tried the manual and scripted approaches to upgrading ffmpeg, each with the same result.

FakeOutdoorsman
February 4th, 2012, 08:37 PM
Where to start troubleshooting?

We need more information. Please show your ffmpeg command and the complete, uncut console output. What player are you using to view the resulting output files? Does ffplay also show gray video?

Yokouchi
February 5th, 2012, 02:10 AM
Thanks for the quick reply.

Command is:

ffmpeg -i stub.mov -an -vcodec libx264 stub.mp4This is a cutdown version of what I was originally using (bash script, preset not valid in the new version):

ffmpeg -i "$file" -map 0:0 -an -vcodec libx264 -vpre hq -s hd720 -b 5000k -threads 0 "h.264Video_""$filestub"".mp4"The console output during conversion is:


ffmpeg version N-37554-g7f8027b Copyright (c) 2000-2012 the FFmpeg developers
built on Feb 4 2012 09:25:22 with gcc 4.4.3
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-libmp3lame
libavutil 51. 37.100 / 51. 37.100
libavcodec 54. 0.102 / 54. 0.102
libavformat 54. 0.100 / 54. 0.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'stub.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 2011-05-22 08:10:18
encoder : Lavf54.0.100
Duration: 00:01:00.05, start: 0.000000, bitrate: 46776 kb/s
Stream #0:0(eng): Video: dvvideo (dvhp / 0x70687664), yuv422p, 960x720 [SAR 4:3 DAR 16:9], 46033 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 59.94 tbc
Metadata:
creation_time : 2011-05-22 08:10:18
handler_name :
DataHandler
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 1 channels, s16, 768 kb/s
Metadata:
creation_time : 2011-05-22 08:10:18
handler_name :
DataHandler
File 'stub.mp4' already exists. Overwrite ? [y/N] y
w:960 h:720 pixfmt:yuv422p tb:1/1000000 sar:4/3 sws_param:
[libx264 @ 0xa6c8980] using SAR=4/3
[libx264 @ 0xa6c8980] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0xa6c8980] profile High 4:2:2, level 3.1, 4:2:2 8-bit
[libx264 @ 0xa6c8980] 264 - core 120 r2146 bcd41db - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'stub.mp4':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 2011-05-22 08:10:18
encoder : Lavf54.0.100
Stream #0:0(eng): Video: h264 (![0][0][0] / 0x0021), yuv422p, 960x720 [SAR 4:3 DAR 16:9], q=-1--1, 2997 tbn, 23.98 tbc
Metadata:
creation_time : 2011-05-22 08:10:18
handler_name :
DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (dvvideo -> libx264)
Press [q] to stop, [?] for help
frame= 1439 fps= 12 q=-1.0 Lsize= 13407kB time=00:00:59.93 bitrate=1832.5kbits/s
video:13400kB audio:0kB global headers:0kB muxing overhead 0.053581%
[libx264 @ 0xa6c8980] frame I:7 Avg QP:21.77 size: 40827
[libx264 @ 0xa6c8980] frame P:1408 Avg QP:24.26 size: 9457
[libx264 @ 0xa6c8980] frame B:24 Avg QP:25.04 size: 4984
[libx264 @ 0xa6c8980] consecutive B-frames: 96.7% 3.3% 0.0% 0.0%
[libx264 @ 0xa6c8980] mb I I16..4: 8.7% 88.1% 3.1%
[libx264 @ 0xa6c8980] mb P I16..4: 0.1% 0.7% 0.0% P16..4: 66.2% 8.4% 14.8% 0.0% 0.0% skip: 9.8%
[libx264 @ 0xa6c8980] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 47.3% 0.5% 0.0% direct: 6.0% skip:46.0% L0:49.2% L1:50.0% BI: 0.8%
[libx264 @ 0xa6c8980] 8x8 transform intra:87.7% inter:93.6%
[libx264 @ 0xa6c8980] coded y,uvDC,uvAC intra: 57.2% 97.2% 50.5% inter: 20.3% 83.7% 3.9%
[libx264 @ 0xa6c8980] i16 v,h,dc,p: 45% 26% 7% 22%
[libx264 @ 0xa6c8980] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 15% 52% 3% 4% 3% 5% 3% 5%
[libx264 @ 0xa6c8980] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 17% 28% 5% 6% 7% 6% 5% 4%
[libx264 @ 0xa6c8980] i8c dc,h,v,p: 59% 14% 21% 6%
[libx264 @ 0xa6c8980] Weighted P-Frames: Y:0.2% UV:0.0%
[libx264 @ 0xa6c8980] ref P L0: 51.0% 6.5% 26.7% 15.9% 0.0%
[libx264 @ 0xa6c8980] ref B L0: 59.8% 40.2%
[libx264 @ 0xa6c8980] kb/s:1828.84
ffplay plays the output OK.
VLC, totem show it up grey.
Quicktime (OS X) black.
mplayer shows it up grey with a slew of errors:


================================================== ========================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
================================================== ========================
Audio: no sound
Starting playback...
[h264 @ 0x6d3cbc0]top block unavailable for requested intra mode at 1 0
[h264 @ 0x6d3cbc0]error while decoding MB 1 0, bytestream (8590)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]concealing 2242 DC, 2242 AC, 2242 MV errors
[h264 @ 0x6d3cbc0]Reference 6 >= 3
[h264 @ 0x6d3cbc0]error while decoding MB 7 0, bytestream (5720)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
VDec: vo config request - 960 x 720 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 960x720 => 1280x720 Planar YV12
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 3 0, bytestream (9085)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]concealing 2696 DC, 2696 AC, 2696 MV errors
[h264 @ 0x6d3cbc0]Reference 7 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 32 0, bytestream (8538)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 17 0, bytestream (7921)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 5 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 6 0, bytestream (8144)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]top block unavailable for requested intra mode at 44 0
[h264 @ 0x6d3cbc0]error while decoding MB 44 0, bytestream (5371)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 4 0, bytestream (7648)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 5 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 32 0, bytestream (5450)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 39 0, bytestream (7800)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 27 0, bytestream (7561)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 3 0, bytestream (7715)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 5 0, bytestream (5907)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 4 >= 4
[h264 @ 0x6d3cbc0]error while decoding MB 29 0, bytestream (7606)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]top block unavailable for requested intra4x4 mode -1 at 2 0
[h264 @ 0x6d3cbc0]error while decoding MB 2 0, bytestream (6086)
[h264 @ 0x6d3cbc0]concealing 2700 DC, 2700 AC, 2700 MV errors
[h264 @ 0x6d3cbc0]Reference 7 >= 4
This goes on throughout playback of the complete file.

It's replicable on both my 10.04 machines.

Interestingly when I transcode one of MP4 files I'd made prior to upgrading ffmpeg (e.g. making versions with lesser bitrates) they play fine.

FakeOutdoorsman
February 5th, 2012, 02:48 AM
Thanks for the quick reply.
Command is:

ffmpeg -i stub.mov -an -vcodec libx264 stub.mp4
This command will use default settings. The default settings used to be fairly atrocious in terms of quality, but now it will provide good quality output.



This is a cutdown version of what I was originally using (bash script, preset not valid in the new version):

ffmpeg -i "$file" -map 0:0 -an -vcodec libx264 -vpre hq -s hd720 -b 5000k -threads 0 "h.264Video_""$filestub"".mp4"

Some comments about this command:

-vpre hq has been replaced with -preset slow
-threads 0 is now automatically applied
-crf is recommended instead of -b for single-pass encoding. Use -crf if you care about quality. The encoder will keep a constant quality with crf. Use -b if you are attempting to target a particular output file size. Generally you use the highest crf value that still has an acceptable quality. A good starting value is 24.


I suspect your players (other than ffplay) have a problem decoding 4:2:2 color sampling, which is what your input and output use:

Stream #0:0(eng): Video: dvvideo (dvhp / 0x70687664), yuv422p, 960x720 [SAR 4:3 DAR 16:9], 46033 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 59.94 tbc
Try adding -pix_fmt yuv420p to your command and see if that provides an output that works with your players.

Yokouchi
February 5th, 2012, 04:20 AM
My idiot gear kicks in.

-b 5000 and
-b 5000k are two different things (duh).

With nothing specified as to how to work, it'd seem it was defaulting to something very, very low quality as you suggested. All is well now.

5000k seems a bit excessive against the performance in -crf though seems to be what Vimeo wants for HD content (where this is headed)...

...thanks again for your help. Feel a bit silly... though to be fair I still don't understand why things rendered fine in ffplay and not anywhere else. With -crf things played fine everywhere. The -pix_fmt argument didn't improve things.

No doubt specifying valid bitrates help, but I still feel I'm missing something with respect to some streams being able to play in ffplay, but not elsewhere.

qyot27
February 5th, 2012, 03:12 PM
I suspect your players (other than ffplay) have a problem decoding 4:2:2 color sampling, which is what your input and output use:

Stream #0:0(eng): Video: dvvideo (dvhp / 0x70687664), yuv422p, 960x720 [SAR 4:3 DAR 16:9], 46033 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 59.94 tbc
Try adding -pix_fmt yuv420p to your command and see if that provides an output that works with your players.
Lack of 4:2:2 support is precisely the issue, since I've seen it do the same thing under Windows using various solutions, and if I recall correctly, 4:2:2 decoding ended up getting added much later than the 4:4:4 decoding support (and I think RGB was just added recently).

One possibility would be to recompile the media players against a new version of libavcodec (or find yourself a PPA with bleeding edge builds). The repository versions of these players are probably too old to support the additional H.264 colorspaces.

popper
February 5th, 2012, 03:18 PM
My idiot gear kicks in.

-b 5000 and
-b 5000k are two different things (duh).

With nothing specified as to how to work, it'd seem it was defaulting to something very, very low quality as you suggested. All is well now.

5000k seems a bit excessive against the performance in -crf though seems to be what Vimeo wants for HD content (where this is headed)...

...thanks again for your help. Feel a bit silly... though to be fair I still don't understand why things rendered fine in ffplay and not anywhere else. With -crf things played fine everywhere. The -pix_fmt argument didn't improve things.

No doubt specifying valid bitrates help, but I still feel I'm missing something with respect to some streams being able to play in ffplay, but not elsewhere.

no reason to feel silly , we all need to start somewhere....
i forget now as its been a while but i think explicitly setting -profile main works fine with Vimeo, but i also thought adding -profile high to ffmpeg works for Vimeo HD content too.

for encoding for any on-line streaming or over wireless content for that matter. where the total bandwidth is restricted you are probably better to set the max restriction's yourself like so if you want quality as well as a far smaller file size.

-vcodec libx264 -crf 18 -minrate 800k -maxrate 1200k -bufsize 1200k -refs 3 .....
for a far better and consistent quality, 1100k seems to be the average min/max in general end user streaming web use today, although i like to use -vcodec libx264 -crf 18 -minrate 1300k -maxrate 1300k -bufsize 1300k (or slightly higher up to 1600k or even as high as 2000k for one off web streams, as most people have ISP's that can do consistent 2Mbit/s or greater throughput download streaming today) plus 128k for 2 channel audio (-strict experimental -acodec aac -ac 2 -ab 128k) for the larger 720p stuff etc.

you're ffmpeg is compiled for 10bit colour space and your using greater than 8bit input content so only ffplay can decode it properly given that's also got the 10bit patches (and the other nice filters etc included).

i forget if you can make the other linux players also play 10bit encoded content without a re-compile of each, but i also thought setting -pix_fmt yuv420p produced the older standard 8bit output in the 10bit compiles anyway, perhaps not.... so simplest answer is re-compile ffmpeg for 8bit for now as Vimeo cant use 10bit AFAIK

"With nothing specified as to how to work, it'd seem it was defaulting to something very, very low quality" yeah, they should change that to a good generic x264 -profile high output as it used to drive me mad when first starting out doing a simple ffmpeg -i "input.hd.mkv" "output.mp4/.mpeg" and getting a crap super low bit rate divx/xvid or mpeg2 encode ;)

qyot27
February 5th, 2012, 11:59 PM
you're ffmpeg is compiled for 10bit colour space and your using greater than 8bit input content so only ffplay can decode it properly given that's also got the 10bit patches (and the other nice filters etc included).

i forget if you can make the other linux players also play 10bit encoded content without a re-compile of each, but i also thought setting -pix_fmt yuv420p produced the older standard 8bit output in the 10bit compiles anyway, perhaps not.... so simplest answer is re-compile ffmpeg for 8bit for now as Vimeo cant use 10bit AFAIK
If it was 10-bit the colorspace would read yuv422p10le, not yuv422p. Also, this guide/thread doesn't even cover compiling x264 in 10-bit mode, so they'd have to have gotten that information somewhere else (although it's not like it's difficult to figure out if one just looks at ./configure --help).

And the decoders are bit-agnostic. A plain compile of FFmpeg can play both 8 and 10 bit, provided it's a build from after 10-bit was committed (although as my previous note, the extra colorspaces+10-bit might not be fully there yet). It's not particularly bleeding edge, but if the repositories are keeping with point releases it might get hairy. If it's a Git build they're practically assured to support 10-bit (and the extra colorspaces, as those are the real issue here) correctly.

Yokouchi
February 6th, 2012, 11:40 PM
First off, many thanks to all. Getting through this. Steep learning curve but scripts sure beat sitting in front of a PC and doing things again... and again... and again with little control over anything. 4:4:2 helped. Don't see that ffmpeg was compiled here w/10-bit support, though it was prescient to check (./configure showed 8-bit, ffmpeg pulled from git. hmm.)

Took the suggestion to play with -crf mode rather than constant bitrate, ended up going this route. Seems logical as what Vimeo can store and what people will reasonably stream are two different things at the extreme end. The dropoff in quality didn't degrade the experience at all. After a bit more research I'm using presets a little more intelligently now.

Again, thanks all.

qyot27
February 7th, 2012, 01:27 AM
Let's see if I can explain this more clearly.


First off, many thanks to all. Getting through this. Steep learning curve but scripts sure beat sitting in front of a PC and doing things again... and again... and again with little control over anything. 4:4:2 helped. Don't see that ffmpeg was compiled here w/10-bit support, though it was prescient to check (./configure showed 8-bit, ffmpeg pulled from git. hmm.)
If you're using a Git build of FFmpeg from after this commit on May 10th 2011 (http://git.videolan.org/?p=ffmpeg.git;a=commit;h=59eb12faff9505da49f54d499 dd43404226e37f6), and especially after July 2011, it supports decoding both 8-bit and 10-bit H.264. No configure option to switch them, because such an option is irrelevant. It's not FFmpeg that needs to be specifically built as 10-bit (heck, some of the formats FFmpeg supports are 16-bit, or 1-bit, and they're all available in the same build anyway).

It's x264, and only x264, that has to be built specifically as 10-bit, and that's only to be able to encode 10-bit H.264 files. Not play them back or convert them to some other bit depth (because x264 doesn't do any decoding; if a build of x264 is doing any decoding, it's because the decoding is supplied by the FFmpeg libraries directly or by FFmpegSource2). x264 does not default to building in 10-bit mode because the vast majority of consumer hardware is only designed to support the original 8-bit implementation. 10-bit is primarily useful right now when the user actually has the file and wants to play it back locally on their PC. It hasn't made its way into electronics nearly as much as the regular 8-bit version of H.264, if it has at all.


Likewise, the normal encoding colorspace of x264 is 4:2:0 (aka YV12). The extra colorspaces of 4:4:4 and RGB were added on July 9th 2011 (http://git.videolan.org/?p=x264.git;a=commit;h=c07df2f77dacfec444785bf6022 9f804dc43c10b) (4:4:4) and July 10th 2011 (http://git.videolan.org/?p=x264.git;a=commit;h=ffc41542d73811dffbe5814a23e dda65db0e6aea) (RGB). 4:2:2 encoding was added on September 21st 2011 (http://git.videolan.org/?p=x264.git;a=commit;h=bb9216dc319a39eb6f2a5508a98 e36d6492ffa7e). x264 defaults to 4:2:0 when encoding, because most consumer devices do not support the other modes yet (or never will). However, unlike the bit depth situation, x264 has support for all of these colorspaces within a single build and can encode any of them if the --output-csp option is used when encoding (although builds can now be focused on one colorspace by using the --chroma-format option during the ./configure step; it still defaults to enabling all of them, though).




Short version, assuming you are using a fresh Git clone of both x264 and FFmpeg:
x264 supports encoding all colorspaces unless the --chroma-format option was used to restrict it to just one of them when it was compiled.

x264 builds as 8-bit. If you want 10-bit, you have to use the --bit-depth option when compiling. 10-bit x264 builds cannot output 8-bit files, and vice-versa. If you give 10-bit x264 a file encoded as 8-bit, it converts it to 10-bit before encoding.

FFmpeg decodes both 8-bit and 10-bit H.264 files, and it supports decoding all colorspaces. No specific enabling or disabling of colorspaces or bit depths occurs when compiling FFmpeg, and it does not even have options to permit such.

dudefire
February 9th, 2012, 12:56 PM
can anybody help me with the command to encode a video to webm/vp8 format ?

andrew.46
February 10th, 2012, 12:25 AM
can anybody help me with the command to encode a video to webm/vp8 format ?

Perhaps this might be a starter:

http://ubuntuforums.org/showpost.php?p=11308924&postcount=17

bricedebrignaisplage
February 23rd, 2012, 04:47 AM
I am having a problem with linking:



$ ffmpeg
ffmpeg: relocation error: ffmpeg: symbol avformat_network_init, version LIBAVFORMAT_53 not defined in file libavformat.so.53 with link time reference


I already had avformat installed from Ubuntu package repository. Apparently there is a mix up in the link up:



$ ldd ffmpeg | grep av
libavdevice.so.53 => /usr/lib/i686/cmov/libavdevice.so.53 (0xb7738000)
libavfilter.so.2 => /usr/local/lib/libavfilter.so.2 (0xb76af000)
libavformat.so.53 => /usr/lib/i686/cmov/libavformat.so.53 (0xb75a9000)
libavcodec.so.53 => /usr/lib/i686/cmov/libavcodec.so.53 (0xb6a3c000)
libavutil.so.51 => /usr/lib/i686/cmov/libavutil.so.51 (0xb69aa000)


I am under Oneiric. I did not follow this guide exactly, I installed x264 and ffmpeg from tarballs instead. And since my goal is to build OpenCV 2.3.1 (because it's the one supported by ROS Electric) with GPU support (CUDA), I used the --enable-shared and --enable-pic options.

I searched this thread (and google in general) for a while but could not find any definite solution.

I am a bit confused by the build process and package management in general: I have the libav* packages installed from synaptic, as they are dependencies of some other general multimedia packages (kdenlive, clementine, etc...), and I am installing a different version from source. I am a bit puzzled on how to ensure that things don't get messed up. Same with OpenCV: I am installing from source, and I have opencv2.3 installed as a dependency of ROS, so how do I make sure that the system is going to use my built from source lib...?

mc4man
February 24th, 2012, 12:02 AM
Possibly a question with no good answer or doesn't need an answer... -
Do users here that use ffmpeg directly consider FFmpeg superior to Libav or is it just a matter of personal preference & both are pretty much equal?

mysoogal
February 24th, 2012, 12:19 AM
already build debs for ubuntu 10.10 win32 - built on burst EU VPS servers

ffmpeg_201202240142-git-1_i386.deb
x264_0.120.2164+gitda19765-1_i386.deb
libvpx_201202240126-git-1_i386.deb
qt-faststart_201202240145-git-1_i386.deb


http://www.mediafire.com/?ycshcfhcrfbaiz2

http://www.crocko.com/9E70522461A841D3A4BE3178DFD62E54/debs.zip

andrew.46
February 24th, 2012, 01:27 AM
Do users here that use ffmpeg directly consider FFmpeg superior to Libav or is it just a matter of personal preference & both are pretty much equal?

I have to admit to laziness in that I started with FFmpeg and have never actually tried Libav :). Allied with this laziness is a certain disquiet over the fork process and thus an ideological unwillingless to jump ship but perhaps more to the point is the knowledge that Libav changes are for the most part incorporated into the FFmpeg code base.

Interesting to hear what others think :).

mc4man
February 24th, 2012, 04:36 AM
I have to admit to laziness in that I started with FFmpeg and have never actually tried Libav :). Allied with this laziness is a certain disquiet over the fork process and thus an ideological unwillingless to jump ship but perhaps more to the point is the knowledge that Libav changes are for the most part incorporated into the FFmpeg code base.

Interesting to hear what others think :).
Anyway I decided to file a bug on what is shown in 12.04 when someone runs 'ffmpeg ...'
https://bugs.launchpad.net/ubuntu/+source/libav/+bug/939863

FakeOutdoorsman
February 24th, 2012, 06:56 AM
I attached a patch to the bug that re-words the completely misleading statement. It will be interesting to see what the maintainer says if he decides not to change it even when presented with an easy, simple patch.

I can't say much about libav. I have little experience with it and have similar feelings about the whole thing as Andrew. FFmpeg does regularly merge commits from it, so there shouldn't be too many differences for a general user as Andrew mentioned. The FFmpeg developers are friendly and helpful to me so there's that too.

mc4man
February 24th, 2012, 07:35 AM
I attached a patch to the bug that re-words the completely misleading statement. It will be interesting to see what the maintainer says if he decides not to change it even when presented with an easy, simple patch.
.
Interesting indeed, I believe the maintainer was in the orig. break away group.

This came back into my thinking about because of a unreasonably extended break in audacious's ffmpeg decoding. In terms of 11.10 & 12.04 with the aud 3.14/3.2 source, the only reason the plugin wasn't being built was due to aud basing it's libavcodec ect. version numbers on FFmoeg's, which always higher for the same major
In the case of 12.04 the req. was libavcodec >= 53.40.0 & libav provides libavcodec53.34.0 which does support the ffaudio plugin fine.

(- It's almost fixed in 12.04's aud, the source was patched, built, & due to a small omission still was missing the plugin.
The patch used seemed to unnecessarily complicated for the Aud source being used & was consequently 'discussed' for quite some time.

andrew.46
February 24th, 2012, 10:18 AM
It will be very interesting to see the progress of the fork and the effects on FFmpeg itself. A great wikipedia article here discusses some of the possibilities:

Forking free and open source software (http://en.wikipedia.org/wiki/Fork_%28software_development%29#Forking_free_and_o pen_source_software)

The 'four possible outcome of a fork' certainly puts the potential end-game very neatly...

qyot27
February 24th, 2012, 10:56 AM
Do users here that use ffmpeg directly consider FFmpeg superior to Libav or is it just a matter of personal preference & both are pretty much equal?
During the upheaval period, I used the ffmpeg.org 'main' repo, which differed from the Videolan repo in ways that Libav still differs. Since the site properly went back to FFmpeg and the fork went off on their own, I've switched to using the master (Videolan) repo. The only exception is that when I build mplayer2, I go into the clone of Libav it uses and then specifically pull in the changes from FFmpeg master, although sometimes I have actually just deleted the directory and done a regular clone of FFmpeg to use (especially in a couple of cases where the pull didn't cleanly merge and I didn't want to mess with resolving it).

Personally, my distaste for the fork is due to the blow-up, as well as the behavior exhibited by the group* and their supporters (including some of those involved with a few software projects that use the libraries, including x264) in the time since. I see it from a slightly different angle because it also seems to be a certain, dare I say 'clique', of users that also have a presence in the fansubbing scene, and this - pardon the expression - pissing match that the fork revels in is just one part of a trend I've witnessed growing in that scene over the last 3 or 4 years. It's extremely annoying there too (to where I now attempt to actively avoid groups that participate in such behavior), and while the software side doesn't seem as inflammatory as those using it, I haven't seen any attempt to defuse the situation.

*Look at the Download page on libav.org and the Download page on ffmpeg.org - the fork provides no links to the original project, while FFmpeg acknowledges Libav's existence and provides links to their repo. That's simply one example of many where the fork just makes itself look completely childish and petty.

As far as the code itself goes, FFmpeg merges in work done in the fork anyway (which, if the release posts are to be believed, FFmpeg includes all changes from the fork, although I know from following the git repo that either not all commits to the fork need to be merged because they're duplicates, or occasionally they get reverted), along with what seems to be increased activity on FFmpeg's part beyond what gets merged in from Libav, or also now from additional forks I've seen spring up in the merge messages. I can't say much for anything special that exists only in Libav, since I couldn't figure out a good method to find only the unique commits and just gave up. I should probably try to do so again, even if just for curiosity's sake.

skyjuice88
February 25th, 2012, 12:03 PM
I am a new user here. May I know if I wanna test x264 codec, how do I put in a short video sequence in the the code. I tried steps 1-3 but have no idea how to put in the video. Anyone here kind enough to give me some guidance?

piotao
February 26th, 2012, 01:24 PM
Man, dear... author of the first post in this thread.

I, hereby, admit, that your work is greatly appreciated, to unbelivelable extent. Your work and information given in this post saves me.

I worked hard on screencasting using a number of diffrent apps, like recordmydesktop, istanbul, winff, wink, kazam and vlc. Only recordmydesktop gave me some results, but again, youtube stopped processing them. So I was stuck. I struggled for half a month, with no luck, being constantly more stressed and pissed off.

After reading your post, I compiled and installed all ffmpeg related software and they were working. Then I started to record my screen and this was working too. Finally I converted them into mkv format and they worked brilliantly! Also, youtube uploaded them with no problems, so now I'm so happy and relaxed because of you! YOU!

So I would like to say big THANK YOU and with this let me express my love to the open source community and all *unix related world!

You give me outstanding help and thank's to you I've do awesome job. LOVE YOU! :)

I wish all of you the best!

Here's the story:
:-k ](*,) :???: :-( 8) =D> \\:D/

lucasterra
February 27th, 2012, 09:06 PM
Ubuntu 11.10 - 3.2.0-17-generic

Hello,

First of all. Thanks for the guide, it was really helpful for installing the FFmpeg with all the libs included.

I've been trying to stream my webcam using stream-m (http://code.google.com/p/stream-m/)

No success so far. I have the server running... but I can't stream my webcam to the server.

I'm using this:

ffmpeg -f video4linux2 -s 320x240 -r 16 -i /dev/video0 -f oss -i /dev/dsp -g 52 -acodec libvorbis -ab 64k -vcodec libvpx -vb 448k -f webm http://localhost:8080/publish/first?password=secret


I get this:

ffmpeg version git-2012-02-27-a4c22e3 Copyright (c) 2000-2012 the FFmpeg developers
built on Feb 27 2012 13:32:57 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
libavutil 51. 41.100 / 51. 41.100
libavcodec 54. 4.100 / 54. 4.100
libavformat 54. 1.100 / 54. 1.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 62.101 / 2. 62.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 7.100 / 0. 7.100
libpostproc 52. 0.100 / 52. 0.100
[video4linux2,v4l2 @ 0xa141c40] The driver changed the time per frame from 1/16 to 1/15
[video4linux2,v4l2 @ 0xa141c40] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 12783.292514, bitrate: 18432 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 18432 kb/s, 15 tbr, 1000k tbn, 15 tbc
[oss @ 0xa1427e0] /dev/dsp: No such file or directory
/dev/dsp: Input/output error




It's probably some compatibility issue with OSS and Ubuntu, but I couldn't figure out how to solve that problem. I would be happy if someone can help me.

TheHippy
February 28th, 2012, 02:10 PM
hi, great tutorial and its been very helpful (many times).

However, when i use -acodec libfaac i seem to end up with a broken sound bite about half a second long at the start of the video and then silence for the rest.

I was wondering if anyone else had the same issue and/or how to fix it?

Many thanks

katya_sehgal
February 28th, 2012, 04:37 PM
Why does ffmpeg automatically make a clip 'progressive' from 'interlaced'. Kindly aid me in keeping it interlaced. Here is an example command I am using


for f in *.MTS; do ffmpeg -i "$f" -ab 320k -b:v 10000k -c:v mpeg2video -r 25 -sn "${f%.MTS}.mkv"; done

To this I had added -ilme. But it clashes with -sn and gives an error. I believe there must be a way to rectify this.
I saw this thread but didn't get it.


http://forum.videohelp.com/threads/303398-WinFF-ffmpeg-Unwanted-Deinterlacing

My original clip is in m2ts format and is interlaced.
Solution/s?

qyot27
February 28th, 2012, 06:07 PM
Why does ffmpeg automatically make a clip 'progressive' from 'interlaced'. Kindly aid me in keeping it interlaced. Here is an example command I am using
FFmpeg encodes progressive as default because that's what most people work with, or should be working with these days. Pragmatism. It just does so regardless of what the input is detected to be, which is a little problematic, but understandable if there's no mechanism to accurately detect that something is interlaced in the first place without user intervention.


To this I had added -ilme. But it clashes with -sn and gives an error. I believe there must be a way to rectify this.
I saw this thread but didn't get it.
-ilme is a motion estimation-related flag option, and I can't fathom for what reason it would conflict with disabling subtitles. It doesn't inherently control whether the output is interlaced, that's what the -top option (as mentioned by said thread, as well as the output of ffmpeg -h) apparently does. -top 1 for TFF, -top 0 for BFF, -top -1 for autodetection. Also from that thread:

The -top command only works when you also set the following interlace flags;

-flags ildct+ilme -top 1 (or -top 0)

katya_sehgal
February 28th, 2012, 06:40 PM
see next post below. duplicated, better.

katya_sehgal
February 28th, 2012, 06:42 PM
FFmpeg encodes progressive as default because that's what most people work with, or should be working with these days. Pragmatism. It just does so regardless of what the input is detected to be, which is a little problematic, but understandable if there's no mechanism to accurately detect that something is interlaced in the first place without user intervention.


-ilme is a motion estimation-related flag option, and I can't fathom for what reason it would conflict with disabling subtitles. It doesn't inherently control whether the output is interlaced, that's what the -top option (as mentioned by said thread, as well as the output of ffmpeg -h) apparently does. -top 1 for TFF, -top 0 for BFF, -top -1 for autodetection. Also from that thread:

You have pointed correctly about progressive scan, as I have read on this page


http://www.digitalphotographywriter.com/2010/08/hd-1080p-vs-1080i-videos-progressive.html

A technology person has been pestering me for interlaced, which is why the doubt.

I would like to learn a bit about top field and bottom field, in terms of coding; what to use for what. In the case I decide to go for interlaced, should I just add -flags ildct+ilme -top 1 (or -top 0) to the existing code?

qyot27
February 28th, 2012, 08:45 PM
A technology person has been pestering me for interlaced, which is why the doubt.

I would like to learn a bit about top field and bottom field, in terms of coding; what to use for what. In the case I decide to go for interlaced, should I just add -flags ildct+ilme -top 1 (or -top 0) to the existing code?
That seems correct, but I don't use FFmpeg for MPEG-2 encoding, so that's just what I glean from looking at the help documentation.

HitomiKun
February 29th, 2012, 04:41 AM
I was able to build a x264 with ffms2 support from your instructions the last month. I tried to configure the newest ffms2 for x264 just now and BAM, ffms2 error:


configure: error: in `/home/hitomilinus/ffms2':
configure: error: cannot build ffms2 as a shared library


That's the tutorial I followed (thx btw. for your awesome help):
http://ubuntuforums.org/showpost.php?p=11025444&postcount=1781

I have all libraries up to date, and I compiled/installed the minimal ffmpeg right before I got into the ffms2 problem. The problem just got up recently, since the newest ffms2 revision.

FlipeGarcia
February 29th, 2012, 10:36 AM
Thanks for this great tutorial, that keeps helping newbies like me to get some important programs to work in Ubuntu.

I would like to ask a question: is there a way to set in ffmpeg the default audio codec to libaacplus so that HE-AAC is used as default when encoding audio. I guess it might be a compilation option, but I have not found it. I use VLC transcoding with ffmpeg as audio encoder and there is way to pass to ffmpeg a parameter with the audio codec to be used.

Thanks in advance for the help!

qyot27
February 29th, 2012, 11:42 PM
I was able to build a x264 with ffms2 support from your instructions the last month. I tried to configure the newest ffms2 for x264 just now and BAM, ffms2 error:



That's the tutorial I followed (thx btw. for your awesome help):
http://ubuntuforums.org/showpost.php?p=11025444&postcount=1781

I have all libraries up to date, and I compiled/installed the minimal ffmpeg right before I got into the ffms2 problem. The problem just got up recently, since the newest ffms2 revision.
Add '--enable-static --disable-shared' to FFMS2's configure step. Like so:

./configure --prefix=$HOME/ffms2_build PKG_CONFIG_PATH=$HOME/ffms2_build/lib/pkgconfig --enable-static --disable-shared

FakeOutdoorsman
March 1st, 2012, 01:01 AM
hi, great tutorial and its been very helpful (many times).

However, when i use -acodec libfaac i seem to end up with a broken sound bite about half a second long at the start of the video and then silence for the rest.

I was wondering if anyone else had the same issue and/or how to fix it?

Many thanks

Please show your ffmpeg command and the complete console output.

mpbb77
March 1st, 2012, 08:25 PM
hi, it seems I'm the only one really having troule to get aac encoding ...

I've tried 3 methods:
- method A. I get: ./ffmpeg -formats | grep aac
ffmpeg version git-2012-02-29-a77c8ad Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 1 2012 19:52:28 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
libavutil 51. 41.100 / 51. 41.100
libavcodec 54. 4.100 / 54. 4.100
libavformat 54. 1.100 / 54. 1.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 62.101 / 2. 62.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 7.100 / 0. 7.100
libpostproc 52. 0.100 / 52. 0.100
D aac raw ADTS AAC
- method C: ffmpeg -formats | grep aac
ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
built on Jan 4 2012 16:21:50 with gcc 4.6.1
configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
avutil configuration: --extra-version='4:0.7.3ubuntu0.11.10.1+medibuntu1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
avcodec configuration: --extra-version='4:0.7.3ubuntu0.11.10.1+medibuntu1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay

avformat configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
avdevice configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay

avfilter configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay

swscale configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay

postproc configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay

libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 6. 0 / 53. 6. 0
libavformat 53. 3. 0 / 53. 3. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0
D aac raw ADTS AAC
- method using vlc-git. This one apparently uses the mplayer codecs which are fine since I'm on 32 bits. But the result is the same.

all of them compile fine but I can't get encoding AAC. I'm really clueless, how can I check that ffmpeg can see the codec libraries (I can only think for now that there is some mismatch though I've removed ffmpeg and started from scratch).
I'm on Oneiric and Mediuntu repo is enabled. Apt-cache says libfaac0 is installed (version 1.28-0ubuntu1). Tx in advance for any hint

FakeOutdoorsman
March 1st, 2012, 09:09 PM
FFmpeg can support four AAC encoders: the native AAC encoder (I'll call it ffaacenc), libfaac, libvo_aacenc, and libaacplus, but this guide only supports ffaacenc and libfaac. Installing the others isn't too hard; maybe I'll add separate instructions for the others later this week.

You should see ffmpeg -codecs instead of ffmpeg -formats to see a list of supported encoders and decoders:

$ ffmpeg -codecs | grep aac
...
DEA D aac Advanced Audio Coding
D A D aac_latm AAC LATM (Advanced Audio Codec LATM syntax)
EA libfaac libfaac AAC (Advanced Audio Codec)

libav-ffmpeg from the repository with libraries from Medibuntu (instructions here (http://ubuntuforums.org/showthread.php?t=1117283)) should also include ffaacenc and libfaac.

To encode with libfaac. This example will output VBR:

ffmpeg -i input -c:a libfaac -q:a 100 -vn output.mp4
This example will output ABR (or maybe CBR):

ffmpeg -i input -c:a libfaac -b:a 128k -vn output.mp4

To encode with ffaacenc:

ffmpeg -i input -strict experimental -c:a aac -b:a 128k -vn output.mp4
You can also probably use -q:a with ffaacenc, but I'm not sure of the supported values or if it even works.

You can also pipe from ffmpeg to any encoder that accepts piped input:

ffmpeg -i input -f wav - | faac -o output.mp4 -
This is effective if you don't feel like compiling FFmpeg if your version doesn't support your desired encoder.

mpbb77
March 1st, 2012, 09:21 PM
Tx FakeOutdoorsman

I probably had aac encoding all the time:

ffmpeg -codecs | grep aac
ffmpeg version git-2012-02-29-a77c8ad Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 1 2012 19:52:28 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
libavutil 51. 41.100 / 51. 41.100
libavcodec 54. 4.100 / 54. 4.100
libavformat 54. 1.100 / 54. 1.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 62.101 / 2. 62.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 7.100 / 0. 7.100
libpostproc 52. 0.100 / 52. 0.100
DEA D aac Advanced Audio Coding
D A D aac_latm AAC LATM (Advanced Audio Codec LATM syntax)
EA libfaac libfaac AAC (Advanced Audio Codec)

I was following blindly other posts by polling formats.

Tx also for the very quick feedback

tanoloco
March 2nd, 2012, 02:38 PM
main purpose:

how to solve
ffmpeg: relocation error: /usr/local/lib/libswresample.so.0: symbol av_opt_set_int, version LIBAVUTIL_51 not defined in file libavutil.so.51 with link time reference

alternatively how to solve:
segmentation fault


Hello,

I recently installed the last ffmpeg and x264 following this howto with the only difference that I used the following configuration


./configure --enable-gpl --enable-libgsm --enable-libxvid \
--enable-libmp3lame --enable-libvorbis --enable-libfaac \
--enable-shared --enable-libopencore-amrnb --enable-libvpx \
--enable-libopencore-amrwb --enable-libtheora --enable-libx264 \
--enable-nonfree --enable-version3 --enable-x11grab

I'm trying to convert a h264 video file using this code

ffmpeg -i "input.mp4" -ar 44100 -ac 2 -ab 192k -acodec libmp3lame -s 1280x544 -vcodec libxvid -r 23.98 -b 2500k "output.avi"

I get this error

ffmpeg: relocation error: /usr/local/lib/libswresample.so.0: symbol av_opt_set_int, version LIBAVUTIL_51 not defined in file libavutil.so.51 with link time reference

However the above error is prompted for any ffmpeg command such

$ ffmpeg -v

For reference I have:


$ ldd /usr/local/bin/ffmpeg | grep libavutil
libavutil.so.51 => /usr/lib/i686/cmov/libavutil.so.51 (0x00269000)

$ dpkg --get-selections | grep libavutil
libavutil-dev install
libavutil-extra-51 install
libavutil51 deinstall

$ uname -a
Linux my-pc 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:50:54 UTC 2012 i686 i686 i386 GNU/Linux


Looking at the release file note of ffmpeg I've installed the 0.9.1.git and I'm using lubuntu oneiric 32bit

My doubt is that I don't have any libswresample at all :(

$ ls -lrt /usr/local/bin | grep libswresample
$

$ ls -lrt /usr/bin | grep libswresample
$


and I don't have it listed in the repository either :(

$ dpkg -l | grep libswres
$


I also tried to download a deb package of libswresample from here (http://debian-multimedia.org/dists/unstable/main/binary-i386/package/libswresample0.php) but I cannot install it as it says me

Error: Dependency is not satisfiable: libavutil51 (>= 5:0.10)

I installed libavutil51 which was in conflict but it's a previous version:

$ dpkg -s libavutil51
Package: libavutil51
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 352
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Source: libav
Version: 4:0.7.3-0ubuntu0.11.10.1
Depends: libc6 (>= 2.4)
Description: Libav utility library
This is the common utility library from Libav. It contains shared code
used by all other Libav libraries.
Homepage: http://libav.org/
Original-Maintainer: Debian multimedia packages maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>


So I still cannot go ahead .. must I search, compile and install a newer version of libavutil51?

I'm afraid I'm going to have and endless list of troubles going this way ...

Any suggestions on how to solve this?

The reason why I'trying to install a newer version of ffmpeg and x264 is that running the code I firstly wrote, which is

ffmpeg -i "input.mp4" -ar 44100 -ac 2 -ab 192k -acodec libmp3lame -s 1280x544 -vcodec libxvid -r 23.98 -b 2500k "output.avi"
on a video file I downloaded from the net I got a
Segmentation fault error so I thought I need a newer version of ffmpeg/x264 from the one I have in my repository

Thanks in advance for any help

FakeOutdoorsman
March 2nd, 2012, 08:53 PM
I recently installed the last ffmpeg and x264 following this howto with the only difference that I used the following configuration


./configure --enable-gpl --enable-libgsm --enable-libxvid \
--enable-libmp3lame --enable-libvorbis --enable-libfaac \
--enable-shared --enable-libopencore-amrnb --enable-libvpx \
--enable-libopencore-amrwb --enable-libtheora --enable-libx264 \
--enable-nonfree --enable-version3 --enable-x11grab

How else did you deviate from the guide? Why did you add --enable-shared? Are you using Ubuntu 11.10?


on a video file I downloaded from the net I got a Segmentation fault error
Did you get the segmentation fault with "ffmpeg" from the repository? Can you provide a sample so I can attempt to duplicate the segmentation fault? Also provide the complete console output that includes the seg fault.

tanoloco
March 2nd, 2012, 11:32 PM
SOLVED: see point B!


Are you using Ubuntu 11.10?
Did you get the segmentation fault with "ffmpeg" from the repository? Can you provide a sample so I can attempt to duplicate the segmentation fault? Also provide the complete console output that includes the seg fault.

Hello and thank you so much for your quick reply!
So I divide my question into two points:

A) Segmentation fault:
Yes I'm using Ubuntu 11.10 ... actually lubuntu oneiric flavour :)

$ uname -a
Linux my-pc 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:50:54 UTC 2012 i686 i686 i386 GNU/Linux

To reproduce the segmentation fault:
1. I started removing everything I've installed following your (very nice) guide, to install them again from the repository

$ sudo apt-get remove ffmpeg x264 libx264-dev
$ sudo apt-get install ffmpeg x264 libx264-dev

Which gave me the following versions of:
ffmpeg

$ dpkg -s ffmpeg
Package: ffmpeg
Status: install ok installed
Priority: optional
Section: video
Installed-Size: 1340
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Source: libav
Version: 4:0.7.3-0ubuntu0.11.10.1
Replaces: libavcodec-extra-53 (<< 4:0.6~), libavcodec53 (<< 4:0.7.3-0ubuntu0.11.10.1)
Depends: libavcodec53 (>= 4:0.7.3-0ubuntu0.11.10.1) | libavcodec-extra-53 (>= 4:0.7.3), libavcodec53 (<< 4:0.7.3-99) | libavcodec-extra-53 (<< 4:0.7.3.99), libavdevice53 (>= 4:0.7.3-0ubuntu0.11.10.1) | libavdevice-extra-53 (>= 4:0.7.3), libavdevice53 (<< 4:0.7.3-99) | libavdevice-extra-53 (<< 4:0.7.3.99), libavfilter2 (>= 4:0.7.3-0ubuntu0.11.10.1) | libavfilter-extra-2 (>= 4:0.7.3), libavfilter2 (<< 4:0.7.3-99) | libavfilter-extra-2 (<< 4:0.7.3.99), libavformat53 (>= 4:0.7.3-0ubuntu0.11.10.1) | libavformat-extra-53 (>= 4:0.7.3), libavformat53 (<< 4:0.7.3-99) | libavformat-extra-53 (<< 4:0.7.3.99), libavutil51 (>= 4:0.7.3-0ubuntu0.11.10.1) | libavutil-extra-51 (>= 4:0.7.3), libavutil51 (<< 4:0.7.3-99) | libavutil-extra-51 (<< 4:0.7.3.99), libc6 (>= 2.7), libpostproc52 (>= 4:0.7.3-0ubuntu0.11.10.1) | libpostproc-extra-52 (>= 4:0.7.3), libpostproc52 (<< 4:0.7.3-99) | libpostproc-extra-52 (<< 4:0.7.3.99), libsdl1.2debian (>= 1.2.10-1), libswscale2 (>= 4:0.7.3-0ubuntu0.11.10.1) | libswscale-extra-2 (>= 4:0.7.3), libswscale2 (<< 4:0.7.3-99) | libswscale-extra-2 (<< 4:0.7.3.99)
Conflicts: ffprobe
Conffiles:
/etc/ffserver.conf d4d0a77d594735af0d92e12e2b74aa15
Description: Multimedia player, server, encoder and transcoder
This package contains the ffplay multimedia player, the ffserver streaming
server and the ffmpeg audio and video encoder. They support most existing
file formats (AVI, MPEG, OGG, Matroska, ASF...) and encoding formats (MPEG,
DivX, MPEG4, AC3, DV...).
Homepage: http://libav.org/
Original-Maintainer: Debian multimedia packages maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>


x264

$ dpkg -s x264
Package: x264
Status: install ok installed
Priority: optional
Section: graphics
Installed-Size: 656
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Version: 2:0.116.2042+git178455c-1ubuntu1
Replaces: x264-bin
Depends: libavutil51 (>= 4:0.7-1) | libavutil-extra-51 (>= 4:0.7-1), libc6 (>= 2.7), libffms2-2, libswscale2 (>= 4:0.7-1) | libswscale-extra-2 (>= 4:0.7-1), libx264-116
Conflicts: x264-bin
Description: video encoder for the H.264/MPEG-4 AVC standard
x264 is an advanced commandline encoder for creating H.264 (MPEG-4 AVC)
video streams.
.
x264 supports the following features:
* CABAC (context-based adaptive binary arithmetic coding) and CAVLC
(context-based adaptive variable length coding
* multiple reference frames
* 16x16, 8x8 and 4x4 intra-predicted macroblocks
* all P-frame inter-predicted macroblock types
* B-Inter-predicted macroblock types from 16x16 down to 8x8
* rate distortion optimization
* multiple rate control modes (constant quantizer, constant quality, single
or multipass ABR with the option of VBV)
* scene cut detection
* adaptive B-frame placement, with the option of keeping B-frames as
references / arbitrary frame order
* 8x8 and 4x4 adaptive spatial transform (high profile)
* lossless mode (high 4:4:4 profile)
* custom quantization matrices (high profile)
* parallel encoding on multiple CPUs
* interlaced streams
Original-Maintainer: Debian Multimedia Maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>
Homepage: http://www.videolan.org/developers/x264.html


libx264-dev

$ dpkg -s libx264-dev
Package: libx264-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 1324
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Source: x264
Version: 2:0.116.2042+git178455c-1ubuntu1
Depends: libx264-116 (= 2:0.116.2042+git178455c-1ubuntu1)
Description: development files for libx264
libx264 is an advanced encoding library for creating H.264 (MPEG-4 AVC)
video streams.
.
This package contains the static library and headers used to build programs
that use libx264.
Original-Maintainer: Debian Multimedia Maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>
Homepage: http://www.videolan.org/developers/x264.html


2. You can download a sample of the video I'm trying to convert here (https://rapidshare.com/files/159558855/sample.mp4) it's a file of about 9 Mb.

3. I'm trying to convert it using the following command

$ ffmpeg -i "sample.mp4" -ar 44100 -ac 2 -ab 192k -acodec libmp3lame -s 1280x544 -vcodec libxvid -r 23.98 -b 2500k "output.avi"


I get the following error

ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
built on Jan 4 2012 16:21:50 with gcc 4.6.1
configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
avutil configuration: --extra-version='4:0.7.3ubuntu0.11.10.1+medibuntu1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
avcodec configuration: --extra-version='4:0.7.3ubuntu0.11.10.1+medibuntu1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
avformat configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
avdevice configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
avfilter configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
swscale configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
postproc configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 6. 0 / 53. 6. 0
libavformat 53. 3. 0 / 53. 3. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2011-04-20 03:55:11
encoder : HandBrake 0.9.5 2011010300
Duration: 00:00:30.03, start: 0.000000, bitrate: 2530 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1280x544, 2141 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Metadata:
creation_time : 2011-04-20 03:55:11
Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 383 kb/s
Metadata:
creation_time : 2011-04-20 03:55:11
[buffer @ 0x89fb020] w:1280 h:544 pixfmt:yuv420p
Output #0, avi, to 'output.avi':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2011-04-20 03:55:11
ISFT : Lavf53.3.0
Stream #0.0(und): Video: mpeg4, yuv420p, 1280x544, q=2-31, 2500 kb/s, 23.98 tbn, 23.98 tbc
Metadata:
creation_time : 2011-04-20 03:55:11
Stream #0.1(eng): Audio: libmp3lame, 44100 Hz, 2 channels, s16, 192 kb/s
Metadata:
creation_time : 2011-04-20 03:55:11
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press ctrl-c to stop encoding
Segmentation Fault

B) Following your howto:
Why --enable-shared ? you asked ..
The only params changing from your guide are --enable-shared --enable-libgsm --enable-libxvid .. actually the only one I really need is libxvid so I discarded the others and recompiled ffmpeg.
So following your guide I completed point 1 (with sudo apt-get autoremove too), 2, 3, 4 and 5 (installing ffmpeg) with

./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab --enable-libxvid --enable-libvpx

and then everything went ok! :D
So now I can convert my sample.mp4 with the same command as above! (see point A.3)

So you were right: the problem was --enable-shared!
Thank you very much for your support!

andrew.46
March 3rd, 2012, 03:57 AM
Exciting times for FFmpeg and MPlayer users: Windows Media Audio Lossless decoder (http://git.videolan.org/?p=ffmpeg.git;a=commit;h=9d25f1f6194dba9cfd60c0596 aa59ad145d61382).

FakeOutdoorsman
March 3rd, 2012, 05:30 AM
...and another for today: bluray protocol (http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=23a5bf9db06d9f55fe0d38d49bdea91be1795a b3).

rahul_bhise
March 12th, 2012, 11:01 AM
thanks i was searchig for a perfict screencast which ended hear. Thanks a lot for this good work of yours.

varagrawal
March 15th, 2012, 01:18 PM
When I try installing FFmpeg from Git as you have given and then I try to install OpenCV, I keep getting these undefined reference errors.

I then downloaded the version 0.10 source and compiled from there and OpenCV installed without issue.

Why is this discrepancy present?

FakeOutdoorsman
March 15th, 2012, 06:59 PM
Why is this discrepancy present?
It's hard to give a reason without seeing the errors.

qyot27
March 15th, 2012, 07:23 PM
Since the libutvideo wrapper supports encoding now too, are there any plans to include it in the tutorial as well?

FakeOutdoorsman
March 15th, 2012, 09:56 PM
What is the general use case for UT Video? I have the impression that it's used among the anime community, but I'm not sure how they are using it. I don't know who else uses it, but I might suggest my Windows friends to try it as an intermediate for editing instead of huffyuv simply because it's easier to install, IIRC.

FakeOutdoorsman
March 15th, 2012, 11:20 PM
For those of you who want to try UT Video:

wget http://umezawa.dyndns.info/archive/utvideo/utvideo-10.2.4-src.zip
unzip utvideo-10.2.4-src.zip
cd utvideo-10.2.4
make
sudo checkinstall --pkgname=utvideo --pkgversion="10.2.4" --backup=no --deldoc=yes --fstrans=no --default
Then configure ffmpeg with --enable-gpl --enable-libutvideo. This will provide the libutvideo encoder and decoder. FFmpeg also comes with a native utvideo decoder but I don't know how it compares to libutvideo.

qyot27
March 16th, 2012, 12:18 PM
What is the general use case for UT Video? I have the impression that it's used among the anime community, but I'm not sure how they are using it. I don't know who else uses it, but I might suggest my Windows friends to try it as an intermediate for editing instead of huffyuv simply because it's easier to install, IIRC.
Both ffdshow and LAV Filters provide support for HuffYUV decoding (ffdshow can also encode ffvhuff through the VFW interface, dunno if LAV Filters can), so I don't know if I'd say Ut Video is necessarily easier to install - although it is if you're comparing it to the reference HuffYUV inf/dll package (but that package doesn't support YV12 encoding/decoding or the Adaptive Huffman tables option...those are both ffvhuff features).

Use case is usually toted as an editing/storage codec instead of Lagarith* (or FFV1) - Lagarith has issues sometimes with frame corruption, and both it and FFV1 are rather slow to encode. Primarily it's because Ut Video is faster to decode, although this is highly highly subject to the processor used - Ut is SSE2 optimized, so it might be capable of running circles around HuffYUV when editing or previewing or whatall (on non-SSE2 processors, there's not much a difference in speed between it and Lagarith, at least since Lagarith got a performance update a couple versions ago). It also gets compression somewhere between regular HuffYUV and Lagarith.

*and this is of course under the situation that you're running Windows or Wine, since Lagarith support in FFmpeg is still incomplete and limited to decoding. So on Linux it's more of a 'faster than HuffYUV on decode, faster than FFV1 on encode' issue.


In my tests of the native utvideo decoder vs. using libutvideo's decoder, the native decoder was faster (this was through the FFMS2 AviSynth plugin and clocked using avsmeter). But this is also considering that I don't have an SSE2 processor, and I don't know if the native decoder is optimized for that the way that libutvideo is. So on newer processors, it could still come down to speed.

My personal reason for asking was mainly for the checkinstall line, but also that I don't know how likely it is to end up in the repositories, since it strictly is FFmpeg that supports libutvideo. I'd say it's pretty likely it might get caught up in the politics of the situation concerning the fork and not be included for that reason. I'm not aware of anything other than FFmpeg (or by extension, things that link to FFmpeg) that can use it at the moment.



I actually have a script that checks the official site and automatically downloads the latest version, rather than the user needing to know what the specific version is. A simpler portion of the same script can be used strictly for checking versions rather than also downloading.

Check & download:

#!/bin/bash
LATEST=$(wget http://umezawa.dyndns.info/archive/utvideo/ -O - | grep "src.zip" - | tail -1 | cut -f7 -d ">" | sed -e "s/zip.*/zip/g" -e "s/^/http\:\/\/umezawa.dyndns.info\/archive\/utvideo\//g")
wget $LATEST

Check only:

wget http://umezawa.dyndns.info/archive/utvideo/ -O - | grep "src.zip" - | tail -1 | cut -f7 -d ">" | sed "s/zip.*/zip/g"

kevdog
March 17th, 2012, 03:02 PM
Not that I'm any expert on using ffmpeg at all, however I thought I would just add possibly an update script as based on the original directions on the tutorial:



#!/bin/bash

#PLEASE MODIFY THE FOLLOWING LINE DEPENDING ON YOUR INSTALLATION
BASEDIR=~/src

#Updating x264
echo "....Updating x264"
cd $BASEDIR/x264
if [[ $(git rev-list --max-count=1 master) != $(git rev-list --max-count=1 origin/master) ]]; then
make distclean
git pull
./configure --enable-static
make
sudo checkinstall --pkgname=x264 --pkgversion=""3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
--fstrans=no --default"
fi

#Updating libvpx
echo "....Updating libvpx"
cd $BASEDIR/libvpx
if [[ $(git rev-list --max-count=1 master) != $(git rev-list --max-count=1 origin/master) ]]; then
make clean
git pull
./configure
make
sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
fi

#Updating ffmpeg
echo "....Updating ffmpeg"
cd $BASEDIR/ffmpeg
if [[ $(git rev-list --max-count=1 master) != $(git rev-list --max-count=1 origin/master) ]]; then
make distclean
git pull
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 \
--enable-nonfree --enable-version3 --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe
fi

echo "....Updating Done"
exit

prupert
March 17th, 2012, 05:03 PM
Not that I'm any expert on using ffmpeg at all, however I thought I would just add possibly an update script as based on the original directions on the tutorial:



I wrote something similiar here:

http://code.google.com/p/x264-ffmpeg-up-to-date/

Looks like it does the same as yours, but allows for some configuration. It use to support all the various distros that Faeke's guide supported, but not any more as it was such a headache to keep updated. It's hosted at google code, but since the update mechanism isn't as good as git, I've moved the code to git.

I found keeping up to date with Fake's updates was difficult, so I don't tend to update it that often (though it is currently up to date).

Feel free to fork and use and abuse in your script as you please.

Akovia
March 17th, 2012, 09:01 PM
Just wanted to give a big Thank You for keeping the guide up to date for Lucid. It would have been a huge undertaking without your guide, and trying to find any guides for Lucid anymore is almost a losing battle.

(LTS = misnomer)

Anyway, it went flawlessly and your work is greatly appreciated.

Cheers

FakeOutdoorsman
March 18th, 2012, 06:58 AM
Just wanted to give a big Thank You for keeping the guide up to date for Lucid. It would have been a huge undertaking without your guide, and trying to find any guides for Lucid anymore is almost a losing battle.

(LTS = misnomer)

Anyway, it went flawlessly and your work is greatly appreciated.

Cheers

I'm glad it worked for you. I try to have an up-to-date guide for all supported versions of Ubuntu. Luckily I use virtual machines which makes this a much easier task.

Adrian98
March 27th, 2012, 12:23 PM
thanks for the simple and straight forward way of usage of FFmpeg and x264 !! Initially it was tough for me but eventually it was easy to follow!!!

hufemj
April 1st, 2012, 05:57 PM
Not having any luck with the installation. I'm running 11.10. The goal is to use recordmydesktop to create ogv videos and then post them to the web as mp4's. This was working fine under a previous version of ubuntu, I think 10.04.

After doing the first 7 steps, I tried the first 'one pass CRF' example, substituting my ogv file for 'input'. The error message that comes back is "Unrecognized option 'preset' "

If I take out "-preset slow", the error message that comes back is: "Unknown encoder 'libx264' "

I tried re-installing without any of the optional steps and got the same behavior.

If I do a 'which ffmpeg', I get /usr/local/bin/ffmpeg. Checking the date and time created, shows that it is the one I just built.

Any suggestions?

qyot27
April 1st, 2012, 10:39 PM
Not having any luck with the installation. I'm running 11.10. The goal is to use recordmydesktop to create ogv videos and then post them to the web as mp4's. This was working fine under a previous version of ubuntu, I think 10.04.

After doing the first 7 steps, I tried the first 'one pass CRF' example, substituting my ogv file for 'input'. The error message that comes back is "Unrecognized option 'preset' "

If I take out "-preset slow", the error message that comes back is: "Unknown encoder 'libx264' "

I tried re-installing without any of the optional steps and got the same behavior.

If I do a 'which ffmpeg', I get /usr/local/bin/ffmpeg. Checking the date and time created, shows that it is the one I just built.

Any suggestions?
which x264

It's not recognizing libx264 or the preset option because it didn't find x264, and therefore could not link to it.

hufemj
April 2nd, 2012, 03:07 AM
which x264

It's not recognizing libx264 or the preset option because it didn't find x264, and therefore could not link to it.

'which x264' returns /usr/local/bin/x264

So, it's there. But ffmpeg is clearly not finding it.

Not sure what to do.

FakeOutdoorsman
April 2nd, 2012, 08:34 PM
Any suggestions?

Can you show your command and the complete console output?

hufemj
April 3rd, 2012, 08:24 PM
Can you show your command and the complete console output?

Here goes. The command from the first post in this thread under "Using FFmpeg and x264" for "One Pass CRF" appears first with screencast.ogv as the input.

Then the same command with '-preset slow' removed is tried, followed by 'which x264' and 'which ffmpeg'.

mark@mark-desktop:~/testit$ ffmpeg -i screencast.ogv -acodec libfaac -aq 100 -vcodec libx264 -preset slow -crf 22 output.mp4
FFmpeg version SVN-r22813, Copyright (c) 2000-2010 the FFmpeg developers
built on Apr 7 2010 14:02:08 with gcc 4.4.1
configuration:
libavutil 50.14. 0 / 50.14. 0
libavcodec 52.66. 0 / 52.66. 0
libavformat 52.61. 0 / 52.61. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[ogg @ 0x18a6420]max_analyze_duration reached
Input #0, ogg, from 'screencast.ogv':
Duration: 00:00:34.00, start: 0.000000, bitrate: 349 kb/s
Stream #0.0: Data: skeleton
Stream #0.1: Video: theora, yuv420p, 800x608, PAR 1:1 DAR 25:19, 15 fps, 15 tbr, 15 tbn, 15 tbc
Stream #0.2: Audio: vorbis, 48000 Hz, mono, s16, 239 kb/s
Unrecognized option 'preset'
mark@mark-desktop:~/testit$
mark@mark-desktop:~/testit$
mark@mark-desktop:~/testit$
mark@mark-desktop:~/testit$ ffmpeg -i screencast.ogv -acodec libfaac -aq 100 -vcodec libx264 -crf 22 output.mp4
FFmpeg version SVN-r22813, Copyright (c) 2000-2010 the FFmpeg developers
built on Apr 7 2010 14:02:08 with gcc 4.4.1
configuration:
libavutil 50.14. 0 / 50.14. 0
libavcodec 52.66. 0 / 52.66. 0
libavformat 52.61. 0 / 52.61. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[ogg @ 0x1301420]max_analyze_duration reached
Input #0, ogg, from 'screencast.ogv':
Duration: 00:00:34.00, start: 0.000000, bitrate: 349 kb/s
Stream #0.0: Data: skeleton
Stream #0.1: Video: theora, yuv420p, 800x608, PAR 1:1 DAR 25:19, 15 fps, 15 tbr, 15 tbn, 15 tbc
Stream #0.2: Audio: vorbis, 48000 Hz, mono, s16, 239 kb/s
Unknown encoder 'libx264'
mark@mark-desktop:~/testit$
mark@mark-desktop:~/testit$
mark@mark-desktop:~/testit$ which libx264
mark@mark-desktop:~/testit$ which x264
/usr/local/bin/x264
mark@mark-desktop:~/testit$ which ffmpeg
/usr/local/bin/ffmpeg
mark@mark-desktop:~/testit$

FakeOutdoorsman
April 3rd, 2012, 09:16 PM
FFmpeg version SVN-r22813, Copyright (c) 2000-2010 the FFmpeg developers
built on Apr 7 2010 14:02:08 with gcc 4.4.1
configuration:

There's the issue. Your FFmpeg is old and contains no configure options. I'm guessing that you compiled FFmpeg two years ago when FFmpeg used SVN instead of Git while keeping your home directory contents during Ubuntu upgrades.

Remove x264 and FFmpeg and also delete the x264 and ffmpeg directories in your home directory then follow the guide.

hufemj
April 4th, 2012, 04:37 AM
There's the issue. Your FFmpeg is old and contains no configure options. I'm guessing that you compiled FFmpeg two years ago when FFmpeg used SVN instead of Git while keeping your home directory contents during Ubuntu upgrades.

Remove x264 and FFmpeg and also delete the x264 and ffmpeg directories in your home directory then follow the guide.

Awesome analysis. That totally explained why it worked for everybody but me. I looked in the ffmpeg directory in my home account and, sure enough, there were a bunch of files dated from 2010. I deleted both the ffmpeg and x264 directories in my home account and then simply followed the directions in the first posting of this thread and it worked like a charm.

Thanks!

Lucas Malor
April 7th, 2012, 09:36 PM
If I need only ogg/theora/vorbis, are some of these packages not needed?

libjack-jackd2-dev
libsdl1.2-dev
libva-dev
libvdpau-dev
libx11-dev
libxfixes-dev
texi2html
yasm
zlib1g-dev

qyot27
April 8th, 2012, 09:49 AM
If I need only ogg/theora/vorbis, are some of these packages not needed?

libjack-jackd2-dev
libsdl1.2-dev
libva-dev
libvdpau-dev
libx11-dev
libxfixes-dev
texi2html
yasm
zlib1g-dev
You're mixing up format support and build support. Most of that list of packages has nothing to do with specific formats (except for some that need zlib), but they are necessary - or at least highly recommended - for ffmpeg to set up correctly (texi2html) or interact with your video/sound card or peripherals (libjack, libva, libvdpau, libsdl, libx11, libxfixes) or not be deathly slow because you've turned off assembly optimizations (yasm).

FenrirX
April 10th, 2012, 09:48 AM
Thanks for your great guide!

FakeOutdoorsman
April 10th, 2012, 11:04 PM
This guide has been moved to the official FFmpeg wiki:

How to Compile FFmpeg and x264 on Ubuntu (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide)

I will attempt to migrate the guides for older Ubuntu versions later this week.

andrew.46
April 10th, 2012, 11:38 PM
Bookmarked :)

AlexOnVinyl
April 14th, 2012, 10:10 AM
When you compile x264 it should create the same files that libx264 and libx264-dev would create. If you add "--prefix=/usr" to the x264 configure line then these files will also install in the same location as the repo versions instead of the default /usr/local/lib. I'm unsure how to get Synaptic or apt to recognize this. I'm out of town until July 4 and can't test anything until then.

Will this guide work with 12.04LTS - I'm just running the commands now, and it seems to be doing its job, but then again, I'm a little clueless about whether or not its going to work.

Worst case scenario - how do I get rid of these and undo everything?

FakeOutdoorsman
April 14th, 2012, 06:07 PM
Wow, that's an old quote of mine with questionable information (I prefer to keep compiled stuff in /usr/local and don't really recommend /usr).

I haven't tested the guide in 12.04 yet. I should do that soon, but I assume it should work just fine.

mc4man
April 14th, 2012, 09:42 PM
I haven't tested the guide in 12.04 yet. I should do that soon, but I assume it should work just fine.
Just did a new 64 bit install of 12.04 - all's well with the guide, the vpx build was probably 90% warnings but went ok

A footnote of no concern - they finally spent 10 sec's adjusting the checkinstallrc so fstrans=no is now the default, probably best to just leave in the command for other users..

Jose Catre-Vandis
April 29th, 2012, 01:37 AM
Just followed the 11.10 guide (32 bit) for 12.04 Xubuntu. Works a treat. Many thanks :)

FakeOutdoorsman
April 29th, 2012, 03:42 AM
Just followed the 11.10 guide (32 bit) for 12.04 Xubuntu. Works a treat. Many thanks :)

I'm glad it worked for you. Coincidentally I updated the guide to 12.04: How to Compile FFmpeg and x264 on Ubuntu (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide)

"Updated" is an overstatement since the same instructions work for 12.04, 11.10, 11.04, and 10.10. All I did was download 12.04 and made sure everything worked (although mc4man already confirmed that).

andrew.46
April 29th, 2012, 10:56 AM
Coincidentally I updated the guide to 12.04: How to Compile FFmpeg and x264 on Ubuntu (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide)

Good to see the new location is working out :). Do you need --enable-libvpx in the FFmpeg ./configure string or is that still an optional extra?

FakeOutdoorsman
April 29th, 2012, 08:13 PM
Good catch. Fixed. I decided to dump the "optional" junk as it was probably confusing some users.

AlexOnVinyl
April 29th, 2012, 11:27 PM
Ok, I need a solid way to get the latest FFMpeg and x264 - because last time I followed the guide the way it was setup for Oneiric and then screwed up my whole gconf and had to reinstall everything.

I'm on 12.04LTS

Using: ffmpeg version 0.8.1-4:0.8.1-0ubuntu1
as far as x264 goes, I just grabbed what was off of the Medibuntu repo.

So please, for the safety of my system, and not having the grueling issues of using AptonCD to restore my .deb files without their dependencies in case of emergency, let's make a proper guide tailored towards 12.04.. otherwise I'm not going to take my chances again.

FakeOutdoorsman
April 30th, 2012, 02:55 AM
Ok, I need a solid way to get the latest FFMpeg and x264 - because last time I followed the guide the way it was setup for Oneiric and then screwed up my whole gconf and had to reinstall everything.
Compiling ffmpeg and x264 should not do anything to gconf, and without detailed information about the issue and how to duplicate it I can not provide any useful suggestions.


I'm on 12.04LTS
The guide for Oneiric and Precise are the same.


Using: ffmpeg version 0.8.1-4:0.8.1-0ubuntu1
as far as x264 goes, I just grabbed what was off of the Medibuntu repo.
If the repository version works for you then you probably don't need to compile. Medibuntu does not provide x264, but it does provide libavcodec-extra-53 which can enable the libx264 encoder in the repository ffmpeg.


So please, for the safety of my system, and not having the grueling issues of using AptonCD to restore my .deb files without their dependencies in case of emergency, let's make a proper guide tailored towards 12.04.. otherwise I'm not going to take my chances again.
Again, I'm unsure what the issue is, but see How To Compile FFmpeg and x264 on Ubuntu (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide) for a guide suitable for 12.04. If there is anything wrong with it then let me know and I (or possibly someone else because it is a wiki) will try to fix it.

eichenkranz
April 30th, 2012, 11:15 AM
sorry for my bad english

hello ..... Today I have a new problem

My first server had Ubuntu 10.04 LTS Lucid Lynx + a
Videoprotal ... :-) I have installed FFMPEG na this guide
...... http://ubuntuforums.org/showpost.php?p=9 ... & postcount = 1289


The user has uploaded a video and in the admin area where I must specify only which can be found ffmpeg (Flash
video mode configuration / Path to ffmpeg: / usr / local / bin / ffmpeg) ....
The video has been converted to. Flv + preview


now


I am moved by the video portal ... The new server 10.04.4 LTS ... So I reinstalled the FFMEPG according to the instructions .... and specify the path .... The video is converted but without the preview pics ..... but the image is necessary for the Protal .... one can help me?

AlexOnVinyl
April 30th, 2012, 02:53 PM
Compiling ffmpeg and x264 should not do anything to gconf, and without detailed information about the issue and how to duplicate it I can not provide any useful suggestions.


The guide for Oneiric and Precise are the same.


If the repository version works for you then you probably don't need to compile. Medibuntu does not provide x264, but it does provide libavcodec-extra-53 which can enable the libx264 encoder in the repository ffmpeg.


Again, I'm unsure what the issue is, but see How To Compile FFmpeg and x264 on Ubuntu (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide) for a guide suitable for 12.04. If there is anything wrong with it then let me know and I (or possibly someone else because it is a wiki) will try to fix it.

You're very polite good sir, thank you for understanding my ails.

robdocmagic
May 1st, 2012, 05:24 AM
Hi all,

I am interested in converting some files to mp4.

In some examples I find on the web they reference using the baseline profile with the "slow" preset (or ipod640 preset), but I can't seem to find the slow preset.

Is there a specific "Configure" option I need to do that installs all of the presets? I followed the latest instructions for installing ffmpeg.

Thanks a lot!

[~ffmpeg/presets]$ ls
libvpx-1080p50_60.ffpreset libvpx-360p.ffpreset libvpx-720p.ffpreset libx264-ipod640.ffpreset
libvpx-1080p.ffpreset libvpx-720p50_60.ffpreset libx264-ipod320.ffpreset

FakeOutdoorsman
May 1st, 2012, 08:08 AM
one can help me?
Sorry, but I do not know what "portal" you are using. I guess that the portal does not work with recent FFmpeg due to syntax differences and you should use ffmpeg from the repository.


In some examples I find on the web they reference using the baseline profile with the "slow" preset (or ipod640 preset), but I can't seem to find the slow preset.

FFmpeg now directly uses the x264 presets instead of emulating them with a text file (the ipod presets are an exception because they are non-standard). This is a good thing because the text files could not 100% duplicate the x264 presets. The downside is that the syntax is different, so many examples on the web will not work for you. A current example using the slow preset, animation tune, and baseline profile (you probably won't need to use a tune or profile but I just wanted to show how to use them if you want to):

ffmpeg -i input -c:v libx264 -c:a copy -crf 24 -preset slow -tune animation -profile baseline output.mkv
It might be hard to tell what resources on the web are outdated or just plain wrong, so if you tell us more details of what you want to do and how you plan on using your outputs we can provide more specific examples.

robdocmagic
May 1st, 2012, 05:24 PM
FFmpeg now directly uses the x264 presets instead of emulating them with a text file (the ipod presets are an exception because they are non-standard). This is a good thing because the text files could not 100% duplicate the x264 presets. The downside is that the syntax is different, so many examples on the web will not work for you. A current example using the slow preset, animation tune, and baseline profile (you probably won't need to use a tune or profile but I just wanted to show how to use them if you want to):

ffmpeg -i input -c:v libx264 -c:a copy -crf 24 -preset slow -tune animation -profile baseline output.mkv
It might be hard to tell what resources on the web are outdated or just plain wrong, so if you tell us more details of what you want to do and how you plan on using your outputs we can provide more specific examples.

Thanks for your quick response. I am looking to convert files to MP4 (h264) that can be viewed in Android and iOS devices.

I came across this "cheat sheet":

https://develop.participatoryculture.org/index.php/ConversionMatrix

And if references the slow preset.

Do you by chance have the syntax that I can use to convert to MP4 for iOS and Andriod? It would be much appreciated. :)

Thanks again for keeping these boards up-to-date. We all really appreciate it.

-Rob

FakeOutdoorsman
May 1st, 2012, 11:13 PM
I came across this "cheat sheet":

https://develop.participatoryculture.org/index.php/ConversionMatrix
The author must not have tested some of the Android examples. The preset names should be case sensitive so "-vpre iPod640" should not work. Also, the ipod preset is meant to be used after a standard preset because it is supposed to overwrite the settings from the standard preset. Placement is important and using it before "-vpre slow" may not allow it to work as expected. I can't remember the details of the old ipod preset so it may not be an issue.


Do you by chance have the syntax that I can use to convert to MP4 for iOS and Andriod? It would be much appreciated.
I don't own any of these devices but you can try one of these:

ffmpeg -i input -c:v libx264 -crf 24 -preset slow -vpre libx264-ipod640 -c:a libfaac -q:a 100 output.mp4
or

ffmpeg -i input -c:v libx264 -crf 24 -preset slow -profile:v baseline -level 30 -c:a libfaac -q:a 100 output.mp4
Both examples are very similar. The only difference is that the ipod preset just sets the additional bufsize and maxrate options that are probably not really needed. The only thing you may need to adjust is the crf value. Choose the highest value that still gives you an acceptable quality. You can add "-t 60" if you just want to test the first 60 seconds so you don't have to encode the whole thing to get a rough idea of what the rest of the movie could look like (of course it depends on the complexity of the various scenes) and to quickly see if it even works on your device.

You don't need to only use "slow" either. The general method is to use the slowest preset you have patience for. If "slow" is too slow ("slow" is unsurprisingly slow) then use a faster preset. See x264 --fullhelp for a list of presets and ignore the "placebo" preset as it is a joke and a waste of time.

You may want to resize your video for your device. If that is the case then add:

-filter:v scale="640:-1"
What this does it tell FFmpeg to use the scale filter to resize the video to 640 pixels wide. The -1 means to make the height whatever value it needs to be to preserve the aspect ratio. Unfortunately, depending on the size of your input, the -1 can often provide an odd numbered value which is not acceptable for libx264. Therefore I usually recommend using:

-filter:v scale="640:trunc(ow/a/2)*2"
It's basically similar to -1 but should return an even value. Alternatively, if you know a specific height instead, such as 360, you can use:

-filter:v scale="trunc(oh*a*2)/2:360"
So in the end your command may look like:

ffmpeg -i input -c:v libx264 -crf 24 -preset slow -profile:v baseline -level 30 -filter:v scale="640:trunc(ow/a/2)*2" -c:a libfaac -q:a 100 output.mp4

Redwol
May 4th, 2012, 10:53 AM
Hi FakeOutdoorsman,

I have followed the guide on the wiki for my ubuntu 12.04 LTS and successfully installed ffmpeg with optional components. However, I noticed that adobe flash plugin on youtube(seems to be only site with this issue) with firefox 12 seems to have distorted hue levels and the videos are blue (everyone looks like a smurf).

Is there a way for me to fix this hue setting? I have seen 2 working workarounds, first is to revert changes made by your tutorial or disable hardware acceleration.

Does anyone else have the same problem?

Thanks

Jose Catre-Vandis
May 4th, 2012, 11:11 AM
Hi FakeOutdoorsman,

I have followed the guide on the wiki for my ubuntu 12.04 LTS and successfully installed ffmpeg with optional components. However, I noticed that adobe flash plugin on youtube(seems to be only site with this issue) with firefox 12 seems to have distorted hue levels and the videos are blue (everyone looks like a smurf).

Is there a way for me to fix this hue setting? I have seen 2 working workarounds, first is to revert changes made by your tutorial or disable hardware acceleration.

Does anyone else have the same problem?

Thanks

Install the Flash Aid extension in Firefox, then run it to update/change your flash plugin. This fixed it for me.

AlexOnVinyl
May 4th, 2012, 12:34 PM
Hi FakeOutdoorsman,

I have followed the guide on the wiki for my ubuntu 12.04 LTS and successfully installed ffmpeg with optional components. However, I noticed that adobe flash plugin on youtube(seems to be only site with this issue) with firefox 12 seems to have distorted hue levels and the videos are blue (everyone looks like a smurf).

Is there a way for me to fix this hue setting? I have seen 2 working workarounds, first is to revert changes made by your tutorial or disable hardware acceleration.

Does anyone else have the same problem?

Thanks

Actually, I can help with this. The reason why everything looks all Orange and Blue is due more to the fact that Adobe dropped Linux support - the best work around - in my experience has been to open the video in full screen, then open the options and disable the Hardware Acceleration from there, assuming that it wasn't functional when you tried it at normal youtube video resolution.

Try this and let me know if it works.

Jose Catre-Vandis
May 5th, 2012, 01:13 PM
Just carried out installation on headless server. Required reboot to enable functionality (e.g. didn't recognise "c:v libx264" option). After reboot all worked as expected :)

Redwol
May 5th, 2012, 03:30 PM
Install the Flash Aid extension in Firefox, then run it to update/change your flash plugin. This fixed it for me.

Thanks! This fixed my issue.
edit: I also noticed there was a update to flash plugin so it might have fixed the issue but I installed both nonetheless. Also I am using Nouveau, instead of NVIDIA driver.

FakeOutdoorsman
May 5th, 2012, 06:16 PM
Just carried out installation on headless server. Required reboot to enable functionality (e.g. didn't recognise "c:v libx264" option). After reboot all worked as expected :)

Good timing. I recently modified the guide a few days ago to support headless servers by excluding some needless dependencies. I also wikified the Lucid and Hardy versions but haven't linked to them yet.

A reboot? Inconceivable! I don't understand why it wouldn't recognize "c:v libx264" without a reboot. Do you remember the particular message you got when you did try?


Thanks! This fixed my issue.
Good, because I had no idea.

Jose Catre-Vandis
May 5th, 2012, 08:11 PM
A reboot? Inconceivable! I don't understand why it wouldn't recognize "c:v libx264" without a reboot. Do you remember the particular message you got when you did try?

Just that IIRC. Same report you get when you put an incorrect parameter in the chain ....

Didn't have to reboot when I installed to desktop 12.04 though....

(Must confess I didn't spot your headless server section (to quote a song from Beauty and the Beast: "there was something there that wasn't there before ;)) until I had run the desktop install, so maybe this didn't help?

liam.bliss
May 11th, 2012, 10:42 AM
Hello all, I'm trying to build FFmpeg with h254 support on my headless Ubuntu 12.04 server, as per https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

h264 builds fine, but when i try to build FFmpeg it fails every time at the "CC libavcodec/h254" step.



$ make
CC libavdevice/alldevices.o
CC libavdevice/alsa-audio-common.o
CC libavdevice/alsa-audio-dec.o
CC libavdevice/alsa-audio-enc.o
[...SNIP...]
CC libavcodec/h263.o
CC libavcodec/h263_parser.o
CC libavcodec/h263dec.o
CC libavcodec/h264.o
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make: *** [libavcodec/h264.o] Error 4
$


I followed the instructions to the letter, with the exception that I apt-get installed FFmpeg and libx264-dev beforehand and then apt-get removed them when they didn't work.

Does anyone have any idea why the build might be failing? Apologies if this has been asked before, there's a lot of posts to read through in this thread!

- Liam

andrew.46
May 11th, 2012, 02:26 PM
This could be a ram access problem rather than an FFmpeg issue. Have you had a look at available ram / swap file?

ron999
May 14th, 2012, 11:58 AM
Hi FakeOutdoorsman
I've used the guide with Pangolin.
:)

No problems...

...but afterwards when I compiled MEncoder, config couldn't find x264.
:(

So I've had to re-compile x264 with "--enable-shared". :)

With Natty, MEncoder found x264 OK with "--enable-static".
Maybe something has changed since then.
(Or maybe I was compiling against some other x264 or libx264-dev that it found somewhere).:confused:

FakeOutdoorsman
May 14th, 2012, 06:49 PM
...but afterwards when I compiled MEncoder, config couldn't find x264.
I haven't compiled MEncoder in years. Maybe Andrew will have an idea?

mc4man
May 15th, 2012, 06:55 AM
Hi FakeOutdoorsman
I've used the guide with Pangolin.
:)

No problems...

...but afterwards when I compiled MEncoder, config couldn't find x264.
:(

So I've had to re-compile x264 with "--enable-shared". :)

With Natty, MEncoder found x264 OK with "--enable-static".
Maybe something has changed since then.
(Or maybe I was compiling against some other x264 or libx264-dev that it found somewhere).:confused:

This is likely caused by gcc > 4.4 which uses "as-needed". So if you were to check your configure log the x264 section would probably have quite a number of 'undefined references'

How you could change this in a mplayer build not sure, possibly ask in the compiling subforum

Otherwise you could just as well build x264 as both static & shared, won't matter much, the libx264 version # is going to be higher than the ubuntu repo's one so they can co-exist
Otherwise you could install gcc-4.4 & configure mplayer with --cc=gcc-4.4

andrew.46
May 15th, 2012, 08:56 AM
I haven't compiled MEncoder in years. Maybe Andrew will have an idea?

I too have not looked at MEncoder for a long while. But config.log should give a meaningful error message?

ron999
May 15th, 2012, 01:05 PM
Hi mc4man

I've done some experiments.
It seems that now with Pangolin...


IF x264 is not installed
THEN MEncoder is happy to build with libx264-dev
ELSE
IF x264 is installed
THEN MEncoder won't build with libx264-dev

Maybe it's possible to force the compiler to ignore a static x264 and allow MEncoder to build with libx264-dev.
In the meantime, I've compiled x264 'shared' and removed libx264-dev.
:cool:

mc4man
May 15th, 2012, 02:24 PM
Hi mc4man

I've done some experiments.
It seems that now with Pangolin...


IF x264 is not installed
THEN MEncoder is happy to build with libx264-dev
ELSE
IF x264 is installed
THEN MEncoder won't build with libx264-dev

Maybe it's possible to force the compiler to ignore a static x264 and allow MEncoder to build with libx264-dev.
In the meantime, I've compiled x264 'shared' and removed libx264-dev.
:cool:

Any which way you go should be ok. As far as using the x264 build as typical to this how-to for a mplayer/mencoder build with gcc > 4.4 -
If you add this to your mplayer configure then should go ok w/ the static only x264 -


--extra-libs-mencoder=-lx264

Though as mentioned see no real reason against building x264 as shared

ron999
May 15th, 2012, 02:57 PM
Thanks mc4man but "--extra-libs-mencoder=-lx264" has not solved the issue. :(

When x264 static is installed the MPlayer config message still shows:-

Checking for x264 ... no (in FFmpeg: no)

mc4man
May 15th, 2012, 03:09 PM
Ron - you're right - I was on a 12.10 install but then switched to 12.04 & forgot that I'd installed x264 as shared yesterday to ck.

(There are a couple of people frequenting the compiling forum that know the gcc changes fairly well if you are curious to pursue

active1
June 2nd, 2012, 10:41 AM
can anyone tell me the difference between make and make fprofiled ?
+what is the advantage from --enable-win32thread ? (i know it is for windows)
thanx

rh10023
June 14th, 2012, 02:20 AM
Where is the usage part of this guide? Need to look up something on audio offsets.

FakeOutdoorsman
June 14th, 2012, 03:12 AM
There was a small usage section of the guide but I removed it. It didn't address audio offsets though. I do plan on adding a new usage section, but it's low priority right now. So for now just consider this thread an interactive usage section or refer to "ffmpeg -h" or "man ffmpeg".

Jose Catre-Vandis
June 16th, 2012, 10:36 AM
+1 for a usage guide, with all the changes to syntax recently I have got lost :(

cantormath
June 17th, 2012, 03:17 PM
It appears that this file may have been moved:


:~$ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
Initialized empty Git repository in /opt/ffmpeg/libvpx/.git/
error: The requested URL returned error: 501 while accessing http://git.chromium.org/webm/libvpx.git/info/refs

fatal: HTTP request failed

Jose Catre-Vandis
June 17th, 2012, 05:05 PM
It appears that this file may have been moved:


:~$ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
Initialized empty Git repository in /opt/ffmpeg/libvpx/.git/
error: The requested URL returned error: 501 while accessing http://git.chromium.org/webm/libvpx.git/info/refs

fatal: HTTP request failed


You seem to have snuck a "--depth 1" in there - not in the tut ?


git clone http://git.chromium.org/webm/libvpx.git

FakeOutdoorsman
June 17th, 2012, 11:37 PM
Works for me:



$ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
Cloning into 'libvpx'...
remote: Counting objects: 5011, done.
remote: Compressing objects: 100% (2386/2386), done.
remote: Total 5011 (delta 3626), reused 3710 (delta 2501)
Receiving objects: 100% (5011/5011), 3.89 MiB | 355 KiB/s, done.
Resolving deltas: 100% (3626/3626), done.


Perhaps it is a temporary error with the server? What Ubuntu version are you using? The libvpx ($ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
Cloning into 'libvpx'...
WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-7zRwxY/pkcs11: No such file or directory
remote: Counting objects: 5011, done.
remote: Compressing objects: 100% (2386/2386), done.
remote: Total 5011 (delta 3626), reused 3710 (delta 2501)
Receiving objects: 100% (5011/5011), 3.89 MiB | 355 KiB/s, done.
Resolving deltas: 100% (3626/3626), done.
) site shows the same repository address.

andrew.46
June 18th, 2012, 10:17 AM
There is always a release snapshot:

http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2

which gets released every 2 months or so....

CaptainSlower
July 4th, 2012, 01:06 PM
Just wondering whether anybody else has experienced difficulty compiling ffmpeg on Ubuntu 10.04 using the instructions at:

https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideLucid

I've followed them carefully, but when I come to run make on the ffmpeg as downloaded from git, I get the following error(s):



makefile:2: config.mak: No such file or directory
Makefile:47: /common.mak: No such file or directory
Makefile:89: /libavutil/Makefile: No such file or directory
Makefile:89: /library.mak: No such file or directory
Makefile:169: /doc/Makefile: No such file or directory
Makefile:170: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.


Am I correct in thinking that this means that some of the required make for ffmpeg files simply are not present in the repository?

SL666
July 4th, 2012, 10:35 PM
At a guess i'd say your ./configure command did not complete successfully.

FakeOutdoorsman
July 5th, 2012, 08:08 PM
At a guess i'd say your ./configure command did not complete successfully.

Seems like a good guess to me. I followed the guide today on Lucid and it worked as expected.

Redwol
July 12th, 2012, 06:55 PM
I get this error:



./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
ERROR: librtmp 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
solving the problem.
looks like librtmp is split from ffmpeg project: http://forum.serviio.org/viewtopic.php?f=5&t=6039

edit: I am on ubuntu 12.04 desktop (x64)
according to link above

sudo apt-get install pkg-config libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev libvorbis-dev libvpx-dev libx264-devshould work but they are from the repo not git... can cause problems

ron999
July 12th, 2012, 07:15 PM
I get this error:



./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
ERROR: librtmp 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
solving the problem.
looks like librtmp is split from ffmpeg project: http://forum.serviio.org/viewtopic.php?f=5&t=6039

edit: I am on ubuntu 12.04 desktop (x64)
according to link above

sudo apt-get install pkg-config libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev libvorbis-dev libvpx-dev libx264-devshould work but they are from the repo not git... can cause problems

Looks like you're making up your own commands instead of working to the Compilation Guide here ---> https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

FakeOutdoorsman
July 12th, 2012, 08:12 PM
I added librtmp stuff to the guide yesterday and it worked for me in 12.04. Did you check to see that librtmp-dev is actually installed? Does the tail end of ~/ffmpeg/config.log show anything of interest?


sudo apt-get install librtmp-dev
cd ~/ffmpeg
make distclean
git pull
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis \
--enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe

Redwol
July 12th, 2012, 10:38 PM
I added librtmp stuff to the guide yesterday and it worked for me in 12.04. Did you check to see that librtmp-dev is actually installed? Does the tail end of ~/ffmpeg/config.log show anything of interest?


sudo apt-get install librtmp-dev
cd ~/ffmpeg
make distclean
git pull
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis \
--enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe

Sorry! I must have missed the top half of the guide that mentions dependencies.

I thought I installed them yesterday and wanted to work on rest of the guide today, huh must be the hot weather.

Thanks!

robdocmagic
July 16th, 2012, 07:42 PM
Hi All,

I am using the filters to put text in the top/bottom left and logos in the top/bottom right of my converted videos. It has been working perfectly for many months.

Here is my command:

/usr/local/bin/ffmpeg -i 4384.mts -vf "movie=/home/bigwayvideos/processing/bottom_right_watermark.png [logo];movie=/home/bigwayvideos/processing/top_right_watermark.png [logo2];[in][logo] overlay=W-w-8:H-h-8 [in+logo];[in+logo][logo2] overlay=W-w-8:8 [in+logo2]; [in+logo2] drawtext=fontfile=/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf:text='test (Jul 2012) - Day\: 1\, Jump\: 5':fontsize=24:fontcolor=black:x=10:y=10,drawtext= fontfile=/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf:text='Videographer\: Rob Desilets - skydivingphotography.com':fontsize=24:fontcolor=bl ack:x=10:y=H-th-10 [final];[final]yadif=1[out]" -vol 0 -y -c:v libx264 -crf 24 -preset slow -profile:v baseline -level 30 -c:a libfaac -q:a 100 -r 30 -s 480x320 test-071612-rd-4384-9.mp4

The output looks like this:

http://legacy.skydivingphotography.com/old.png

Notice the size of the logo in top right/bottom right.

About 3 weeks ago I upgraded my ffmpeg (using the steps outlined in this thread) and now when I process the videos my logos are super small.

The new output looks like this:

http://legacy.skydivingphotography.com/new.png

Note the [small] size of the logos in top/bottom right.

The video input is the same size and so are the logos themselves; the only thing different is the ffmpeg I am using.

Does anyone know if I need to pass any additional/new flags into ffmpeg or what I need to do to get them the same size they were?

As always, thanks for your time :)

-Rob

roysoft
July 17th, 2012, 12:05 PM
while converting a generic h264 video with:

ffmpeg -i <input-file> -vcodec libx264 -vpre lossless_slow -profile baseline
-tune zerolatency <output-file.mp4>

This command i get the error

[h264 @ 0x2fc8500] Too many slices (68 >= 16), increase MAX_SLICES and recompile
[h264 @ 0x2fc6400] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 59.94 (2997/50) -> 29.97 (2997/100)
Input #0, h264, from 'wilson/ns-allinone-3.14.1/ns-3.14.1/scratch/figure5.264':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264 (High), yuv420p, 1920x1080, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
[NULL @ 0x2fc9000] [Eval @ 0x7fff8fcfe2f0] Undefined constant or missing '(' in 'baseline'
[NULL @ 0x2fc9000] Unable to parse option value "baseline"
Invalid value 'baseline' for option 'profile'


how this error can be solved " Invalid value 'baseline' for option 'profile' "

Could you please help me solving this issue...

rulet
July 18th, 2012, 11:49 AM
I used a batch command for conversion all avi to mp4 in one folder:


mkdir output ; for file in *.avi ; do ffmpeg -i $file -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 output/$file.mp4 ; done

This command produce files like 001.avi.mp4.
How to change this command to remove .avi part from the names of final files?


... Well, I found the answer. The command in this case will be:


mkdir output ; for file in *.avi ; do ffmpeg -i $file -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 output/${file%.avi}.mp4 ; done

By the way the output of this command warns about;


Please use -profile:a or -profile:v, -profile is ambiguous

So I used -profile:v instead -profile. I don't know if it is right or what is better option for -profile.

FakeOutdoorsman
July 19th, 2012, 10:47 PM
Does anyone know if I need to pass any additional/new flags into ffmpeg or what I need to do to get them the same size they were?
I am currently travelling, but I can take a look at this after July 23.


while converting a generic h264 video with:

ffmpeg -i <input-file> -vcodec libx264 -vpre lossless_slow -profile baseline -tune zerolatency <output-file.mp4>
Your command is outdated. There is no lossless_slow preset anymore (file based presets have been replaced with the actual presets in x264) and the baseline profile doesn't support lossless. The zerolatency tune shouldn't do much for lossless except use sliced threads. A current example based on yours is:

ffmpeg -i <input-file> -vcodec libx264 -preset veryslow -qp 0 -tune zerolatency <output-file.mp4>


how this error can be solved " Invalid value 'baseline' for option 'profile' "
You need to change -profile to -profile:v. This is because -profile by itself is ambiguous and I believe there is also an audio -profile option.


So I used -profile:v instead -profile. I don't know if it is right or what is better option for -profile.

Yes, -profile:v is correct.

FakeOutdoorsman
July 25th, 2012, 11:16 PM
fdk-aac mini guide

FFmpeg now supports the Fraunhofer AAC encoder library (fdk-aac (http://sourceforge.net/projects/opencore-amr/)) which increases FFmpeg support to five AAC encoders: ffaacenc (the native FFmpeg AAC encoder), libfaac, libvo-aacenc, libaacplus, and libfdk-aac. Here's how to compile fdk-aac.

1. Get a few build dependencies:

sudo apt-get install build-essential checkinstall

2. Compile fdk-aac:

wget http://downloads.sourceforge.net/opencore-amr/fdk-aac-0.1.0.tar.gz
tar xzvf fdk-aac-0.1.0.tar.gz
cd fdk-aac-0.1.0
./configure --enable-shared=no
make
sudo checkinstall --pkgname=fdk-aac --pkgversion="0.1.0" --backup=no --deldoc=yes --fstrans=no --default

3. Configure and compile ffmpeg:

cd ~/ffmpeg
make distclean
git pull
./configure --enable-libfdk-aac
make, checkinstall, etc as shown in FFmpeg compile guide (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide).

4. Usage. Some examples can be found at Open Source Fraunhofer AAC Encoder (fdk-aac) (www.hydrogenaudio.org/forums/index.php?showtopic=95989).

FakeOutdoorsman
July 25th, 2012, 11:33 PM
libcaca mini guide

FFmpeg now supports libcaca (http://caca.zoy.org/wiki/libcaca), a graphics library that outputs text instead of pixels.

1. Get a few build dependencies:

sudo apt-get install build-essential checkinstall libcaca-dev

2. Configure and compile ffmpeg:

cd ~/ffmpeg
make distclean
git pull
./configure --enable-libcaca
make, checkinstall, etc as shown in FFmpeg compile guide.

3. Usage:

ffmpeg -i INPUT -vcodec rawvideo -pix_fmt rgb24 -window_size 80x25 -f caca -

FakeOutdoorsman
August 6th, 2012, 08:42 PM
The FFmpeg and x264 Encoding Guide (https://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide) is now available.

Merrattic
August 8th, 2012, 04:01 PM
Many thanks for the encoding guide.

Did I read somewhere that if using "-ss" to place it before the "-i" to speed up the seek? e.g.
ffmpeg -ss 00:30:00 -i input.avi

FakeOutdoorsman
August 8th, 2012, 07:09 PM
You are correct, but it may not be as accurate as using -ss as an output option (after -i).

mmstick
August 31st, 2012, 04:53 PM
I am having problems with getting this to work. After following all the directions in my Ubuntu 12.04 server system, if I try to use x264 it returns:

x264: error while loading shared libraries: libfdk-aac.so.0: cannot open shared object file: No such file or directory

Edit:

Fixed by purging x264 and recompiling it.

cannon_dt
September 2nd, 2012, 12:51 PM
I followed your guide over at https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide.
Everything went through fine, I run 12.04.
But when I type in ffmpeg in the cl, I get the following:
ffmpeg: error while loading shared libraries: libfdk-aac.so.0: cannot open shared object file: No such file or directory

What do I do?

mc4man
September 2nd, 2012, 06:26 PM
I followed your guide over at https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide.
Everything went through fine, I run 12.04.
But when I type in ffmpeg in the cl, I get the following:
ffmpeg: error while loading shared libraries: libfdk-aac.so.0: cannot open shared object file: No such file or directory

What do I do?
This will likely fix itself the next time you install a proper .deb package which will do an ldconfig

For future reference -
whenever installing a checkinstall package that contains shared libs one should run this after install

sudo ldconfig

So if still affected run that command & all will be ok

The fdk-aac build is doing as shared so it should end with the above command

Edit; the alt. would be to build fdk-aac as static only, don't know enough about it to say
(./configure --disable-shared

FakeOutdoorsman
September 2nd, 2012, 07:00 PM
Edit; the alt. would be to build fdk-aac as static only, don't know enough about it to say
(./configure --disable-shared

It should be static like the others. I'll test and update it later today.

cannon_dt
September 2nd, 2012, 07:18 PM
mc4man, that sudo ldconfig resolved it. Thanks a ton.
Maybe the guide needs to be updated with this

FakeOutdoorsman
September 2nd, 2012, 09:31 PM
I updated the guide. It is now static so running ldconfig or monkeying with any environment variables are now not required.

cannon_dt
September 3rd, 2012, 03:45 PM
One more thing FakeOutdoorsman
Under the FFmpeg compile section, in ./configure --enable-x11grab is missing. It only says to omit for servers but I did it for a desktop and now I got a
"Unknown input format: 'x11grab'

FakeOutdoorsman
September 3rd, 2012, 07:50 PM
One more thing FakeOutdoorsman
Under the FFmpeg compile section, in ./configure --enable-x11grab is missing.

Thanks for the notification. It was listed in the configure originally, but it appears someone removed it (it is a wiki) and I didn't notice when I cleaned up their mess. I'll add it again.


...I did it for a desktop and now I got a
"Unknown input format: 'x11grab'

Can you show your ffmpeg command and the complete console output?

cannon_dt
September 4th, 2012, 07:52 AM
Sorry fakeoutdoorsman.
I fixed the problem by reinstalling ffmpeg. So I dont have the complete console output :(
However the command I used is


ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 \
-s $(xwininfo -frame | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') \
-i :0.0+$(xwininfo -frame | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' \
| grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) \
-acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 \
-y ~/Public/screencast/aa_screencast_baking.mkv

ron999
September 6th, 2012, 03:02 AM
Hi
In the wiki for FFmpeg it shows:-

./configure... --enable-libopencore-amrnb --enable-libopencore-amrwb ...

I think that libopencore-amrwb is only a DEcoder, not an ENcoder.
ffmpeg -codecs shows:-

DEA D libopencore_amrnb OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)
D A D libopencore_amrwb OpenCORE AMR-WB (Adaptive Multi-Rate Wide-Band)
Doesn't it need vo-amrwbenc to be compiled and installed to enable amr-wb encoding?

I have compiled from here ---> http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/
But it looks as though there's a git version here ---> https://github.com/mstorsjo/vo-aacenc
(libvo-amrwbenc-dev is in the repo for Oneiric-Pangolin-Quantal)

FakeOutdoorsman
September 6th, 2012, 09:24 PM
I think that libopencore-amrwb is only a DEcoder, not an ENcoder.

Yes, I believe it is a decoder only, but I've never used it personally.


Doesn't it need vo-amrwbenc to be compiled and installed to enable amr-wb encoding?

You can use vo-amrwbenc as an encoder in ffmpeg. Just compile it and then add "--enable-libvo-amrwbenc --enable-version3" to your ffmpeg ./configure. I haven't checked to see if it is in an Ubuntu(+1) repository yet.


I have compiled from here ---> http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/
But it looks as though there's a git version here ---> https://github.com/mstorsjo/vo-aacenc

vo-aacenc is another AAC encoder. Did you mean this: https://github.com/mstorsjo/vo-amrwbenc.


(libvo-amrwbenc-dev is in the repo for Oneiric-Pangolin-Quantal)

Thanks for the tip. Maybe I'll add it as a dependency, but I don't know how useful it would be for the general public.

ron999
September 6th, 2012, 09:37 PM
Did you mean this: https://github.com/mstorsjo/vo-amrwbenc.
Yes, that's the one. :)
I posted the wrong links, my bad. :confused:

jgcsd
September 14th, 2012, 04:13 PM
x11grab isn't working for me. I've installed ffmpeg using the tutorial on the wiki, and ffmpeg seems to work, except for x11grab

For example, if I try

ffmpeg -f x11grab -i hw:0 test.mkvI get this

ffmpeg version N-35113-g509f502 Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 14 2012 15:44:58 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration:
libavutil 51. 73.100 / 51. 73.100
libavcodec 54. 55.100 / 54. 55.100
libavformat 54. 27.100 / 54. 27.100
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 16.103 / 3. 16.103
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
Unknown input format: 'x11grab'
Any help?

ron999
September 14th, 2012, 04:51 PM
Any help?
Show full unedited output from command:-

ffmpeg -version

FakeOutdoorsman
September 14th, 2012, 06:12 PM
x11grab isn't working for me. I've installed ffmpeg using the tutorial on the wiki, and ffmpeg seems to work, except for x11grab

I get this

ffmpeg version N-35113-g509f502 Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 14 2012 15:44:58 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration:
Any help?

Your ffmpeg configure line is blank. Did you skip the step with the configure options? The minimum you need to enable x11grab is "--enable-gpl --enable-x11grab".

boturk
December 20th, 2012, 10:58 AM
I am trying to install ffmpeg on my ubuntu 12.04 server using the Ubuntu Compilation Guide linked to from here. When I do the configure step for ffmpeg I keep getting ERROR: libaacplus not found or ERROR: fdk-aac not found or ERROR: libvpx not found, even though I installed all those like the guide said.

I also noticed in the configure log this line "ffmpeg /usr/bin/ld: error: cannot find -laacplus", and I think my laacplus files are in /usr/local/lib/ I thought maybe if I re-installed all the components using --enable-shared it might fix the issue. Any help with this issue would be greatly appreciated. Thank you in advanced.

FakeOutdoorsman
December 20th, 2012, 09:30 PM
Did you follow the guide word-for-word, or did you modify any steps? Someone else added the libaacplus and libopus sections, and I haven't tested those instructions yet.

You shouldn't need to add --enable-shared.

Are you sure libaacplus, fdk-aac, and libvpx were installed successfully? You can check with dpkg:


$ dpkg -L libaacplus
/.
/usr
/usr/local
/usr/local/bin
/usr/local/bin/aacplusenc
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig/aacplus.pc
/usr/local/lib/libaacplus.a
/usr/local/lib/libaacplus.la
/usr/local/lib/libaacplus.so.2.0.2
/usr/local/include
/usr/local/include/aacplus.h
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man1/aacplusenc.1.gz
/usr/share
/usr/share/doc
/usr/share/doc/libaacplus
/usr/share/doc/libaacplus/NEWS
/usr/share/doc/libaacplus/COPYING
/usr/share/doc/libaacplus/INSTALL
/usr/share/doc/libaacplus/ChangeLog
/usr/share/doc/libaacplus/docs
/usr/share/doc/libaacplus/docs/aacplusenc.1
/usr/share/doc/libaacplus/README
/usr/share/doc/libaacplus/AUTHORS
/usr/share/doc/libaacplus/TODO
/usr/local/lib/libaacplus.so.2
/usr/local/lib/libaacplus.so


If you don't need libaacplus, fkd-aac, and libvpx you can simply omit --enable-libaacplus, --enable-libfdk-aac, and --enable-libvpx from the ffmpeg configure line. The instructions to add these external libraries are optional. If you don't plan on using them then it is recommended not to install them.

boturk
December 21st, 2012, 08:33 AM
Thanks for responding FakeOutdoorsman, I actually do plan on using the aac+ and aac codecs, and would like to try out the new vp8 codec. I compared my output from dpkg -L libaacplus to yours and it matches perfectly. I remember getting success from each of these installs when I ran the commands from the guide. I just copy and pasted directly from the guide. I also tried setting up an ubuntu 12.04 vm, followed the same steps, and everything worked. Its just not working on my Ubuntu 12.04 server for some reason.

I pasted the error part from the configure log below. I did notice something interesting in the configure log. FFmpeg appears to be looking in '/usr/bin/ld' for some reason, then failing. I dont have this directory on my machine.

/usr/bin/ld: error: cannot find -laacplus
/tmp/ffconf.2DUaOkun.o:ffconf.qEzF9ZAK.c:function main: error: undefined reference to 'aacplusEncOpen'
collect2: ld returned 1 exit status
ERROR: libaacplus >= 2.0.0 not found

I also tried running 'sudo ldconfig -v' and did see it listed like below.
/usr/local/lib:
libaacplus.so.2 -> libaacplus.so.2.0.2

I hope this information is useful. I have no idea whats causing this. Thanks for the help.

andrew.46
December 21st, 2012, 08:37 AM
Debate over sound quality never ends but arguable you would get better aac sound with neroAacEnc, not part of FFmpeg of course..

boturk
December 22nd, 2012, 02:22 AM
So I was able to get FFmpeg to configure and install by omitting --enable-libfdk-aac and --enable-libaacplus in my configure command. I did install these libraries, but the configure wouldn't see them no mater how many times I removed and reinstalled them.

klein de usa
December 22nd, 2012, 03:00 AM
good day

i have been following your guide for ubuntu 10.04 https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideLucid everything goes well until i get to installing ffmpeg i do :

./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx \
--enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab

and it tells me :
Unknown option "--enable-libopencore-am"
--enable-libopencore-amrwb: command not found
--enable-libx264: command not found

any one have a clue what i have missed or done wrong ?

klein de usa
December 22nd, 2012, 05:01 AM
good day

i have been following your guide for ubuntu 10.04 https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideLucid everything goes well until i get to installing ffmpeg i do :

./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx \
--enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab

and it tells me :
Unknown option "--enable-libopencore-am"
--enable-libopencore-amrwb: command not found
--enable-libx264: command not found

any one have a clue what i have missed or done wrong ?


i found my problem all is good

FakeOutdoorsman
December 22nd, 2012, 05:07 AM
So I was able to get FFmpeg to configure and install by omitting --enable-libfdk-aac and --enable-libaacplus in my configure command. I did install these libraries, but the configure wouldn't see them no mater how many times I removed and reinstalled them.

I removed libaacplus instructions. I think it is unnecessary with fdk-aac (also capable of HE-AACv2 with the bonus of LC-AAC encoding too), I encountered some other issues compiling it on 12.04 server, and its download-and-patch functionality wasn't consistent for me causing unpatched files.

I also have a vague recollection of libaacplus having issues when fdk-aac and/or vo-aacenc were either installed or during the ffmpeg configure, but I don't know if it is still a problem, so maybe try again and ffmpeg configure with fdk-aac might work as expected.


and it tells me :

Unknown option "--enable-libopencore-am"
--enable-libopencore-amrwb: command not found
--enable-libx264: command not found

any one have a clue what i have missed or done wrong ?

Looks like a bad paste. Try again:

cd ~/ffmpeg
make distclean
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab

I tried it in Lucid and it worked fine for me.

klein de usa
December 22nd, 2012, 03:03 PM
thank you FakeOutdoorsman

i figured that out, i did my research and read everything twice though i'd be smart and make the web page a .pdf file with firefox. so print to .pdf in firefox doesn't make a perfect .pdf file, lesson learned.

sudhakarRedi
January 3rd, 2013, 12:54 PM
I tried using both nasm and yasm from the repos, and x264 would compile but it would say it was building without support for yasm and nasm.

Then, when I used it to convert a file it would say that it was using no cpu extensions, as opposed to saying "MMX SSE ...". It would also take significantly longer (like 2-5 times as long).

But just installing the yasm from source fixed it, and it wasn't very difficult to do.

when I try to enable yasm in ffmpeg it is giving me an error that "yasm not found" how can I solve this problem..? Any one please suggest me

FakeOutdoorsman
January 3rd, 2013, 08:31 PM
Did you install yasm first?

Jesua
January 25th, 2013, 10:20 PM
Good guide..


This guide has been moved to the official FFmpeg wiki:

How to Compile FFmpeg and x264 on Ubuntu (https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide)

The guide will be kept up to date and all supported Ubuntu versions will be included.

heyup
February 12th, 2013, 05:36 PM
Using the guide I got installation errors installing fdk-acc and ffmpeg sections; the other sections installed OK.

fdk-acc and ffmpeg folders appear in /home directory, but are not shown as installed in Synaptic.

I'm using 12.04 (Precise) Classic No Effects.

Error installing fdk-acc


richard@base-desktop:~/fdk-aac$ autoreconf -fiv
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
richard@base-desktop:~/fdk-aac$ ./configure --disable-shared
bash: ./configure: No such file or directory
richard@base-desktop:~/fdk-aac$ make
make: *** No targets specified and no makefile found. Stop.
richard@base-desktop:~/fdk-aac$ sudo checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
> --deldoc=yes --fstrans=no --default

Installation results
make: *** No rule to make target `install'. Stop.

**** Installation failed. Aborting package creation.

Error installing ffmpeg


richard@base-desktop:~/ffmpeg$ ./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame \
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora \
> --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
ERROR: libfdk_aac 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
solving the problem.
richard@base-desktop:~/ffmpeg$ make
Makefile:2: config.mak: No such file or directory
Makefile:49: /common.mak: No such file or directory
Makefile:92: /libavutil/Makefile: No such file or directory
Makefile:92: /library.mak: No such file or directory
Makefile:178: /doc/Makefile: No such file or directory
Makefile:179: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.
richard@base-desktop:~/ffmpeg$ sudo checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no \
> --deldoc=yes --fstrans=no --default

Installation results
Makefile:2: config.mak: No such file or directory
Makefile:49: /common.mak: No such file or directory
Makefile:92: /libavutil/Makefile: No such file or directory
Makefile:92: /library.mak: No such file or directory
Makefile:178: /doc/Makefile: No such file or directory
Makefile:179: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'. Stop.

**** Installation failed. Aborting package creation.

Can you help fix this.

As aside, it would helpful to beginners if you added instructions to the guide to show how to install source snapshot tar.bz2 files.

FakeOutdoorsman
February 12th, 2013, 08:30 PM
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
That's strange. Installation of autoconf should have installed automake which should have installed aclocal. Are you sure autoconf and automake are installed?


$ dpkg -s automake | grep Status
Status: install ok installed
$ dpkg -s autoconf | grep Status
Status: install ok installed


As aside, it would helpful to beginners if you added instructions to the guide to show how to install source snapshot tar.bz2 files.

I'll keep this in mind. Is git just too annoying to use? I'm planning on changing the guides so they no longer perform any system installation, so changes will be coming...eventually.

heyup
February 13th, 2013, 12:23 AM
That's strange. Installation of autoconf should have installed automake which should have installed aclocal. Are you sure autoconf and automake are installed?

autoconf was installed, but automake wasn't.

I'm using a custom build of Precise desktop; automake wasn't installed by default, and I had disabled 'consider recommended packages as dependencies' in Synaptic settings (to avoid unnecessary bloat).

In Synaptic autoconf lists automake as a recommendeded package not a dependency of autoconf, so automake wasn't installed!

No errors after installing automake.


Is git just too annoying to use? I'm planning on changing the guides so they no longer perform any system installation, so changes will be coming...eventually.

No problem with using git. I just thought that it might useful to include instructions on how to install a snapshot.

Great guide. Thanks for your help solving this problem.

tL0z
March 29th, 2013, 04:14 PM
Hey guys,

I have installed everything successfully, but kdenlive does not detect the new codecs.

How do I get kdenlive to work with the new codecs?

Thank you!

tL0z
April 8th, 2013, 08:31 PM
Anyone?!

qyot27
April 9th, 2013, 09:18 PM
Case 1: kdenlive uses shared libs (which is the most likely scenario).
Solution: Build FFmpeg as shared; this guide builds it as static. May also require installing to /usr rather than /usr/local, but I'm not sure on how that's handled.

Case 2: kdenlive uses static libs.
Solution: Recompile kdenlive so it sees/uses the new static libs.

andrew.46
April 14th, 2013, 02:14 AM
It is possible to install a local only copy of FFmpeg and direct the ./configure process of an application to find this specific copy by manipulating the PKG_CONFIG_PATH variable. An example here:

https://help.ubuntu.com/community/CompileVLC#FFmpeg...

which shows the local copy and for vlc the ./configure process is altered to include:



PKG_CONFIG_PATH="$HOME/vlc_build/vlcdeps/usr/lib/pkgconfig" \


Once this is scripted it is not so painful :). Hopefully something similar will work for kdenlive...

qyot27
April 14th, 2013, 02:17 PM
True, although I'd hardly call having to use PKG_CONFIG_PATH painful. It's pretty much a necessity for cross-compiling.

In other news, x264's AviSynth input module now also supports using AvxSynth (as of February 26th). FFmpeg has a rewritten AviSynth demuxer (initial commit on March 20th) that acts in the same way as x264's, by dynamically loading the library itself; previously, it was tied to Video for Windows. On Linux and OSX, it also supports AvxSynth. x264 automatically enables the support, FFmpeg requires the --enable-avisynth option to do so. This also means that media players that rely on libavformat can play .avs scripts on non-Windows (like mpv, my preferred mplayer variant and mencoder replacement).

The issue of not having AviSynth's large library of external plugins is a drawback, but up until now it was much more difficult to work with AvxSynth, and therefore, also trying to get any of those plugins ported would seem like a waste. Now that both x264 and FFmpeg (and through FFmpeg, anything that relies on libavformat) can use it, hopefully the process will be accelerated.

FakeOutdoorsman
April 14th, 2013, 06:24 PM
It is possible to install a local only copy of FFmpeg and direct the ./configure process of an application to find this specific copy by manipulating the PKG_CONFIG_PATH variable.

That is the direction the guide will evolve to. No more system install or messing with the package management system. I haven't been able to work on it lately, and probably will not be able to for some time, but if anyone would like to contribute that would be fine with me.

FakeOutdoorsman
May 13th, 2013, 02:16 AM
Here's a start to the new version of the guide that will provide a "local" install (is there a more common or more accurate term for this?) of ffmpeg and x264. This should avoid any system installation and will also allow users to install the crappy fake-ffmpeg/libav junk from the repo with no conflict. As an added bonus this will fit well with andrew.46's VLC guide (http://ubuntuforums.org/showthread.php?t=2141949). Also, by changing the custom locations users can install multiple versions. Users without root access can use a similar method provided they at least have build-essentials. Binaries go to "$HOME/bin" since Ubuntu by default has this in the $PATH in ~/.profile and issuance of ffmpeg in console will use the local version and trump the repo version.



sudo apt-get update
sudo apt-get -y install autoconf automake build-essential git libass-dev libfaac-dev libgpac-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libvpx-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html yasm zlib1g-dev

cd
git clone --depth 1 git://git.videolan.org/x264.git
cd x264
./configure --prefix=$HOME/ffmpeg_build --bindir=$HOME/bin --enable-static
make
make install
make distclean

cd
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --prefix=$HOME/ffmpeg_build --disable-shared
make
make install
make distclean

cd
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --prefix=$HOME/ffmpeg_build --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir=$HOME/bin --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree
make
make install
make distclean

source ~/.profile


Questions/Comments:

How should "man ffmpeg" be implemented? There is the "--mandir" standard configure option, but I haven't actually tried anything or looked beyond that.
What about "--datadir"? Generally this is default to "/usr/(local)/share/ffmpeg". For general users the only somewhat useful contents are the presets. I suppose "$HOME/.ffmpeg" could work, since ffmpeg looks there for presets (or at least used to) but I haven't tried anything.
Does everything, such as the external encoders, actually work? Again, I haven't tried.
Making a shallow repository with "--depth 1" seems to screw with the commit number in the ffmpeg console output such as "N-37392-gbc63a76" when it should be at least "N-52966-ga9705e4", but I didn't rule out user error.
I pruned some "lesser" dependencies (libjack, libspeex, opencore-amr, librtmp [native support should suffice]) for no real reason other than making a slimmer guide, but looks like I forgot opus...
To "uninstall" just delete "~/ffmpeg_build" and "~/bin/[ffmpeg,ffplay,ffprobe,ffserver,x264]".


Tested in 13.04. Worksforme™ but I'm open to any suggestions of course. Thanks to andrew.46 and mc4man for the motivation and hints. Once it looks good enough I'll change the ffmpeg guide to use this method.

mc4man
May 13th, 2013, 04:58 AM
As far as the man pages -
Works out fine here having them go to /usr/local/share/man/man1/, checked in both terminal & thru manpage scope, screens from 12.04
(guide works fine here 12.04 & 13.04, the extra flags work well, I'd tried them first, must of been mistyping or an errant space..
So that's -

--mandir=/usr/local/share/man
datadir don't know, haven't used what's in it. Would just use same location as previous guide produced (easy to check, though haven't done so here, just took a guess.. /usr/local/share/ffmpeg

(- here I'll still send the binaries to /usr/local/bin, also available to all from there

andrew.46
May 13th, 2013, 08:41 AM
. Thanks to andrew.46 and mc4man for the motivation and hints.

Thanks for introducing me to FFmpeg in the first place :). BTW it may be a very stupid question but do you actually have to build the x264 executable for FFmpeg? (by building x264 with --disable-cli).

FakeOutdoorsman
May 13th, 2013, 06:24 PM
...do you actually have to build the x264 executable for FFmpeg? (by building x264 with --disable-cli).

No, but I like to include it for users who may want to use it directly...although without lavf support in x264, by simply compiling x264 again after ffmpeg, I don't know how easy it is to use for the general user. Maybe I'll add it to the instructions. It used to be a separate optional section, but I wanted to reduce the verbosity/noise of the guide.

FakeOutdoorsman
May 14th, 2013, 02:50 AM
As far as the man pages -
Works out fine here having them go to /usr/local/share/man/man1/
Probably the way I'll go, but for now I did nothing since I got impatient and updated the wiki page as is. I'd prefer to keep everything in the home directory, and to avoid checkinstall and/or "make uninstall" (and export), but apart from messing with $MANPATH or whatever I don't know of other options yet.

monkeybrain2012
May 14th, 2013, 03:39 AM
Hi, actually I am trying to build ffmpeg as a shared library, I tried to do that on 13.04 basically following your guide but with shared enabled for all the libs and got this error



ffmpeg: symbol lookup error: /usr/local/lib/libavcodec.so.55: undefined symbol: vpx_codec_vp9_dx_algo

If libvpx is disabled then it works. Is this a conflict between libvbx1 and the built version? Thanks in advance for your advice.

andrew.46
May 19th, 2013, 03:42 AM
I see ftp support (http://git.videolan.org/?p=ffmpeg.git;a=commit;h=c86d3a54dedc4dbf37a84a355 9facb7e7ad8ef9f) is in place for FFmpeg, has anybody got it working? I have tried and failed several times :(