H.265 with x265

Website, builds, or other suggestions.
nille02
Posts: 24
Joined: Tue Aug 14, 2012 3:47 pm

H.265 with x265

Post by nille02 » Wed Feb 12, 2014 6:37 pm

Today i read the News that ffmpeg can provide h265 encoding support with x265.

http://git.videolan.org/?p=ffmpeg.git;a ... 8b308debd1

http://www.phoronix.com/scan.php?page=n ... px=MTYwMTg

it would be nice if this is in your daily builds

Ajaja
Posts: 69
Joined: Fri Mar 08, 2013 2:00 pm

Re: H.265 with x265

Post by Ajaja » Thu Feb 13, 2014 5:43 pm

Took few libx265 tests. Very bad quality with ffmpeg. Something wrong with I-frames. There are warnings:

Code: Select all

$ ./ffmpeg.exe -f lavfi -i mptestsrc -to 60 -c:v libx265 c1.mkv
ffmpeg version 2.1.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 13 2014 19:30:46 with gcc 4.8.2 (x86_64-posix-seh, Built by MinGW-W64 project)
  configuration: --target-os=mingw32 --enable-lto --disable-shared --enable-static --prefix=/mingw64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libopus --enable-libspeex --enable-bzlib --enable-zlib --enable-frei0r --enable-libgsm --enable-gpl --extra-cflags='-DPTW32_STATIC_LIB -DLIBTWOLAME_STATIC' --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvo-aacenc --enable-libschroedinger --enable-libbluray --enable-libxavs --enable-libsoxr --enable-libfreetype --enable-fontconfig --enable-libass --enable-libopenjpeg --enable-avisynth --enable-libtwolame --enable-libilbc --enable-libcaca --enable-libmodplug --enable-avresample --enable-libcdio --disable-w32threads --enable-gnutls --enable-libvidstab --enable-libnut --enable-dxva2 --enable-opencl --enable-libwebp --enable-opengl --enable-libfaac --enable-librtmp --extra-libs=-lstdc++ --disable-runtime-cpudetect
  libavutil      52. 63.101 / 52. 63.101
  libavcodec     55. 52.101 / 55. 52.101
  libavformat    55. 32.100 / 55. 32.100
  libavdevice    55.  9.100 / 55.  9.100
  libavfilter     4.  1.102 /  4.  1.102
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'mptestsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
x265 [info]: using cpu capabilities: MMX2 SSE SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-3 (Main tier)
x265 [info]: WPP streams / pool / frames         : 8 / 4 / 2
x265 [info]: CU size                             : 64
x265 [info]: Max RQT depth inter / intra         : 1 / 1
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / refs          : 1 / 1 / 3
x265 [info]: Rate Control / AQ-Strength / CUTree : ABR-200 kbps / 1.0 / 1
x265 [info]: tools: rect amp rd=3 lft sao-lcu sign-hide
Output #0, matroska, to 'c1.mkv':
  Metadata:
    encoder         : Lavf55.32.100
    Stream #0:0: Video: hevc (libx265), yuv420p, 512x512 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 1k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx265)
Press [q] to stop, [?] for help
x265 [warning]: specified frame type (-39579448) at 0 is not compatible with keyframe interval
x265 [warning]: specified frame type (-39579448) at 250 is not compatible with keyframe interval
x265 [warning]: specified frame type (-39579448) at 500 is not compatible with keyframe interval
x265 [warning]: specified frame type (-39579448) at 750 is not compatible with keyframe interval
x265 [warning]: specified frame type (-39579448) at 1000 is not compatible with keyframe interval
x265 [warning]: specified frame type (-39579448) at 1250 is not compatible with keyframe interval
frame= 1500 fps=9.2 q=0.0 Lsize=    1587kB time=00:00:59.92 bitrate= 217.0kbits/s
video:1576kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.699566%
x265 [info]: frame I: 1500   kb/s: 214.39
x265 [info]: global : 1500   kb/s: 214.39

qyot27
Posts: 83
Joined: Wed Jan 23, 2013 4:10 pm
Contact:

Re: H.265 with x265

Post by qyot27 » Fri Feb 14, 2014 1:15 pm

Your first mistake was thinking you could output as anything other than raw HEVC. There is no muxing support yet.

Furthermore, you're using the defaults, which means something like -crf 30. Use -x265-params crf=XX (where XX is the desired crf level).

Ajaja
Posts: 69
Joined: Fri Mar 08, 2013 2:00 pm

