Sono un noob completo per l'editing video, quindi perdonami se chiedo qualcosa di ridicolo.
Ricevo videoclip da un set top box del registratore. Le clip sono file AVI:
Resolution: 1920 x 1080
Frames Per Second: 60
Video Format: ITU H.264
Audio Format: MPEG 1 Audio, Layer 3 (MP3)
La risoluzione e l'FPS vanno ben oltre ciò di cui ho bisogno, quindi sto cercando di eseguire un comando per ridimensionare le cose:
ffmpeg -i highres.avi -r 30 -s 960x540 lowerres.avi
Questo è riuscito a darmi la risoluzione, il framerate e la dimensione del file desiderati, ma ha anche degradato la qualità in modo più del previsto.
Ho guardato il nuovo file e ho scoperto che per qualche motivo FFmpeg ha convertito il formato utilizzato:
Video Format: FFmpeg MPEG-4
Audio Format: MPEG 1 Audio, Layer 2
Non mi è chiaro perché non utilizzi gli stessi formati di output dei formati di input. Ho provato a usare questo comando per forzarlo a usare H.264:
ffmpeg -i highres.avi -r 30 -s 960x540 -f h264 lowerresforceh264.avi
Sfortunatamente, non è riuscito con il seguente output:
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' --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-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --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' --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-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --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, avi, from 'highres.avi':
Metadata:
comment : Quality_GOOD
encoder : Lavf52.64.2
encoded_by : AverMedia_c281_1.7.2
Duration: 00:01:59.28, start: 0.000000, bitrate: 10263 kb/s
Stream #0.0: Video: h264 (High), yuv420p, 1920x1080, 59.94 fps, 59.94 tbr, 59.94 tbn, 119.88 tbc
Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
[buffer @ 0x8f438a0] w:1920 h:1080 pixfmt:yuv420p
[scale @ 0x8f431e0] w:1920 h:1080 fmt:yuv420p -> w:960 h:540 fmt:yuv420p flags:0x4
[libx264 @ 0x8f0fb40] broken ffmpeg default settings detected
[libx264 @ 0x8f0fb40] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x8f0fb40] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x8f0fb40] speed presets are listed in x264 --help
[libx264 @ 0x8f0fb40] profile is optional; x264 defaults to high
Output #0, h264, to 'lowerresforceh264.avi':
Stream #0.0: Video: libx264, yuv420p, 960x540, q=2-31, 200 kb/s, 90k tbn, 30 tbc
Stream mapping:
Stream #0.0 -> #0.0
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
Non sono sicuro del perché non posso farlo. L'esecuzione di "ffmpeg -formats" elencava h264 come uno che poteva usare sia per input che per output.
Se qualcuno potesse indicarmi la giusta direzione, lo apprezzerei molto. Grazie.
PS: sto usando FFmpeg versione 0.7.3-4: 0.7.3-0 su Ubuntu 11.10.
MODIFICARE
Ho trovato una soluzione guardando l'uso dei preset. Dopo aver cercato informazioni sui preset, ho trovato il seguente tutorial che li discuteva:
http://juliensimon.blogspot.com/2009/01/howto-ffmpeg-x264-presets.html
Avevo solo bisogno di specificare il codec e le impostazioni predefinite appropriate in questo modo:
ffmpeg -i highres.avi -r 30 -s 960x540 -vcodec libx264 -vpre medium lowerresforceh264vpremedium.avi
Ho ancora alcune modifiche da fare, ma questo è fondamentalmente quello che volevo. Grazie.