set a dumped extradata(h264) manually got ‘exit code 3221226356’ in sublime text 3
Created by: xuqinghan
IMPORTANT: Be sure to replace all template sections {{ like this }} or your issue may be discarded.
Overview
How to set a dumped extradata correctly?
I just follow the example in Decoding raw packets without streams using codecs that needs extradata
1 get h264 codec_context from a flv file ,
2 dump and read the extradata,
3 set to another codec_new
import av
container = av.open('xb2_kos.flv')
# Find index of the video stream
video_stream_index = 0
for index, stream in enumerate(container.streams):
if isinstance(stream, av.video.stream.VideoStream):
video_stream_index = index
break
print('video_stream_index', video_stream_index)
codec_name = container.streams[video_stream_index].codec_context.name
print('codec_name', codec_name)
codec_origin = container.streams[video_stream_index].codec_context
extradata = codec_origin.extradata
#bytes
print('extradata', extradata)
codec_new = av.codec.CodecContext.create(codec_name, 'r')
codec_new.extradata = extradata
with open('./dumps/h264_extradata.dump', 'wb') as f:
f.write(extradata)
print(extradata)
with open('./dumps/h264_extradata.dump', 'rb') as f:
extradata2 = f.read()
#print(extradata2)
# exit code 3221226356
codec_new.extradata = extradata2
sometimes with 'print(extradata2)', print no error;
extradata b'\x01d\x00)\xff\xe1\x00\x19gd\x00)\xac\xd9@P\x05\xba\x10\x00\x00\x03\x00\x10\x00\x00\x03\x03\x00\xf1\x83\x19
\x01\x00\x05h\xeb\xec\xf2<' b'\x01d\x00)\xff\xe1\x00\x19gd\x00)\xac\xd9@P\x05\xba\x10\x00\x00\x03\x00\x10\x00\x00\x03\x03\x00\xf1\x83\x19
\x01\x00\x05h\xeb\xec\xf2<' b'\x01d\x00)\xff\xe1\x00\x19gd\x00)\xac\xd9@P\x05\xba\x10\x00\x00\x03\x00\x10\x00\x00\x03\x03\x00\xf1\x83\x19`\x01\x00\x05h\xeb\xec\xf2<' [Finished in 0.8s]
but usually print no error but editor print
video_stream_index 0 codec_name h264 extradata b'\x01d\x00)\xff\xe1\x00\x19gd\x00)\xac\xd9@P\x05\xba\x10\x00\x00\x03\x00\x10\x00\x00\x03\x03\x00\xf1\x83\x19
\x01\x00\x05h\xeb\xec\xf2<' b'\x01d\x00)\xff\xe1\x00\x19gd\x00)\xac\xd9@P\x05\xba\x10\x00\x00\x03\x00\x10\x00\x00\x03\x03\x00\xf1\x83\x19
\x01\x00\x05h\xeb\xec\xf2<' [Finished in 0.7s with exit code 3221226356] [shell_cmd: python -u "D:\dev\flv-extract-audio-and-video\test_get_extra_data_for_av_codec.py"] [dir: D:\dev\flv-extract-audio-and-video] [path: D:\Program Files (x86)\CambridgeSoft\ChemOffice2015\ChemScript\Lib;C:\Program Files\Python38\Scripts;C:\Program Files\Python38;C:\Users\xuqinghan\AppData\Roaming\Python\Python38\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files\dotnet;D:\lib\ffmpeg-4.3.1-win64-shared\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;D:\soft\dev\docker\LxRunOffline-v3.5.0-msvc;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\PowerShell\7;C:\Users\xuqinghan\AppData\Local\Microsoft\WindowsApps;C:\Users\xuqinghan\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\xuqinghan\AppData\Roaming\npm;C:\Users\xuqinghan.dotnet\tools]
even if 'codec_new.extradata = extradata' in an function, it also cause function exit with [ exit code 3221226356], and not run other sentance after the caller.
Expected behavior
{{ A clear and concise description of what you expected to happen. }}
Actual behavior
{{ A clear and concise description of what actually happened. }}
Traceback:
{{ Include complete tracebacks if there are any exceptions. }}
Investigation
{{ What you did to isolate the problem. }}
Reproduction
{{ Steps to reproduce the behavior. If the problem is media specific, include a link to it. Only send media that you have the rights to. }}
Versions
- OS: {{ win10 x64 2004 }}
- PyAV runtime:
{{PyAV v8.0.2
git origin: git@github.com:PyAV-Org/PyAV
git commit: v8.0.2
library configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
library license: GPL version 3 or later
libavcodec 58. 54.100
libavdevice 58. 8.100
libavfilter 7. 57.100
libavformat 58. 29.100
libavutil 56. 31.100
libswresample 3. 5.100
libswscale 5. 5.100}}
- PyAV build:
{{ Complete output of `python setup.py config --verbose`. }}
- FFmpeg:
{{ ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.1 (GCC) 20200726
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100 }}
Research
I have done the following:
-
Checked the PyAV documentation -
Searched on Google -
Searched on Stack Overflow -
Looked through old GitHub issues -
Asked on PyAV Gitter -
... and waited 72 hours for a response.
Additional context
{{ Add any other context about the problem here. }}