Ffmpeg initial experience

Source: Internet
Author: User
Tags intel pentium
[Root @ localhost ffmpeg_new_v4l2_avi2] # FFMPEG-I test. Avi-vcodec Xvid output. Avi
FFmpeg version SVN-r7773, copyright (c) 2000-2006 Fabrice bellard, et al.
Configuration: -- prefix =/usr -- enable-GPL -- enable-shared -- enable-mp3lame -- enable-amr_nb -- enable-amr_wb -- enable-amr_if2 -- enable-libogg -- enable-Vorbis -- enable-Xvid -- enable-a52 -- enable-a52bin -- enable- DTS -- enable-PP -- enable-faac -- enable-x264 -- enable-pthreads -- disable-ffserver -- disable-ffplay
Libavutil version: 49.2.0
Libavcodec version: 51.29.0
Libavformat version: 51.8.0
Built on Feb 5 2007 12:52:57, GCC: 3.2.3 20030502 (Red Hat Linux 3.2.3-47. FC4)
Input #0, Avi, from 'test. avi ':
Duration: 00:00:40. 0, start: 0.000000, bitrate: 19380 kb/s
Stream #0.0: Video: rawvideo, bgr24, 200x150, 25.00 FPS (r)
Stream #0.1: Audio: pcm_s16le, 44100Hz, stereo, 1411 kb/s
File 'output. avi' already exists. Overwrite? [Y/n] y
Output #0, Avi, to 'output. avi ':
Stream #0.0: Video: Xvid, yuv420p, 200x150, q = 2-31,200 kb/s, 25.00 FPS (c)
Stream #0.1: Audio: MP2, 44100Hz, stereo, 64 KB/s
Stream mapping:
Stream #0.0-> #0.0
Stream #0.1-> #0.1
Press [Q] To stop Encoding
Frame = 1175 q = 2.0 lsize = 1617kb time = 47.0 bitrate = 281.8 kbits/s
Video: 1159kb audio: 375kb global headers: 0kb muxing overhead 5.386455%

According to the above FFMPEG output, the audio is compressed into MP2. Why not compress it into MP3? Is it because MP3 has not been invented at the time of MPEG ??? However, due to frame loss in the original stored AVI file, 998 frames of video are mistakenly compressed into 1175 frames, which leads to repeated audio and video errors.

The second time the normal AVI file is compressed, It is 1000 frames. The output information of FFmpeg is as follows:

[Root @ localhost ffmpeg_new_v4l2_avi2] # ffmpeg-I test. avi-vcodec xvid output. avi
FFmpeg version SVN-r7773, Copyright (c) 2000-2006 Fabrice Bellard, et al.
Configuration: -- prefix =/usr -- enable-gpl -- enable-shared -- enable-mp3lame -- enable-amr_nb -- enable-amr_wb -- enable-amr_if2 -- enable-libogg -- enable-vorbis -- enable-xvid -- enable-a52 -- enable-a52bin -- enable- dts -- enable-pp -- enable-faac -- enable-x264 -- enable-pthreads -- disable-ffserver -- disable-ffplay
Libavutil version: 49.2.0
Libavcodec version: 51.29.0
Libavformat version: 51.8.0
Built on Feb 5 2007 12:52:57, gcc: 3.2.3 20030502 (Red Hat Linux 3.2.3-47. fc4)
Input #0, avi, from 'test. avi ':
Duration: 00:00:40. 0, start: 0.000000, bitrate: 19416 kb/s
Stream #0.0: Video: rawvideo, bgr24, 200x150, 25.00 fps (r)
Stream #0.1: Audio: pcm_s16le, 44100Hz, stereo, 1411 kb/s
File 'output. avi' already exists. Overwrite? [Y/N] y
Output #0, avi, to 'output. avi ':
Stream #0.0: Video: xvid, yuv420p, 200x150, q = 2-31,200 kb/s, 25.00 fps (c)
Stream #0.1: Audio: mp2, 44100Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0-> #0.0
Stream #0.1-> #0.1
Press [q] to stop encoding
Frame = 1000 q = 3.0 Lsize = 1379kB time = 40.0 bitrate = 282.5 kbits/s
Video: 996kB audio: 312kB global headers: 0kB muxing overhead 5.426410%

[Root @ localhost ffmpeg_new_v4l2_avi2] # mplayer output. avi
MPlayer 1.0pre7-3.2.3 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/celeon Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
Cpuflags: MMX: 1 mmx2: 1 3 dnow: 0 3dnow2: 0 SSE: 1 sse2: 1
Compiled for x86 CPU with extensions: MMX mmx2 SSE sse2

Use mplayer to play the compressed file as follows. The effect is good and the compression ratio is quite good.

Playing output. Avi.
AVI file format detected.
Video: [Xvid] 200x150 24bpp 25.000 FPS 203.9 kbps (24.9 Kbyte/s)
Clip info:
Software: lavf51.8.0
========================================================== ========================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
Audio: 44100Hz, 2 CH, s16le, 64.0 kbit/4.54% (ratio: 8000-> 176400)
Selected audio codec: [MP3] ATOM: mp3lib (mp3lib MPEG layer-2, layer-3)
========================================================== ========================================
VO: X11 running at 1024x768 with depth 24 and 32 BPP (": 0" => Local display)
========================================================== ========================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
========================================================== ========================================
Checking audio filter chain for 44100Hz/2ch/s16le-> 44100Hz/2ch/s16le...
AF_pre: 44100Hz/2ch/s16le
AO: [oss] 44100Hz 2ch s16le (2 bps)
Building audio filter chain for 44100Hz/2ch/s16le-> 44100Hz/2ch/s16le...
Starting playback...
VDec: vo config request-200x150 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33: 1-prescaling to correct movie aspect.
VO: [xv] 200x150 => 200x150 Planar YV12
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~ /. Mplayer/subfont. TTF ).
Subtitle Font: load_sub_face failed.
A: 40.0 V: 40.0 A-V: 0.010 CT: 0.010 1000/1000 1% 1% 1 0

Exiting... (end of file)

From the information printed by mplayer, we can see that the mplayer kernel actually contains FFMPEG.

The compilation of FFmpeg is still time-consuming. If you have time, you can release the compilation process.

Todo: Add Xvid encoding to my capture program, so that real-time compression can coexist into the AVI format. How long does it take to get it done? I have no idea. Come on!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.