Re: H.265 with x265

Post by Ajaja » Fri Feb 14, 2014 5:48 pm

qyot27 wrote:Your first mistake was thinking you could output as anything other than raw HEVC. There is no muxing support yet.

Furthermore, you're using the defaults, which means something like -crf 30. Use -x265-params crf=XX (where XX is the desired crf level).
I tried raw hevc output and -x265-params crf=XX too. The problem is same:

Code: Select all

$ ./ffmpeg.exe -f lavfi -i mptestsrc -to 60 -c:v libx265 -preset veryslow -x265-params crf=25 c1.hevc
ffmpeg version 2.1.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 13 2014 19:30:46 with gcc 4.8.2 (x86_64-posix-seh, Built by MinGW-W64 project)
  configuration: --target-os=mingw32 --enable-lto --disable-shared --enable-static --prefix=/mingw64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libopus --enable-libspeex --enable-bzlib --enable-zlib --enable-frei0r --enable-libgsm --enable-gpl --extra-cflags='-DPTW32_STATIC_LIB -DLIBTWOLAME_STATIC' --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvo-aacenc --enable-libschroedinger --enable-libbluray --enable-libxavs --enable-libsoxr --enable-libfreetype --enable-fontconfig --enable-libass --enable-libopenjpeg --enable-avisynth --enable-libtwolame --enable-libilbc --enable-libcaca --enable-libmodplug --enable-avresample --enable-libcdio --disable-w32threads --enable-gnutls --enable-libvidstab --enable-libnut --enable-dxva2 --enable-opencl --enable-libwebp --enable-opengl --enable-libfaac --enable-librtmp --extra-libs=-lstdc++ --disable-runtime-cpudetect
  libavutil      52. 63.101 / 52. 63.101
  libavcodec     55. 52.101 / 55. 52.101
  libavformat    55. 32.100 / 55. 32.100
  libavdevice    55.  9.100 / 55.  9.100
  libavfilter     4.  1.102 /  4.  1.102
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'mptestsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
x265 [info]: using cpu capabilities: MMX2 SSE SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-3 (Main tier)
x265 [info]: WPP streams / pool / frames         : 8 / 4 / 2
x265 [info]: CU size                             : 64
x265 [info]: Max RQT depth inter / intra         : 3 / 3
x265 [info]: ME / range / subpel / merge         : star / 57 / 4 / 4
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 40 / 8 / 2
x265 [info]: b-pyramid / weightp / refs          : 1 / 1 / 5
x265 [info]: Rate Control / AQ-Strength / CUTree : CRF-25.0 / 1.0 / 1
x265 [info]: tools: rect amp rd=6 lft sao-lcu sign-hide
Output #0, hevc, to 'c1.hevc':
  Metadata:
    encoder         : Lavf55.32.100
    Stream #0:0: Video: hevc (libx265), yuv420p, 512x512 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx265)
Press [q] to stop, [?] for help
x265 [warning]: specified frame type (-48754488) at 0 is not compatible with keyframe interval
x265 [warning]: specified frame type (-48754488) at 250 is not compatible with keyframe interval
x265 [warning]: specified frame type (-48754488) at 500 is not compatible with keyframe interval
x265 [warning]: specified frame type (-48754488) at 750 is not compatible with keyframe interval
x265 [warning]: specified frame type (-48754488) at 1000 is not compatible with keyframe interval
x265 [warning]: specified frame type (-48754488) at 1250 is not compatible with keyframe interval
frame= 1500 fps=5.4 q=0.0 Lsize=    2819kB time=00:00:59.92 bitrate= 385.4kbits/s
video:2819kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.000000%
x265 [info]: frame I: 1500   kb/s: 384.05
x265 [info]: global : 1500   kb/s: 384.05
Main problem is quality. PSNR of libx265 encoded videos is much worse than lib264 encoded with the same or lower bitrate. Something really wrong with ffmpegs libx265 integration.

Code: Select all

