하늘높이의 프로그래밍 이야기

당분간 쓸만한 2메가 변환 옵션

I:\FFMPEG\bin>ffmpeg -i "f:\INPUT.asf" -b:v 2256k -b:a 1
28k -r 29.97 -ab 128k -crf 30 -profile:v baseline -re -cbr_quality 10 -maxrate:v
 2300k -copyts OUTPUT.mp4

 

Win32용 FFMPEG 컴파일된것... http://ffmpeg.zeranoe.com/builds/

'Media Tech > H.264,VC-1,Codec' 카테고리의 다른 글

FFMPEG Rebuild  (0) 2009.12.09
Apple's Darwin Streaming Server On Fedora 10  (0) 2009.04.16
VLC 로 트랜스코딩하기  (0) 2009.02.11
MKV 포맷...  (3) 2008.09.22
Video codecs tutorial  (0) 2007.07.12

   1: /// <summary>
   2:    /// FFMPEG을 이용해서 프레임을 추출함
   3:    /// FFMPEGManager Class 1.0
   4:    /// Program by kunmin00
   5:    /// </summary>
   6:    public class FFMpegManager
   7:    {
   8:        const int IMG_COUNT = 60;
   9:  
  10:        /// <summary>
  11:        /// FFMPEG 을 이용해서 프레임 추출하기 kunmin00
  12:        /// </summary>
  13:        /// <param name="mediaFileInfo"></param>
  14:        /// <returns></returns>
  15:        public static Boolean GrapImageFromMediafile(MediaFile mediaFileInfo)
  16:        {
  17:  
  18:            TimeSpan duration = mediaFileInfo.DurationTime;
  19:  
  20:            LogHelper.LogMessage("[FFMPEG 이미지 추출 시작] " + mediaFileInfo.FilePath);
  21:  
  22:            Process myProcess = new Process();
  23:            FileInfo mediafileinfo = new FileInfo(mediaFileInfo.FilePath);
  24:            string mediafilename = mediafileinfo.Name.Replace(mediafileinfo.Extension, "");
  25:  
  26:            string LogPath = Application.StartupPath +"\\Temp";
  27:  
  28:            GlobalFunction.Current_Mainform.ChangeProgressBar(0, IMG_COUNT);
  29:            //디렉토리 체크
  30:            if (!Directory.Exists(LogPath))
  31:            {
  32:                LogHelper.LogMessage("[템프 폴더 생성]");
  33:                Directory.CreateDirectory(LogPath);
  34:            }
  35:  
  36:            try
  37:            {
  38:                for (int i = 0; i < IMG_COUNT; i++)
  39:                {
  40:                    myProcess.StartInfo.UseShellExecute = false;
  41:                    // You can start any process, HelloWorld is a do-nothing example.
  42:                    myProcess.StartInfo.FileName = "FFMPEG\\ffmpeg.exe";
  43:                    TimeSpan time = TimeSpan.FromSeconds((duration.TotalSeconds / IMG_COUNT) * i + 1);
  44:                    myProcess.StartInfo.Arguments = "-ss " + GetTimeStringFromTimeSpan(time) + " -vframes 1 -i \"" + mediaFileInfo.FilePath + "\" -y -f image2 " + ".\\Temp\\" + mediafilename + "_" + time.TotalSeconds.ToString() + ".png" + " -threads 4 -an";
  45:                    myProcess.StartInfo.CreateNoWindow = true;
  46:                    myProcess.StartInfo.RedirectStandardOutput = false;
  47:                    myProcess.Start();
  48:  
  49:                    GlobalFunction.Current_Mainform.ChangeProgressBar((i+1) * 100 / IMG_COUNT, IMG_COUNT);
  50:                    LogHelper.LogMessage("[" + (i+1) + "번째 이미지 추출] " + mediafilename + "_" + time.TotalSeconds.ToString() + ".png");
  51:  
  52:                    myProcess.WaitForExit();
  53:  
  54:                    Thread.Sleep(1);
  55:             
  56:                }
  57:  
  58:                LogHelper.LogMessage("[FFMPEG 이미지 추출 종료] " + mediaFileInfo.FilePath);
  59:  
  60:                myProcess.Close();
  61:                myProcess = null;
  62:            }
  63:            catch (Exception ex)
  64:            {
  65:                ExceptionHelper.ShowException(ex);
  66:                return false;
  67:            }
  68:  
  69:            return true;
  70:        }
  71:  
  72:        public static String GetTimeStringFromTimeSpan(TimeSpan duration)
  73:        {
  74:            return duration.Hours.ToString("00") + ":" + duration.Minutes.ToString("00") + ":" + duration.Seconds.ToString("00");
  75:        }
  76:  
  77:    }

'Application Tech > C#,VB.NET' 카테고리의 다른 글

MS의 Project Oxford  (0) 2015.05.07

몇 주전에…

개인 서버로 사용하는 PC의 OS를 Fedora Core 13으로 업그레이드를 했는데….

이후 IPOD 동영상 인코딩을 위해  FFMPEG 등을 사용하기 위해 기존에 FreshRPMs를 사용하려고 봤더니..

