wang-bin / QtAV

A cross-platform multimedia framework based on Qt and FFmpeg. 基于Qt和FFmpeg的跨平台高性能音视频播放框架. Recommand to use new sdk https://github.com/wang-bin/mdk-sdk
http://qtav.org
3.94k stars 1.5k forks source link

examples/simpletranscode crashes when audio is enabled #784

Closed kuanyui closed 7 years ago

kuanyui commented 7 years ago

I try to compile examples/simpletranscode on Windows 7 / FFMpeg 3.1.5 / Qt 5.7 MinGW with latest QtAV ( ac85fef), but it always crashs (segmentation fault) unless disable audio with -an:

        avt.sourcePlayer()->setAudioStream(-1);

After disabling audio, the file is transcoded successfully.

Update: I found avt.sourcePlayer()->audioStreamCount() is 0, how may I find where's the problem?

The following is a log with set QTAV_LOG=all before it crashed, when audio is enabled:

QtAV simpletranscode

./simpletranscode -i infile -o outfile [-async] [-c:v video_codec (default: libx264)] [-hwdev dev] [-f format] [-an] [-ss HH:mm:ss.z]
-an: disable audio
examples:
 ./simpletranscode -i test.mp4 -o /tmp/test-%05d.png -f image2 -c:v png
 ./simpletranscode -i test.mp4 -o /tmp/bbb%04d.ts -f segment
 ./simpletranscode -i test.mp4 -o /tmp/test.mkv

QString::arg: Argument missing: /tmp/, index.m3u8
parse finished

file =============> "C:\\Users\\hiroko\\Desktop\\Wildlife.wmv"
outFile ==========> "C:\\Users\\hiroko\\Desktop\\avtranscode_audio.mp4"
QtAV 1.11.0(Dec 14 2016, 15:11:12)
Multimedia framework base on Qt and FFmpeg.
Distributed under the terms of LGPLv2.1 or later.
Shanghai University->S3 Graphics->Deepin, Shanghai, ChinaCopyright (C) 2012-2016 Wang Bin (aka. Lucas Wang) wbsecg1@gmail.com
Donate: http://qtav.org/donate.html
Source: https://github.com/wang-bin/QtAV
Home page: http://qtav.org
QtAV 1.11.0(Dec 14 2016, 15:11:12)
Multimedia framework base on Qt and FFmpeg.
Distributed under the terms of LGPLv2.1 or later.
Shanghai University->S3 Graphics->Deepin, Shanghai, ChinaCopyright (C) 2012-2016 Wang Bin (aka. Lucas Wang) wbsecg1@gmail.com
Donate: http://qtav.org/donate.html
Source: https://github.com/wang-bin/QtAV
Home page: http://qtav.org
"Build with Qt-5.7.0"
"FFmpeg/Libav configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib"
"Build with avutil-55.28.100"
"Build with avcodec-57.48.101"
"Build with avformat-57.41.100"
"Build with avfilter-6.47.100"
"Build with avdevice-57.0.101"
"Build with swresample-2.1.100"
"Build with swscale-4.1.100"
Registered audio backends:  ("XAudio2", "DirectSound", "null")
"XAudio2_9"
"Cannot load library XAudio2_9: 找不到指定的模組。"
"XAudio2_8"
"Cannot load library XAudio2_8: 找不到指定的模組。"
"XAudio2_7"
"Build with XAudio2 from DXSDK"
"Try inline function 'XAudio2Create' from DXSDK"
"xaudio2: 0x3180650"
"source_voice: 0x0, master: 0x0"
("a64multi", "a64multi5", "alias_pix", "amv", "apng", "asv1", "asv2", "avrp", "avui", "ayuv", "bmp", "cinepak", "cljr", "dnxhd", "dpx", "dvvideo", "ffv1", "ffvhuff", "flashsv", "flashsv2", "flv", "gif", "h261", "h263", "h263p", "hap", "huffyuv", "jpeg2000", "jpegls", "ljpeg", "mjpeg", "mpeg1video", "mpeg2video", "mpeg4", "msmpeg4v2", "msmpeg4", "msvideo1", "pam", "pbm", "pcx", "pgm", "pgmyuv", "png", "ppm", "prores", "prores_aw", "prores_ks", "qtrle", "r10k", "r210", "rawvideo", "roqvideo", "rv10", "rv20", "sgi", "snow", "sunrast", "svq1", "targa", "tiff", "utvideo", "v210", "v308", "v408", "v410", "vc2", "wrapped_avframe", "wmv1", "wmv2", "xbm", "xface", "xwd", "y41p", "yuv4", "zlib", "zmbv", "libopenjpeg", "libschroedinger", "libtheora", "libvpx", "libvpx-vp9", "libwebp", "libx264", "libx264rgb", "libx265", "libxavs", "libxvid", "libopenh264", "h264_nvenc", "h264_qsv", "nvenc", "nvenc_h264", "nvenc_hevc", "hevc_nvenc", "hevc_qsv", "mpeg2_qsv")
QObject::connect: No such signal QtAV::AudioEncodeFilter::requestToEncode(QtAV::AudioFrame)
=============> AVTranscoder::start()