$ ./ffmpeg.exe -f lavfi -i mptestsrc -to 60 -c:v libx264 -preset veryslow -crf 21 c1.h264
ffmpeg version 2.1.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 13 2014 19:30:46 with gcc 4.8.2 (x86_64-posix-seh, Built by MinGW-W64 project)
  configuration: --target-os=mingw32 --enable-lto --disable-shared --enable-static --prefix=/mingw64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libopus --enable-libspeex --enable-bzlib --enable-zlib --enable-frei0r --enable-libgsm --enable-gpl --extra-cflags='-DPTW32_STATIC_LIB -DLIBTWOLAME_STATIC' --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvo-aacenc --enable-libschroedinger --enable-libbluray --enable-libxavs --enable-libsoxr --enable-libfreetype --enable-fontconfig --enable-libass --enable-libopenjpeg --enable-avisynth --enable-libtwolame --enable-libilbc --enable-libcaca --enable-libmodplug --enable-avresample --enable-libcdio --disable-w32threads --enable-gnutls --enable-libvidstab --enable-libnut --enable-dxva2 --enable-opencl --enable-libwebp --enable-opengl --enable-libfaac --enable-librtmp --extra-libs=-lstdc++ --disable-runtime-cpudetect
  libavutil      52. 63.101 / 52. 63.101
  libavcodec     55. 52.101 / 55. 52.101
  libavformat    55. 32.100 / 55. 32.100
  libavdevice    55.  9.100 / 55.  9.100
  libavfilter     4.  1.102 /  4.  1.102
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'mptestsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
File 'c1.h264' already exists. Overwrite ? [y/N] y
[libx264 @ 0000000006100320] using SAR=1/1
[libx264 @ 0000000006100320] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000006100320] profile High, level 3.1
Output #0, h264, to 'c1.h264':
  Metadata:
    encoder         : Lavf55.32.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 512x512 [SAR 1:1 DAR 1:1], q=-1--1, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx264)
Press [q] to stop, [?] for help
frame= 1500 fps=179 q=-1.0 Lsize=     866kB time=00:00:59.92 bitrate= 118.4kbits/s
video:866kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.000000%
[libx264 @ 0000000006100320] frame I:26    Avg QP:14.54  size:  1289
[libx264 @ 0000000006100320] frame P:354   Avg QP:20.48  size:  1824
[libx264 @ 0000000006100320] frame B:1120  Avg QP:19.62  size:   186
[libx264 @ 0000000006100320] consecutive B-frames: 11.3%  1.3%  8.0%  4.0%  5.0%  4.0% 14.0% 13.3% 39.0%
[libx264 @ 0000000006100320] mb I  I16..4: 52.5% 44.9%  2.7%
[libx264 @ 0000000006100320] mb P  I16..4:  0.8%  0.5%  0.8%  P16..4:  9.9%  2.9%  8.4%  1.7%  1.4%    skip:73.7%
[libx264 @ 0000000006100320] mb B  I16..4:  0.2%  0.0%  0.0%  B16..8:  1.6%  0.3%  0.2%  direct: 1.0%  skip:96.6%  L0:54.2% L1:38.2% BI: 7.6%
[libx264 @ 0000000006100320] 8x8 transform intra:37.1% inter:26.0%
[libx264 @ 0000000006100320] direct mvs  spatial:99.3% temporal:0.7%
[libx264 @ 0000000006100320] coded y,uvDC,uvAC intra: 7.9% 0.9% 0.8% inter: 1.0% 1.4% 0.4%
[libx264 @ 0000000006100320] i16 v,h,dc,p: 89%  7%  3%  0%
[libx264 @ 0000000006100320] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 59%  2% 32%  0%  0%  0%  0%  4%  3%
[libx264 @ 0000000006100320] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 16% 27%  2%  2%  2%  1%  1%  2%
[libx264 @ 0000000006100320] i8c dc,h,v,p: 98%  1%  1%  0%
[libx264 @ 0000000006100320] Weighted P-Frames: Y:8.2% UV:0.0%
[libx264 @ 0000000006100320] ref P L0: 76.3%  7.7%  6.2%  4.4%  1.0%  0.8%  0.5%  0.2%  0.6%  0.4%  0.0%  0.0%  0.8%  0.3%  0.5%  0.2%
[libx264 @ 0000000006100320] ref B L0: 84.6%  8.5%  3.1%  2.4%  0.3%  0.7%  0.2%  0.0%  0.0%  0.0%  0.1%  0.0%  0.0%  0.0%  0.1%
[libx264 @ 0000000006100320] ref B L1: 94.8%  5.2%
[libx264 @ 0000000006100320] kb/s:118.28

Code: Select all