너무 업데이트가 안되고 있는 것을 확인

 

요즘에 쓸만한 서드 파티 레포지토리를 찾아보았다.

그 중 맘에 드는 사이트가…

ATrpms… 페도라 코어 13의 rpm들도 따로 제공…

http://packages.atrpms.net/dist/f13/

 

#] rpm --import http://ATrpms.net/RPM-GPG-KEY.atrpms

#] vi /etc/yum.repos.d/atrpms.repo

 

[atrpms]
name=Fedora Core $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/f$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1

#]yum install ffmpeg vlc faac gstreamer -y

 

IPOD  설치 환경 구축 완료!!

이제 기존에 올려놓았던 인코딩 스크립트를 이용해 인코딩을 해보죠^^

http://skylimit.pe.kr/146

즐거운 아이팟/아이폰 라이프들 하고 계신가요?

저도 지하철에서 많이 이용하고 있습니다.
앱들을 이용하는것도 좋지만 음악이나 동영상을 보기에도 아이팟이 참 좋은데요.

그 때마다 인코딩을 하려니 쩝.... H.264 인코딩 시간이 엄청나게 걸리네요.
인코딩은 해야하는데 지금 사용하는 컴퓨터가 인코딩으로 느려지는 건 싫구요.
하여 항상 켜져있는 제 Linux 서버[넷탑]의 FFMpeg을 이용해서 인코딩 하는 방법이 없을까? 하고 찾아보았는데 아래와 같은 스크립트가 있더군요.^^

http://slated.org/howto_transcode_h264_for_ipod_with_ffmpeg
[IE로는 접속이 안되니 놀라지 마시길...@.@]

그중에 몇가지를 수정해 보았습니다.
필요 하신분은 참고하세요.^^

[주의] 이 스크립트가 돌아갈려면 mplayer,ffmpeg,gpac[MP4Box] 등이 설치 되어 있어야 합니다.

#]ipod.sh *.avi 가능!!


 

최근에 새로 구매한 아이팟 터치용으로 동영상을 인코딩하려 하는데.....
Fodora core 12 에서 FFMpeg 아래와 같은 옵션으로 돌릴려고 하니...

ffmpeg -i "INPUT.avi" -acodec libfaac -ab 128k -s 480x320 -vcodec mpeg4 -b 0.5M -flags +aic+cbp+mv0+mv4 -trellis 1 -mbd 2 -cmp 2 -subcmp 2 -g 250 -maxrate 0.8M -bufsize 2M -metadata "title=제목" -f ipod "OUTPUT.mp4"
 
뭐 대략 faac 오류...
알고 봤더니 아래와 같이 faac 옵션이 빠져있었다.
(사연은 non-free가 되었다는....)

FFmpeg version SVN-r20372, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  built on Nov  7 2009 17:50:32 with gcc 4.4.2 20091027 (Red Hat 4.4.2-7)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=i686 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --extra-version=rpmfusion --enable-bzlib --enable-libdc1394 --enable-libdirac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avfilter-lavf --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=i686 --enable-runtime-cpudetect
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.37. 1 / 52.37. 1
  libavformat   52.39. 2 / 52.39. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1. 4. 1 /  1. 4. 1
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0

[root@linuxserver i686]# rpmbuild --rebuild --with faac ffmpeg-0.5-5.20091026svn.fc12.src.rpm
RPM 리빌딩, 의존성 개발 RPM들 설치, RPM 재 설치


[root@linuxserver i686]# ffmpeg
FFmpeg version SVN-r20372, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  built on Dec  9 2009 13:30:26 with gcc 4.4.2 20091027 (Red Hat 4.4.2-7)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=i686 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --extra-version=rpmfusion --enable-bzlib --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-nonfree --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avfilter-lavf --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=i686 --enable-runtime-cpudetect
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.37. 1 / 52.37. 1
  libavformat   52.39. 2 / 52.39. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1. 4. 1 /  1. 4. 1
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0

IPOD 터치용 인코딩 성공!!~

'Media Tech > H.264,VC-1,Codec' 카테고리의 다른 글

FFMPEG 옵션  (0) 2012.05.11
Apple's Darwin Streaming Server On Fedora 10  (0) 2009.04.16
VLC 로 트랜스코딩하기  (0) 2009.02.11
MKV 포맷...  (3) 2008.09.22
Video codecs tutorial  (0) 2007.07.12

동영상을 MP3 Player 용으로 트랜스코딩을 하려고 하는데.....

내가 주로 작업하는 PC에서 작업을 해버리는 CPU가 100% 뛰어버리니 다른 작업을 못하게 되고...

그래서 항상 켜두는 리눅스 PC에서 작업을 하기로 했다.

 

Mencoder

mencoder -oac mp3lame -ovc lavc -of avi -ofps 16 -lameopts abr:br=128 -lavcopts vcodec=mpeg4:vbitrate=350 -ffourcc DX50 -o output.pmp.avi input.avi

 

FFMpeg

ffmpeg -i input.avi -r 320x240 -b 300k -r 16 -vcodec libxvid  -ab 128k -ar 22050 -acodec libmp3lame output.avi