"framerate: -1.000/0.000"
=============> AVPlayer::play()

Loading  QVariant(QString, "C:\\Users\\hiroko\\Desktop\\Wildlife.wmv")  ...
"all closed and reseted"
"avformat_open_input: d->format_ctx:'0x5e1000', url:'C:\\Users\\hiroko\\Desktop\\Wildlife.wmv'..."
"avformat_open_input: url:'C:\\Users\\hiroko\\Desktop\\Wildlife.wmv' ret:0"
"avfmtctx.flags: 513, iformat.flags"
"invalid index 0 (valid is 0~0) for stream type 2."
"notify_interval: 250"
"stream: 0, duration=30093 (30093 ms), time_base=0.001000"
"codec: wmav2(Windows Media Audio 2)"
"stream: 1, duration=30093 (30093 ms), time_base=0.001000"
"codec: vc1(SMPTE VC-1)"
"has audio"
"QtAV::AudioDecoderFFmpeg thread type: Single, count: 1"
AudioOutput format:  QtAV::AudioFormat(44100Hz, 4Bytes, channelCount:2, channelLayout: "stereo", sampleFormat: "flt") ; requested:  QtAV::AudioFormat(44100Hz, 4Bytes, channelCount:2, channelLayout: "stereo", sampleFormat: "fltp")
"src audio parameters 'channel layout(or channels), sample rate and sample format must be set before initialize resampler"
"new audio thread"
"demux thread setAudioThread"
"output not changed: 0x5d5488"
"set AVThread output"
"stream: 0, duration=30093 (30093 ms), time_base=0.001000"
"codec: wmav2(Windows Media Audio 2)"
"**********trying video decoder: FFmpeg..."
"QtAV::VideoDecoderFFmpeg thread type: Single, count: 1"
"**************Video decoder found:0x4039450"
"setCapture 0x5d6058"
"stream: 1, duration=30093 (30093 ms), time_base=0.001000"
"codec: vc1(SMPTE VC-1)"
"auto select clock: audio > external"
"Using AudioClock"
"Clock initial value: 0.000000"
"Starting audio thread..."
"Starting video thread..."
"get av queue a/v thread = 0x5d5740 0x4039468"
"onSourceStarted framerate: 0.000/29.970"
"use first supported sample rate: 96000"
"no frame could be decompressed: Error number 4515 occurred 0/4515"
"AVClock started!!!!!!!!"
"use first supported sample format: 8"
"invalid video frame from decoder. undecoded data size: 0"
"channel layout and supported channel layout are not set. use stereo"
"prefer limited yuv range"
QtAV::AudioFormat(96000Hz, 4Bytes, channelCount:2, channelLayout: "stereo", sampleFormat: "fltp")
"use first supported pixel format '0' for sw encoder"
"encoders are not readly a:1 v:0"
"size: 1280x720 tbc: 0.033367=1001/30000"
"swr speed=1.00"
[FFmpeg:libx264] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT
"out: {cl: 3, fmt: flt, freq: 44100}"
"in {cl: 3, fmt: fltp, freq: 44100}"
[FFmpeg:libx264] profile High, level 3.1
"swr speed=1.00"
"dict: segment_list=>/tmp/"
"out: {cl: 3, fmt: fltp, freq: 96000}"
"dict: segment_time=>4"
"in {cl: 3, fmt: fltp, freq: 44100}"
"dict: segment_list_size=>
kuanyui commented 7 years ago

I originally used a wmv file as input. It doesn't crash after replacing it with mp4 files.