$ ./ffmpeg.exe -f lavfi -i mptestsrc -i c1.hevc -to 60 -filter_complex [0:v][1:v]psnr[out] -map [out] -f null NUL
ffmpeg version 2.1.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 13 2014 19:30:46 with gcc 4.8.2 (x86_64-posix-seh, Built by MinGW-W64 project)
  configuration: --target-os=mingw32 --enable-lto --disable-shared --enable-static --prefix=/mingw64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libopus --enable-libspeex --enable-bzlib --enable-zlib --enable-frei0r --enable-libgsm --enable-gpl --extra-cflags='-DPTW32_STATIC_LIB -DLIBTWOLAME_STATIC' --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvo-aacenc --enable-libschroedinger --enable-libbluray --enable-libxavs --enable-libsoxr --enable-libfreetype --enable-fontconfig --enable-libass --enable-libopenjpeg --enable-avisynth --enable-libtwolame --enable-libilbc --enable-libcaca --enable-libmodplug --enable-avresample --enable-libcdio --disable-w32threads --enable-gnutls --enable-libvidstab --enable-libnut --enable-dxva2 --enable-opencl --enable-libwebp --enable-opengl --enable-libfaac --enable-librtmp --extra-libs=-lstdc++ --disable-runtime-cpudetect
  libavutil      52. 63.101 / 52. 63.101
  libavcodec     55. 52.101 / 55. 52.101
  libavformat    55. 32.100 / 55. 32.100
  libavdevice    55.  9.100 / 55.  9.100
  libavfilter     4.  1.102 /  4.  1.102
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'mptestsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Input #1, hevc, from 'c1.hevc':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: hevc (Main), yuv420p(tv), 512x512, 25 fps, 25 tbr, 1200k tbn, 25 tbc
Output #0, null, to 'NUL':
  Metadata:
    encoder         : Lavf55.32.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k tbn, 25 tbc (default)
Stream mapping:
  Stream #0:0 (rawvideo) -> psnr:main
  Stream #1:0 (hevc) -> psnr:reference
  psnr -> Stream #0:0 (rawvideo)
Press [q] to stop, [?] for help
[null @ 0000000002c8f080] Encoder did not produce proper pts, making some up.
frame= 1500 fps=1107 q=0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A
video:141kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead -100.015278%
[Parsed_psnr_0 @ 000000000011fd60] PSNR average:24.89 min:10.30 max:inf

Code: Select all

$ ./ffmpeg.exe -f lavfi -i mptestsrc -i c1.h264 -to 60 -filter_complex [0:v][1:v]psnr[out] -map [out] -f null NUL
ffmpeg version 2.1.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 13 2014 19:30:46 with gcc 4.8.2 (x86_64-posix-seh, Built by MinGW-W64 project)
  configuration: --target-os=mingw32 --enable-lto --disable-shared --enable-static --prefix=/mingw64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libopus --enable-libspeex --enable-bzlib --enable-zlib --enable-frei0r --enable-libgsm --enable-gpl --extra-cflags='-DPTW32_STATIC_LIB -DLIBTWOLAME_STATIC' --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvo-aacenc --enable-libschroedinger --enable-libbluray --enable-libxavs --enable-libsoxr --enable-libfreetype --enable-fontconfig --enable-libass --enable-libopenjpeg --enable-avisynth --enable-libtwolame --enable-libilbc --enable-libcaca --enable-libmodplug --enable-avresample --enable-libcdio --disable-w32threads --enable-gnutls --enable-libvidstab --enable-libnut --enable-dxva2 --enable-opencl --enable-libwebp --enable-opengl --enable-libfaac --enable-librtmp --extra-libs=-lstdc++ --disable-runtime-cpudetect
  libavutil      52. 63.101 / 52. 63.101
  libavcodec     55. 52.101 / 55. 52.101
  libavformat    55. 32.100 / 55. 32.100
  libavdevice    55.  9.100 / 55.  9.100
  libavfilter     4.  1.102 /  4.  1.102
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'mptestsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Input #1, h264, from 'c1.h264':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: h264 (High), yuv420p, 512x512 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, null, to 'NUL':
  Metadata:
    encoder         : Lavf55.32.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 512x512 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k tbn, 25 tbc (default)
Stream mapping:
  Stream #0:0 (rawvideo) -> psnr:main
  Stream #1:0 (h264) -> psnr:reference
  psnr -> Stream #0:0 (rawvideo)
Press [q] to stop, [?] for help
[null @ 00000000028718c0] Encoder did not produce proper pts, making some up.
frame= 1500 fps=0.0 q=0.0 Lsize=N/A time=00:01:00.00 bitrate=N/A
video:141kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead -100.015278%
[Parsed_psnr_0 @ 00000000066d1040] PSNR average:55.59 min:45.22 max:inf

Ajaja
Posts: 69
Joined: Fri Mar 08, 2013 2:00 pm

Re: H.265 with x265

Post by Ajaja » Fri Feb 14, 2014 6:52 pm

Rebuilt from latest git. Something was changed. No more warnings. Testing PSNR...

Ajaja
Posts: 69
Joined: Fri Mar 08, 2013 2:00 pm

Re: H.265 with x265

Post by Ajaja » Fri Feb 14, 2014 7:12 pm

Yes! Problem solved in latest ffmpegs commits. It still slow as hell (with veryslow preset), but quality is amaizing now. Medium preset with ABR gives little better PSNR than libx264's veryslow ABR at the same encoding speed.

User avatar
Zeranoe
Site Admin
Posts: 702
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: H.265 with x265

Post by Zeranoe » Sat Feb 15, 2014 8:12 am

x265 (H.265) support has been added to the builds. Please let me know if there are any issues.

interlacer
Posts: 4
Joined: Mon Feb 17, 2014 8:41 pm

Re: H.265 with x265

Post by interlacer » Mon Feb 17, 2014 9:02 pm

I'm quite excited about H.265 in ffmpeg and would like to move my libx264 command lines to libx265.

Both Saturday's and today's 32bit builds (static as well as shared) crash instantaneously (after printing the message "Press [q] to stop, [?] for help" and ~600 bytes written).

Command line:

Code: Select all

ffmpeg-20140217-git-38a08e0-win32-shared\bin\ffmpeg.exe 
   -i MPEG2VIDEO.MPG
   -loglevel verbose 
   -c:v libx265
   -preset veryfast
   -x265-params crf=25
   -c:a libvo_aacenc
   -ab 128k
   -ar 48000
   -ac 2
   -async 2  
   -y 
   H265.MKV
(similar command line for libx264 works fine as in older releases).

System is Win XP/SP3.

Any clues?

User avatar
Zeranoe
Site Admin
Posts: 702
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: H.265 with x265

Post by Zeranoe » Tue Feb 18, 2014 5:14 pm

Thanks for the feedback. I will update the x265 code in the hopes that they fixed it already upstream.

Could you also provide the full output of:

Code: Select all

ffmpeg -v 9 -loglevel 99 -i MPEG2VIDEO.MPG -loglevel -c:v libx265 -preset veryfast -x265-params crf=25 -c:a libvo_aacenc -ab 128k -ar 48000 -ac 2 -async 2 -y H265.MKV
Also, you might want to use the internal AAC encode instead of vo. See http://trac.ffmpeg.org/wiki/GuidelinesHighQualityAudio for more information.

Finally, you might want to try running that command from within ff-prompt.bat, which is included in the builds.

interlacer
Posts: 4
Joined: Mon Feb 17, 2014 8:41 pm

Re: H.265 with x265

Post by interlacer » Thu Feb 20, 2014 9:02 am

The full output of today's build up to the crash

Code: Select all

