[FFmpeg-trac] #8365(avdevice:new): AVFoundation video input hangs on iOS 12.4
FFmpeg
trac at avcodec.org
Tue Nov 5 17:31:53 EET 2019
#8365: AVFoundation video input hangs on iOS 12.4
-------------------------------------+-------------------------------------
Reporter: ariankordi | Type: defect
Status: new | Priority: normal
Component: avdevice | Version: 4.2
Keywords: | Blocked By:
avfoundation ios hang |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
Attempting video capture from any camera with the AVFoundation device on
iOS 12.4 hangs ffmpeg. Capturing the microphone works fine, however.
Device is iPhone 6S (N71AP), I didn't test on any other iPhone or version.
iOS 11.2 SDK was used to compile, I can't compile on a Mac so I had to use
the Theos SDK from github.com/theos/sdks.
Output of `ffmpeg -f avfoundation -framerate 30 -pixel_format nv12 -i 0:`:
{{{
iPhone:~/FFmpeg-n4.2.1 mobile$ lldb ./ffmpeg_g
(lldb) target create "./ffmpeg_g"
Current executable set to './ffmpeg_g' (arm64).
(lldb) r -f avfoundation -framerate 30 -pixel_format nv12 -loglevel debug
-i 0:
Process 46644 launched: './ffmpeg_g' (arm64)
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with clang version 5.0.2
configuration: --enable-indev=avfoundation --enable-hwaccel=videotoolbox
--disable-debug --extra-cflags='-isysroot /User/iPhoneOS11.2.sdk' --extra-
ldflags='-isysroot /User/iPhoneOS11.2.sdk' --disable-asm
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument
'avfoundation'.
Reading option '-framerate' ... matched as AVOption 'framerate' with
argument '30'.
Reading option '-pixel_format' ... matched as AVOption 'pixel_format' with
argument 'nv12'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument '0:'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url 0:.
Applying option f (force format) with argument avfoundation.
Successfully parsed a group of options.
Opening an input file: 0:.
[avfoundation @ 0x140002200] 'Back Camera' opened
(^C)
Process 46644 stopped
* thread #1: tid = 0x3faa7, 0x000000020eccc0f4
libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread',
stop reason = signal SIGSTOP
frame #0: 0x000000020eccc0f4 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
-> 0x20eccc0f4 <+8>: ret
libsystem_kernel.dylib`mach_msg_overwrite_trap:
0x20eccc0f8 <+0>: movn x16, #0x1f
0x20eccc0fc <+4>: svc #0x80
0x20eccc100 <+8>: ret
(lldb) bt
* thread #1: tid = 0x3faa7, 0x000000020eccc0f4
libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread',
stop reason = signal SIGSTOP
* frame #0: 0x000000020eccc0f4 libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x000000020eccb5a0 libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x000000020f0cc120 CoreFoundation`__CFRunLoopServiceMachPort
+ 236
frame #3: 0x000000020f0c7030 CoreFoundation`__CFRunLoopRun + 1360
frame #4: 0x000000020f0c67c0 CoreFoundation`CFRunLoopRunSpecific + 436
frame #5: 0x0000000104622be4 ffmpeg_g`avf_read_header + 7636
frame #6: 0x00000001048ea330 ffmpeg_g`avformat_open_input + 740
frame #7: 0x0000000104603884 ffmpeg_g`open_input_file + 1408
frame #8: 0x0000000104603198 ffmpeg_g`open_files + 288
frame #9: 0x0000000104602f4c ffmpeg_g`ffmpeg_parse_options + 156
frame #10: 0x0000000104615020 ffmpeg_g`main + 204
frame #11: 0x000000020eb8a8e0 libdyld.dylib`start + 4
}}}
Trying again with microphone, this works:
{{{
(lldb) r -f avfoundation -loglevel debug -i :0
There is a running process, kill it and restart?: [Y/n] y
Process 46644 exited with status = 9 (0x00000009)
Process 46646 launched: './ffmpeg_g' (arm64)
...
[avfoundation @ 0x104003800] audio device 'iPhone Microphone' opened
[avfoundation @ 0x104003800] All info found
Input #0, avfoundation, from ':0':
Duration: N/A, start: 14092.105805, bitrate: 705 kb/s
Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 44100 Hz, mono, s16, 705
kb/s
Successfully opened the file.
At least one output file must be specified
Process 46646 exited with status = 1 (0x00000001)
(lldb) exit
}}}
Using another binary of version 4.1 yields the same issue:
{{{
(lldb) r -f avfoundation -framerate 30 -pixel_format nv12 -loglevel debug
-i 0:
Process 46658 launched: '/usr/local/bin/ffmpeg' (arm64)
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with clang version 6.0.0-1ubuntu2~16.04.1 (tags/RELEASE_600/final)
configuration: --enable-shared --enable-version3 --enable-pthreads
--enable-hardcoded-tables --enable-avresample --cross-prefix=aarch64
-apple-darwin17- --cc=aarch64-apple-darwin17-clang --enable-ffplay
--enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265 --enable-libxvid --enable-lzma --enable-libfdk-aac
--enable-libopenh264 --enable-openssl --enable-libssh --enable-nonfree
--arch=aarch64 --target-os=darwin --disable-sdl2
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument
'avfoundation'.
Reading option '-framerate' ... matched as AVOption 'framerate' with
argument '30'.
Reading option '-pixel_format' ... matched as AVOption 'pixel_format' with
argument 'nv12'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument '0:'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url 0:.
Applying option f (force format) with argument avfoundation.
Successfully parsed a group of options.
Opening an input file: 0:.
[avfoundation @ 0x14c003e00] 'Back Camera' opened
Process 46658 stopped
* thread #1: tid = 0x40506, 0x000000020eccc0f4
libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread',
stop reason = signal SIGSTOP
frame #0: 0x000000020eccc0f4 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
-> 0x20eccc0f4 <+8>: ret
libsystem_kernel.dylib`mach_msg_overwrite_trap:
0x20eccc0f8 <+0>: movn x16, #0x1f
0x20eccc0fc <+4>: svc #0x80
0x20eccc100 <+8>: ret
(lldb) bt
* thread #1: tid = 0x40506, 0x000000020eccc0f4
libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread',
stop reason = signal SIGSTOP
* frame #0: 0x000000020eccc0f4 libsystem_kernel.dylib`mach_msg_trap + 8
frame #1: 0x000000020eccb5a0 libsystem_kernel.dylib`mach_msg + 72
frame #2: 0x000000020f0cc120 CoreFoundation`__CFRunLoopServiceMachPort
+ 236
frame #3: 0x000000020f0c7030 CoreFoundation`__CFRunLoopRun + 1360
frame #4: 0x000000020f0c67c0 CoreFoundation`CFRunLoopRunSpecific + 436
frame #5: 0x000000010030393c
libavdevice.58.dylib`___lldb_unnamed_function5$$libavdevice.58.dylib +
4456
frame #6: 0x00000001007f0200 libavformat.58.dylib`avformat_open_input
+ 740
frame #7: 0x0000000100288da0 ffmpeg`___lldb_unnamed_function2$$ffmpeg
+ 1448
frame #8: 0x0000000100288684 ffmpeg`___lldb_unnamed_function1$$ffmpeg
+ 248
frame #9: 0x0000000100288460 ffmpeg`ffmpeg_parse_options + 156
frame #10: 0x000000010029a744 ffmpeg`main + 204
frame #11: 0x000000020eb8a8e0 libdyld.dylib`start + 4
(lldb) exit
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8365>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list