Av1an icon indicating copy to clipboard operation
Av1an copied to clipboard

--encoder x265 produces mp4 data in x.mkv, and has no audio

Open shaneday opened this issue 3 years ago • 7 comments

I'm running in docker. The generated file is named x.mkv but contains mp4 data. And it is missing the audio track

$ docker run -v "$(pwd)":/videos --user $(id -u):$(id -g) -it --rm masterofzen/av1an:latest -i Zootopia-sample.mkv --encoder x265

$ file Zootopia-sample_x265.mkv Zootopia-sample_x265.mkv: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]

$ file Zootopia-sample_x264.mkv # all other encoders work fine, and contains audio Zootopia-sample_x264.mkv: Matroska data

$ mediainfo Zootopia-sample_x265.mkv General Complete name : Zootopia-sample_x265.mkv Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso6/iso2/mp41) File size : 105 MiB Duration : 5 min 0 s Overall bit rate : 2 936 kb/s Writing application : Lavf58.76.100 FileExtension_Invalid : braw mov mp4 m4v m4a m4b m4p m4r 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v

Video ID : 1 Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main 10@L4@Main Codec ID : hev1 Codec ID/Info : High Efficiency Video Coding Duration : 5 min 0 s Bit rate : 2 935 kb/s Width : 1 920 pixels Height : 808 pixels Display aspect ratio : 2.40:1 Frame rate mode : Constant Frame rate : 25.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 10 bits Bits/(Pixel*Frame) : 0.076 Stream size : 105 MiB (100%) Writing library : x265 3.4+28-419182243:[Linux][GCC 9.3.0][64 bit] 10bit Encoding settings : cpuid=1111039 / frame-threads=3 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x808 / interlace=0 / total-frames=234 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=21.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass Codec configuration box : hvcC

shaneday avatar Jun 15 '21 04:06 shaneday

@shaneday I think it's due the way hevc is processed. x265 only output hevc bitstream files (which cannot be directly processed into mkv) which later need to be remuxed to mp4 and after that to mkv. Somewhere in those steps your audio is lost(

master-of-zen avatar Jun 15 '21 05:06 master-of-zen

Can you try using --mkvmerge ? Also just curious, what's the reason that you use x265 and not AV1 with SVT?

Felixkruemel avatar Jun 25 '21 19:06 Felixkruemel

--mkvmerge doesn't seem to be available in the masterofzen/av1an Docker image, and trying to follow the build instructions I hit problems with vapoursynch. Is someone else able to try this please?

EDIT: --mkvmerge github home lists --mkvmerge, but av1an --help lists --concat mkvmerge. But using mkvmerge didn't solve it, still producing an mp4 format file.

Why x265, because it is still more compatable and resource friendly. Just checking CPU usage of playback of a 30 second clip AV1 eats about 5x more CPU cycles. I plan on doing laptop battery rundown tests playing H.265 vs AV1. If I get 1/5th play duration I'll be holding off converting my library.

shaneday avatar Jun 27 '21 06:06 shaneday

@shaneday Be sure to use the latest VLC or a very new MPV build for your playback-tests else it's not fair as Dav1d right now is pretty fast in development for x86 chips.

Felixkruemel avatar Jun 27 '21 18:06 Felixkruemel

--mkvmerge doesn't seem to be available in the masterofzen/av1an Docker image, and trying to follow the build instructions I hit problems with vapoursynch. Is someone else able to try this please?

which docker image are you using? It should be in all of them, try doing docker pull masterofzen/av1an:master Its not completely up to date with the latest commits because of x265/x264 failures though.

luigi311 avatar Jul 11 '21 04:07 luigi311

I was using the latest at the time, with image-id 52af74987729. It reports itself as version 0.1.0. Pulling the latest now gives me 26136d170109, still reports as 0.1.0.

Retrying the encode, it still produces an mp4 file names mkv.

To restate, I'm encoding with: $ docker run -v "$(pwd)":/videos --user $(id -u):$(id -g) -it --rm masterofzen/av1an:latest i Zootopia-sample.mkv --encoder x265 --concat mkvmerge -o Zoo-test-mkvmerge2.mkv

$ file Zoo-test-mkvmerge*.mkv Zoo-test-mkvmerge2.mkv: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003] Zoo-test-mkvmerge.mkv: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]

shaneday avatar Jul 12 '21 04:07 shaneday

I actually ran into a lot of issues with x265 in av1an. As a workaround, I encode video with av1an and then encode the audio with ffmpeg and then combine them with mkvmerge for my final mkv. This seems to fix the issue for me so I think it's just how av1an implements mkvmerge so I need to take a look at it. The only reason I did this was that I had massive stuttering with av1an encoding audio and combining it no matter what I did and it might be because of this mp4 issue.

file de_final_S02E*
de_final_S02E01.mkv: Matroska data
de_final_S02E02.mkv: Matroska data
de_final_S02E03.mkv: Matroska data
de_final_S02E04.mkv: Matroska data
de_final_S02E05.mkv: Matroska data
de_final_S02E06.mkv: Matroska data
de_final_S02E07.mkv: Matroska data
de_final_S02E08.mkv: Matroska data
de_final_S02E09.mkv: Matroska data
de_final_S02E10.mkv: Matroska data
de_final_S02E11.mkv: Matroska data
de_final_S02E12.mkv: Matroska data
de_final_S02E13.mkv: Matroska data
de_final_S02E14.mkv: Matroska data
de_final_S02E15.mkv: Matroska data
de_final_S02E16.mkv: Matroska data
de_final_S02E17.mkv: Matroska data
de_final_S02E18.mkv: Matroska data
de_final_S02E19.mkv: Matroska data
de_final_S02E20.mkv: Matroska data
de_final_S02E21.mkv: Matroska data
de_final_S02E22.mkv: Matroska data
de_final_S02E23.mkv: Matroska data
de_final_S02E24.mkv: Matroska data
de_final_S02E25.mkv: Matroska data

luigi311 avatar Jul 14 '21 08:07 luigi311