c:/temp/tmp/ffmpeg-20140220-git-916a792-win32-shared/bin/ffmpeg.exe -i "MPEG2VIDEO.MPG"   -loglevel 99 -c:v libx265 -preset veryfast -x265-params crf=25  -c:a eac3 -ab 128k -ar 48000 -ac 2 -async 2   -y "H265.mkv"  2>&1 > 265.log
ffmpeg version N-60761-g916a792 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 19 2014 22:04:40 with gcc 4.8.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 65.100 / 52. 65.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  1.103 /  4.  1.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'MPEG2VIDEO.MPG'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx265'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'veryfast'.
Reading option '-x265-params' ... matched as AVOption 'x265-params' with argument 'crf=25'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'eac3'.
Reading option '-ab' ... matched as AVOption 'ab' with argument '128k'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '48000'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '2'.
Reading option '-async' ... matched as option 'async' (audio sync method) with argument '2'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'H265.mkv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument 99.
Applying option async (audio sync method) with argument 2.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file MPEG2VIDEO.MPG.
Successfully parsed a group of options.
Opening an input file: MPEG2VIDEO.MPG.
[mpeg @ 0003b7c0] Format mpeg probed with size=8192 and score=52
[mpeg @ 0003b7c0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
[mpeg @ 0003b7c0] probing stream 0 pp:2500
[mpeg @ 0003b7c0] Probe with size=2015, packets=1 detected mpegvideo with score=25
[mpeg @ 0003b7c0] probed stream 0
[mpeg @ 0003b7c0] max_analyze_duration 5000000 reached at 5000000 microseconds
[mpeg @ 0003b7c0] After avformat_find_stream_info() pos: 0 bytes read:2838672 seeks:2 frames:328
Input #0, mpeg, from 'MPEG2VIDEO.MPG':
  Duration: 00:00:27.70, start: 0.135167, bitrate: 4182 kb/s
    Stream #0:0[0x1e0], 127, 1/90000: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], 1/50, max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1c0], 201, 1/90000: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
Successfully opened the file.
Parsing a group of options: output file H265.mkv.
Applying option c:v (codec name) with argument libx265.
Applying option c:a (codec name) with argument eac3.
Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
Applying option ac (set number of audio channels) with argument 2.
Successfully parsed a group of options.
Opening an output file: H265.mkv.
Successfully opened the file.
detected 2 logical cores
[graph 0 input from stream 0:0 @ 00b66fa0] Setting 'video_size' to value '720x576'
[graph 0 input from stream 0:0 @ 00b66fa0] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 00b66fa0] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:0 @ 00b66fa0] Setting 'pixel_aspect' to value '64/45'
[graph 0 input from stream 0:0 @ 00b66fa0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 00b66fa0] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 00b66fa0] w:720 h:576 pixfmt:yuv420p tb:1/90000 fr:25/1 sar:64/45 sws_param:flags=2
[format @ 00d15220] compat: called with args=[yuv420p]
[format @ 00d15220] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 00b64020] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[graph 1 input from stream 0:1 @ 00037a60] Setting 'time_base' to value '1/48000'
[graph 1 input from stream 0:1 @ 00037a60] Setting 'sample_rate' to value '48000'
[graph 1 input from stream 0:1 @ 00037a60] Setting 'sample_fmt' to value 's16p'
[graph 1 input from stream 0:1 @ 00037a60] Setting 'channel_layout' to value '0x3'
[graph 1 input from stream 0:1 @ 00037a60] tb:1/48000 samplefmt:s16p samplerate:48000 chlayout:0x3
-async is forwarded to lavfi similarly to -af aresample=async=2:min_hard_comp=0.100000:first_pts=0.
[graph 1 aresample for input stream 0:1 @ 00d14480] Setting 'async' to value '2'
[graph 1 aresample for input stream 0:1 @ 00d14480] Setting 'min_hard_comp' to value '0.100000'
[graph 1 aresample for input stream 0:1 @ 00d14480] Setting 'first_pts' to value '0'
[audio format for output stream 0:1 @ 00d14660] Setting 'sample_fmts' to value 'fltp'
[audio format for output stream 0:1 @ 00d14660] Setting 'sample_rates' to value '48000'
[audio format for output stream 0:1 @ 00d14660] Setting 'channel_layouts' to value '0x3'
[AVFilterGraph @ 00b9cfa0] query_formats: 5 queried, 12 merged, 0 already done, 0 delayed
[graph 1 aresample for input stream 0:1 @ 00d14480] ch:2 chl:stereo fmt:s16p r:48000Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz
x265 [info]: using cpu capabilities: MMX2 SSE SSE2Fast SSSE3 SSE4.1 Cache64
x265 [info]: Main profile, Level-3 (Main tier)
x265 [info]: WPP streams / pool / frames         : 18 / 2 / 1
x265 [info]: CU size                             : 32
x265 [info]: Max RQT depth inter / intra         : 1 / 1
x265 [info]: ME / range / subpel / merge         : hex / 57 / 1 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 15 / 4 / 0
x265 [info]: b-pyramid / weightp / refs          : 1 / 1 / 1
x265 [info]: Rate Control / AQ-Strength / CUTree : CRF-25.0 / 1.0 / 0
x265 [info]: tools: cfm esd rd=3 lft sao-lcu sign-hide 
Output #0, matroska, to 'H265.mkv':
  Metadata:
    encoder         : Lavf55.33.100
    Stream #0:0, 0, 1/1000: Video: hevc (libx265), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 1/25, q=2-31, 200 kb/s, 1k tbn, 25 tbc
    Stream #0:1, 0, 1/1000: Audio: eac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> libx265)
  Stream #0:1 -> #0:1 (mp2 -> eac3)
Press [q] to stop, [?] for help
Oh, and I looked at "Audio Guidelines" and changed the audio encoder.

Post Reply