We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting to AAC with a time_base of Fraction(1, 1000) doesn't work
time_base
Fraction(1, 1000)
Conversion would work regardless of time_base
Reported length of the file is incorrect and the file doesn't play back correctly
If you scale the time_base and the pts/dts values by 8, then the conversion works
pts
dts
(NOTE: requires the second commit from #1180 to be able to do this)
Run the following with and observe the error:
python3 convert_to_aac_error.py audio_test_long.mkv output_bad.m4a
Then run with the adjustment and it will work:
python3 convert_to_aac_error.py audio_test_long.mkv output_good.m4a y
With this file: https://drive.google.com/file/d/1mlL51WHC4iiTa4ibiMsTNYNmjzV4005-/view?usp=sharing
import sys from fractions import Fraction import av def _main(): adjust = len(sys.argv) >= 4 and sys.argv[3] == "y" with av.open(sys.argv[1]) as in_container: in_stream = in_container.streams.audio[0] with av.open(sys.argv[2], "w") as out_container: print(in_stream.time_base, in_stream.codec_context.layout) out_stream = out_container.add_stream( "aac", rate=in_stream.rate, layout=in_stream.codec_context.layout.name ) num_frames = 0 num_packets = 0 for frame in in_container.decode(in_stream): num_frames += 1 if adjust: frame.pts *= 8 frame.dts *= 8 frame.time_base = Fraction(1, 8000) if num_frames == 1: print( type(frame), frame.sample_rate, frame.pts, frame.dts, frame.time_base, len(frame.planes), frame.planes[0].buffer_size, ) for packet in out_stream.encode(frame): num_packets += 1 out_container.mux(packet) print(num_frames, num_packets) for packet in out_stream.encode(None): num_packets += 1 out_container.mux(packet) print(num_packets) if __name__ == "__main__": _main()
PyAV v10.0.0 library configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared library license: GPL version 2 or later libavcodec 59. 37.100 libavdevice 59. 7.100 libavfilter 8. 44.100 libavformat 59. 27.100 libavutil 57. 28.100 libswresample 4. 7.100 libswscale 6. 7.100
ffmpeg
I have done the following:
ffmpeg has known issues with AAC output but this appears to be specific to PyAV because doing the conversion with ffmpeg directly works
PyAV
The text was updated successfully, but these errors were encountered:
Moved to maintained fork: WyattBlue#11
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Overview
Converting to AAC with a
time_base
ofFraction(1, 1000)
doesn't workExpected behavior
Conversion would work regardless of
time_base
Actual behavior
Reported length of the file is incorrect and the file doesn't play back correctly
Investigation
If you scale the
time_base
and thepts
/dts
values by 8, then the conversion works(NOTE: requires the second commit from #1180 to be able to do this)
Reproduction
Run the following with and observe the error:
Then run with the adjustment and it will work:
With this file:
https://drive.google.com/file/d/1mlL51WHC4iiTa4ibiMsTNYNmjzV4005-/view?usp=sharing
Versions
Installed from the branch in the mentioned PR
N/A using the OS libraries without
ffmpeg
itself being installedResearch
I have done the following:
Additional context
ffmpeg
has known issues with AAC output but this appears to be specific toPyAV
because doing the conversion withffmpeg
directly worksThe text was updated successfully, but these errors were encountered: