Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#10067 closed defect (invalid)

FFmpeg nightly creates weird w64 output

Reported by: pcroland Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I develop a tool that uses FFmpeg: https://github.com/pcroland/deew
It creates w64 temp files for the Dolby Encoding Engine.
Some users reported that it doesn't work with new versions of ffmpeg.
I used a .wav extension for these files because DEE only works with that for some reason. I had to change that to w64 because new version of FFmpeg doesn't even start to write the output with .wav:

❯ ffmpeg-master -y -drc_scale 0 -i orig.w64 -map 0:a:0 -c pcm_s16le -filter_complex "[a:0]pan=7.1|c0=c0|c1=c1|c2=c2|c3=c3|c4=c6|c5=c7|c6=c4|c7=c5" -rf64 always test-master.wav
ffmpeg version N-109185-g14c6093528-20221123 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20221123
  libavutil      57. 43.100 / 57. 43.100
  libavcodec     59. 54.100 / 59. 54.100
  libavformat    59. 34.102 / 59. 34.102
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 50.101 /  8. 50.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
[w64 @ 0x7fffde2bc740] Estimating duration from bitrate, this may be inaccurate
Input #0, w64, from 'orig.w64':
  Duration: 00:00:30.00, bitrate: 6144 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 7.1, s16, 6144 kb/s
Codec AVOption drc_scale (percentage of dynamic range compression to apply) specified for input file #0 (orig.w64) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some decoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 (pcm_s16le) -> pan:default (graph 0)
  pan:default (graph 0) -> Stream #0:0 (pcm_s16le)
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[Parsed_pan_0 @ 0x7fffde3093c0] Pure channel mapping detected: 0 1 2 3 6 7 4 5
[wav @ 0x7fffde305100] WAVE files have exactly one stream
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
Conversion failed!

When I change the extension from .wav to .w64 it writes an output, but it's twice the length and size, VLC can't play it and it's really choppy in mpv.

Here are some sample files:
orig.w64: https://envs.sh/QJx.w64
test.wav: https://envs.sh/QJ-.wav
test-master.w64: https://envs.sh/QoD.w64

test.wav was created with:

❯ ffmpeg -y -drc_scale 0 -i orig.w64 -map 0:a:0 -c pcm_s16le -filter_complex "[a:0]pan=7.1|c0=c0|c1=c1|c2=c2|c3=c3|c4=c6|c5=c7|c6=c4|c7=c5" -rf64 always test.wav

❯ ffmpeg -version
ffmpeg version 5.1.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

test-master.w64 was created with:

❯ ffmpeg-master -y -drc_scale 0 -i orig.w64 -map 0:a:0 -c pcm_s16le -filter_complex "[a:0]pan=7.1|c0=c0|c1=c1|c2=c2|c3=c3|c4=c6|c5=c7|c6=c4|c7=c5" -rf64 always test-master.w64

❯ ffmpeg-master -version
ffmpeg version N-109185-g14c6093528-20221123 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20221123
libavutil      57. 43.100 / 57. 43.100
libavcodec     59. 54.100 / 59. 54.100
libavformat    59. 34.102 / 59. 34.102
libavdevice    59.  8.101 / 59.  8.101
libavfilter     8. 50.101 /  8. 50.101
libswscale      6.  8.112 /  6.  8.112
libswresample   4.  9.100 /  4.  9.100
libpostproc    56.  7.100 / 56.  7.100

Change History (15)

comment:1 by Elon Musk, 3 years ago

Resolution: invalid
Status: newclosed

-rf64 flag for w64 container does not makes sense.
wav can store only one stream

your filtergraph/command is thus invalid in both cases.

comment:2 by pcroland, 3 years ago

Resolution: invalid
Status: closedreopened

It does makes sense. DEE only worked with files created with -rf64 always. Currently with new versions of ffmpeg there's no way to create a temp file for DEE that can be used.

If I remove -rf64 always the output still can't be played with VLC and it's choppy in mpv. If I remove the filter_complex too then mpv plays the output fine but VLC still can't play it. Something is definitely wrong.

Last edited 3 years ago by pcroland (previous) (diff)

comment:3 by Elon Musk, 3 years ago

Resolution: invalid
Status: reopenedclosed

Nothing is wrong with implementation. Just w64 should not allow more than >1 stream muxing.

You never provided full output logs, so bug is still invalid.

comment:4 by pcroland, 3 years ago

Resolution: invalid
Status: closedreopened

comment:5 by pcroland, 3 years ago

I provided samples, commands and everything other than pointing to the exact commit that breaks w64. I didn't try to mux multiple streams into the w64. I'll try to find the exact version where it breaks, if that helps.

comment:6 by pcroland, 3 years ago

I tried BtbN's Linux builds, and the last working version was 09-30 and it doesn't work in 10-31. I also tried gyan.dev's Windows builds, and the last working version was 10-13 and it doesn't work in 11-21. So the breaking change happened somewhere between 10.13. and 10.31.

Edit: I tried AnimMouse/ffmpeg-autobuild builds and 10-17. worked fine and it broke with 10-26.

Last edited 3 years ago by pcroland (previous) (diff)

comment:7 by Carl Eugen Hoyos, 3 years ago

Keywords: wav w64 pcm removed
Priority: importantnormal
Resolution: invalid
Status: reopenedclosed

comment:8 by pcroland, 3 years ago

Keywords: wav w64 pcm added
Priority: normalimportant
Resolution: invalid
Status: closedreopened

comment:9 by pcroland, 3 years ago

Please don't just close it, it's a legit issue.

comment:10 by Carl Eugen Hoyos, 3 years ago

Keywords: wav w64 pcm removed
Priority: importantnormal
Resolution: fixed
Status: reopenedclosed
Version: git-masterunspecified

No. Your report is so flawed that you cannot get help here.
Please ask all usage questions on the user mailing list, this is a bug tracker.

comment:11 by kepstin, 3 years ago

After discussion on IRC, it looks like this was a usage problem - both a "-map" option was specified to select a stream from the input file, and a "-filter_complex" option was specified with an implicit filter output pad, resulting in two output streams to be included in the file - which isn't permitted in the requested output format.

It seems like in previous ffmpeg versions, the -map option was being silently ignored, and the filter output was used instead. This has been fixed in newer ffmpeg versions.

Reporter needs to either:

  • fix their usage of -filter_complex and -map options to correctly select the desired tracks
  • or use -af instead of -filter_complex

then their ffmpeg commands will work with current ffmpeg *and* older ffmpeg, and will avoid the confusing/broken old map behaviour.

comment:12 by Balling, 3 years ago

-drc_scale 0 is used on eac3, or maybe Dolby E in WAV, not for PCM in wav. LOL

change the extension from .wav to .w64 it writes an output, but it's twice the length and size

No, it is not, w64 is the same size as wav, only header is different.

-c pcm_s16le

That is not enough to preserve EAC3.

Last edited 3 years ago by Balling (previous) (diff)

comment:13 by pcroland, 3 years ago

Balling: -drc_scale 0 is added for every command (not based on input), FFmpeg ignores it if there's no DRC, I guess this won't get removed so it exits when there's no DRC.

comment:14 by Carl Eugen Hoyos, 3 years ago

Resolution: fixedinvalid
Note: See TracTickets for help on using tickets.