FFMPEG 안드로이드 HW 인코딩 (MediaCodec)
안녕하세요. 도정진입니다.
벌써 2월 20일이 되었네요. 시간이 너무 빠르게 흘러갑니다. 정신없이 흘러가네요.
작년 중순쯤에 안드로이드에서 MediaCodec 을 통한 하드웨어 인코딩을 할 수 있지 않을까? 하는 고민으로 정보 서칭을 하며 이렇게 시간이 흘러왔습니다.
FFMPEG 에서 mediacodec 을 Enable 하면 빌드가 가능하다는 것을 알고 있었지만, 당최 미디어 코덱에 관련한 글은 어디에도 보이지가 않았습니다.
실제로 카카오톡으로 영상을 전송할 경우 인코딩을 누가 담당하는지 모르겠습니다만, 저화질로 인코딩되어 전송된다는 점... 실제로는 서버에 전송하여 인코딩이 일어나는지는 정확히 모릅니다.
카메라 데이터를 받아서 동영상 파일로 저장하는 것 모두 안드로이드쪽 미디어코덱을 사용하는 것으로 알고 있습니다. 이전에 U5PVR 에서 OMX 코덱을 검사할 때 MediaCodec Info 앱을 사용해본적이 있습니다.
https://play.google.com/store/apps/details?id=com.ellevsoft.mediacodecinfo
이 앱을 사용하여 OMX 코덱들을 살펴보면 아래처럼 나타납니다. 인코더가 존재하는 것입니다.
실제적으로 OMX.google.h264.encoder 는 SW 인코더이고 HW 인코더는 OMX.Exynos.AVC.encoder 입니다.
이 인코더를 실제 영상을 인코딩하는 데에 사용할 수 있지 않을까 하고 고민을 많이 했습니다. 고민하고 테스트한 결과를 지금 말씀드리겠습니다.
1. 쉴드 PLEX 서버 / Android Emby 서버
실제로 쉴드를 트랜스코딩용으로 구매하시는 분들이 굉장히 많습니다. 내부의 엔비디아 테그라 TX1 의 APU 를 통해 인코딩이 매우 잘 되기 때문입니다.
맥스웰 그래픽을 기반으로 PLEX 서버에서 인코딩이 매우 만족스럽게 작동합니다.
이전에도 어떻게 안드로이드 기반에서 인코딩을 진행할지 매우 궁금했습니다. 쉴드를 구매하고 나서 직접 테스트를 해본 결과 몇가지 코덱은 하드웨어 인코딩이 작동하지 않았지만, 특이한 점은 프로세스에 MediaCodec 이 올라온다는 점이였습니다.
그때 당시에는 왜 이렇지? 라는 생각을 많이 했었습니다.
최근에 오락실아들님이 Emby Server 의 Fork 버전을 올려주시면서 트랜스코딩에 MediaCodec 이 있는것을 보게 되었습니다.
그래서 Emby Server 를 실제로 설치하여 안드로이드에서 트랜스코딩을 해보게 되었습니다.
테스트 장비는 U5PVR 입니다. Emby Server 앱을 설치하면 그대로 Emby Server 가 동작합니다.
트랜스코딩 설정에서 하드웨어 디코딩 인코딩과 관련하여 코덱 선택을 할 수 있습니다.
2. 커맨드 라인 로그
트랜스코딩을 할 때 아래와 같은 프로세스가 올라옵니다.
root@AOL-Debian:~# ps -ef | grep ffmpeg
10078 9376 5607 15 14:34 ? 00:00:32 /data/data/com.emby.embyserver/files/ffmpeg/ffmpeg -c:v h264_mediacodecndk -mediacodec_name OMX.hisi.video.decoder.avc -f mp4 -i file:/storage/emulated/0/TWICE-YES or YES(181117_음중).mp4 -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 h264_mediacodecndk -mediacodec_name OMX.hisi.video.encoder.avc -mediacodec_output_size 1280x720 -b:v:0 3680000 -maxrate 3680000 -bufsize 7360000 -profile 2 -level 1 -force_key_frames expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3)) -copyts -vsync -1 -codec:a:0 copy -disposition:a:0 default -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list /storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/aed9507e0812f1f25a4ca3179e5841ec.m3u8 -y /storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/aed9507e0812f1f25a4ca3179e5841ec%d.ts
실제 속도를 측정해 보기 위해 /data/data/com.emby.embyserver/files/ffmpeg 폴더 내부의 ffmpeg 를 실행하여 직접 사용해 보았습니다.
이 ffmpeg 는 libemby 라이브러리를 사용합니다. 이 라이브러리는 현재 안드로이드 6.0 7.0 8.0 을 지원하며, 안드로이드 9 에서는 테스트가 불가능합니다.
root@AOL-Debian:~# ./ffmpeg -c:v h264_mediacodecndk -mediacodec_name OMX.hisi.video.decoder.avc -i /sdcard/TWICE-YES\ or\ YES\(181117_음중\).mp4 -c:v h264_mediacodecndk -mediacodec_name OMX.hisi.video.encoder.avc -c:a aac out.mp4
ffmpeg version 4.0.2-emby_2018_11_14 Copyright (c) 2000-2018 the FFmpeg developers
built with Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
configuration: --cc=arm-linux-androideabi-gcc --arch=armv7 --prefix=/home/embybuilder/Buildbot/armv7_android/ffmpeg-armv7_android/staging --pkg-config=pkg-config --disable-doc --disable-ffplay --disable-vdpau --disable-xlib --enable-fontconfig --enable-gnutls --enable-gpl --enable-iconv --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libzvbi --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-libv4l2 --disable-v4l2-m2m --enable-mediacodecndk --enable-decoder=h264_mediacodecndk --enable-decoder=hevc_mediacodecndk --enable-decoder=mp1_mediacodecndk --enable-decoder=mp2_mediacodecndk --enable-decoder=mp3_mediacodecndk --enable-decoder=mpeg2_mediacodecndk --enable-decoder=mpeg4_mediacodecndk --enable-decoder=vc1_mediacodecndk --enable-decoder=vp8_mediacodecndk --enable-decoder=vp9_mediacodecndk --enable-encoder=h264_mediacodecndk --enable-cross-compile --cross-prefix=arm-linux-androideabi- --extra-libs='-ldl -lexpat -lfreetype -lfribidi -lfontconfig -liconv -lpng -luuid -lz -lvorbis -logg -lnettle -lhogweed -lgmp -lm -lmediandk' --target-os=android --disable-shared --enable-static
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/sdcard/TWICE-YES or YES(181117_음중).mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : ShanaEncoder
Duration: 00:04:00.37, start: 0.000000, bitrate: 10071 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 9739 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'out.mp4' already exists. Overwrite ? [y/N] y
Try loading embymc
embymc init function called
[h264_mediacodecndk @ 0xaebda180] NdkDec: mediacodec_name: OMX.hisi.video.decoder.avc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_mediacodecndk) -> h264 (h264_mediacodecndk))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_mediacodecndk @ 0xaebda180] NdkDec: MediaCodec output format changed: mime: string(video/raw), stride: int32(1920), slice-height: int32(1080), color-format: int32(21), image-data: data, crop: unknown(9), width: int32(1920), height: int32(1080)}
[h264_mediacodecndk @ 0xaebdaf80] NdkEnc: is_rtk: 0 pix_fmt: 23 pixelFormat: 21
[h264_mediacodecndk @ 0xaebdaf80] NdkEnc: Mime: video/avc Size: 1920x1080 rc_mode: 1 rc_max_rate: 16 rc_buffer_size: 0 bit_rate: 0
[h264_mediacodecndk @ 0xaebdaf80] NdkEnc: Framerate: 60000 / 1001
[h264_mediacodecndk @ 0xaebdaf80] NdkEnc: Profile: 8 Level: 512
[h264_mediacodecndk @ 0xaebdaf80] NdkEnc: aspect: 1 / 1
[h264_mediacodecndk @ 0xaebdaf80] NdkEnc: mediacodec_name: OMX.hisi.video.encoder.avc
Output #0, mp4, to 'out.mp4':e= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s dup=64 drop=0 speed=N/A
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.12.100
Stream #0:0(und): Video: h264 (h264_mediacodecndk) (avc1 / 0x31637661), nv12(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 59.94 fps, 60k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.18.100 h264_mediacodecndk
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.18.100 aac
[mp4 @ 0xaeb7c200] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
frame= 561 fps= 18 q=-0.0 Lsize= 3763kB time=00:00:09.49 bitrate=3246.8kbits/s dup=211 drop=225 speed=0.299x
video:3600kB audio:151kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.309139%
[aac @ 0xaebdba00] Qavg: 642.232
Exiting normally, received signal 2.
옵션을 주지 않고 코덱만 지정하여 진행해 보았습니다. 0.299 배속이 나옵니다.
입력 영상은 1080i IPTV 녹화본입니다.
이 속도를 개선해보기 위해서 코덱 옵션을 봅니다.
root@AOL-Debian:~# ffmpeg -h encoder=h264_mediacodecndk -hide_banner
Encoder h264_mediacodecndk [H.264 MediaCodec NDK]:
General capabilities: delay
Threading capabilities: none
Supported pixel formats: nv12 yuv420p
h264_mediacodecndk_class AVOptions:
-mediacodec_name <string> E..V..... Name of the MediaCodec codec to use
-rc-mode <int> E..V..... The bitrate mode to use (from 1 to 2) (default vbr)
vbr E..V..... Variable bitrate
cbr E..V..... Constant bitrate
-mediacodec_output_size <image_size> E..V..... Temporary hack to support scaling on output
-is-rtk <boolean> E..V..... Whether the encoder is Realtek's (default auto)
옵션을 확인해본 결과 미디어코덱 지정 / vbr cbr 선택 / 아웃풋 사이즈 / 리얼텍 인지 확인하는 부분 이 있습니다.
실제로 -mediacodec_name 은 지정하지 않아도 알아서 잘 찾아서 선택합니다. 그런데 직접적으로 문제가 있는 부분은 -mediacodec_output_size 가 동작하지 않습니다.
쉴드에서 잘 동작하는지 모르겠으나 실제로 작동하지 U5PVR / 갤럭시S7 / 포코F1 에서 작동하지 않습니다.
3. 타 기기에서의 테스트
1. 갤럭시 S7
하드웨어 인코더가 동작하지 않습니다.
Affected codecs:
>>>>>> Exynos.avc.dec
Max Bitrate: 114 Mbit/s - Frame Sizes: 32x32...3840x2160 - Width Alignment: 2 - Height Alignment: 2 - Frame Rates: 0fps...960fps
Max Instances: 16 - Color Formats: YUV420P, NV12, YUV420P, Unknown
Profiles: Baseline Profile (Level 5.2), Main Profile (Level 5.2), High Profile (Level 5.2)
>>>>>> Exynos.AVC.Encoder
Max Bitrate: 114 Mbit/s - Frame Sizes: 32x32...3840x2160 - Width Alignment: 2 - Height Alignment: 2 - Frame Rates: 0fps...960fps
Max Instances: 16 - Color Formats: YUV420P, YUV420P, NV12, Unknown, ABGR, Unknown - BitRate Modes: Variable Bitrate - Complexity Range: 0...0
Profiles: Baseline Profile (Level 5.2), Main Profile (Level 5.2), High Profile (Level 5.2)
>>>>>> FindVideoDecoder - MediaType: h264, Mode: 2
Info FindVideoDecoder - Checking: 'Exynos.avc.dec' (Priority: 100)
Info FindVideoDecoder - Check successful - selecting 'Exynos.avc.dec'
>>>>>> FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: 2
Info FindVideoEncoder - Checking: 'Exynos.AVC.Encoder' (Priority: 100)
Info Encoder supports input stream
Info FindVideoEncoder - Check successful - selecting 'Exynos.AVC.Encoder'
>>>>>> FindVideoDecoder - MediaType: h264, Mode: 2
Info FindVideoDecoder - Checking: 'Exynos.avc.dec' (Priority: 100)
Info FindVideoDecoder - Check successful - selecting 'Exynos.avc.dec'
>>>>>> FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: 2
Info FindVideoEncoder - Checking: 'Exynos.AVC.Encoder' (Priority: 100)
Info Encoder supports input stream
Info FindVideoEncoder - Check successful - selecting 'Exynos.AVC.Encoder'
/data/data/com.emby.embyserver/files/ffmpeg/ffmpeg -c:v h264_mediacodecndk -mediacodec_name OMX.Exynos.avc.dec -f mp4 -i file:"/storage/emulated/0/Download/�쇰텗-寃⑥슱�숉솕(161210_�뚯쨷).mp4" -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 h264_mediacodecndk -mediacodec_name OMX.Exynos.AVC.Encoder -mediacodec_output_size 1280x720 -b:v:0 2871986 -maxrate 2871986 -bufsize 5743972 -profile 8 -level 4096 -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 copy -disposition:a:0 default -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/8ab36365a437ecb3226f286dbfe93b6f.m3u8" -y "/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/8ab36365a437ecb3226f286dbfe93b6f%d.ts"
ffmpeg version 4.0.2-emby_2018_11_14 Copyright (c) 2000-2018 the FFmpeg developers
built with Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
configuration: --cc=aarch64-linux-android-gcc --arch=aarch64 --prefix=/home/embybuilder/Buildbot/armv8_android/ffmpeg-armv8_android/staging --pkg-config=pkg-config --disable-doc --disable-ffplay --disable-vdpau --disable-xlib --enable-fontconfig --enable-gnutls --enable-gpl --enable-iconv --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libzvbi --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-libv4l2 --disable-v4l2-m2m --enable-mediacodecndk --enable-decoder=h264_mediacodecndk --enable-decoder=hevc_mediacodecndk --enable-decoder=mp1_mediacodecndk --enable-decoder=mp2_mediacodecndk --enable-decoder=mp3_mediacodecndk --enable-decoder=mpeg2_mediacodecndk --enable-decoder=mpeg4_mediacodecndk --enable-decoder=vc1_mediacodecndk --enable-decoder=vp8_mediacodecndk --enable-decoder=vp9_mediacodecndk --enable-encoder=h264_mediacodecndk --enable-cross-compile --cross-prefix=aarch64-linux-android- --extra-libs='-ldl -lexpat -lfreetype -lfribidi -lfontconfig -liconv -lpng -luuid -lz -lvorbis -logg -lnettle -lhogweed -lgmp -lm -lmediandk' --target-os=android --disable-shared --enable-static
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/storage/emulated/0/Download/�쇰텗-寃⑥슱�숉솕(161210_�뚯쨷).mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : ShanaEncoder
Duration: 00:03:36.30, start: 0.000000, bitrate: 9862 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 9737 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Please use -profile:a or -profile:v, -profile is ambiguous
Try loading embymc
embymc init function called
[h264_mediacodecndk @ 0x7049d0c400] NdkDec: mediacodec_name: OMX.Exynos.avc.dec
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_mediacodecndk) -> h264 (h264_mediacodecndk))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size=N/A time=-577014:32:22.77 bitrate=N/A speed=N/A
[h264_mediacodecndk @ 0x7049d0c400] NdkDec: MediaCodec output format changed: mime: string(video/raw), stride: int32(1920), slice-height: int32(1088), color-format: int32(21), image-data: data, crop: unknown(9), width: int32(1920), height: int32(1088), vendor.rtc-ext-enc-caps-vt-driver-version.number: int32(161116), vendor.rtc-ext-dec-low-latency.enable: int32(0)}
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: is_rtk: 0 pix_fmt: 23 pixelFormat: 21
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: Mime: video/avc Size: 1920x1088 rc_mode: 1 rc_max_rate: 2871986 rc_buffer_size: 5743972 bit_rate: 2871986
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: Framerate: 60000 / 1001
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: Profile: 8 Level: 4096
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: OutputSize: 1280x720
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: aspect: 135 / 136
[h264_mediacodecndk @ 0x7049d0d800] NdkEnc: mediacodec_name: OMX.Exynos.AVC.Encoder
stack corruption detected (-fstack-protector)
상기처럼 에러가 발생하며, 인코딩 부분은 libx264 의 소프트웨어 코덱으로 대체됩니다.
2. 포코폰 F1
해당 서버 앱이 안드로이드 9 라이브러리를 제공하지 않아서 트랜스코딩이 정상적으로 작동하지 않습니다. 따라서, 이 부분을 해결하기 위해 멀티롬 기능을 통해 포코폰F1 의 초기롬 안드로이드 8.1 을 설치하였습니다.
(멀티롬의 경우 운영체제 버전이 달라도 잘 작동하네요.)
포코에서도 설치하여 테스트 해보았습니다. 영상은 1080i IPTV 녹화본입니다.
Affected codecs:
>>>>>> qcom.video.avc
Max Bitrate: 114 Mbit/s - Frame Sizes: 96x96...4096x2304 - Width Alignment: 2 - Height Alignment: 2 - Frame Rates: 1fps...480fps
Max Instances: 16 - Color Formats: YUV420P, NV12, YUV420P
Profiles: Baseline Profile (Level 5.2), Main Profile (Level 5.2), High Profile (Level 5.2)
>>>>>> qcom.video.avc
Max Bitrate: 114 Mbit/s - Frame Sizes: 96x96...4096x2304 - Width Alignment: 2 - Height Alignment: 2 - Frame Rates: 1fps...480fps
Max Instances: 16 - Color Formats: NV12, Unknown, YUV420P, NV12 - BitRate Modes: Variable Bitrate - Complexity Range: 0...0
Profiles: Baseline Profile (Level 5.2), Main Profile (Level 5.2), High Profile (Level 5.2)
>>>>>> FindVideoDecoder - MediaType: h264, Mode: 2
Info FindVideoDecoder - Checking: 'qcom.video.avc' (Priority: 100)
Info FindVideoDecoder - Check successful - selecting 'qcom.video.avc'
>>>>>> FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: 2
Info FindVideoEncoder - Checking: 'qcom.video.avc' (Priority: 100)
Info Encoder supports input stream
Info FindVideoEncoder - Check successful - selecting 'qcom.video.avc'
>>>>>> FindVideoDecoder - MediaType: h264, Mode: 2
Info FindVideoDecoder - Checking: 'qcom.video.avc' (Priority: 100)
Info FindVideoDecoder - Check successful - selecting 'qcom.video.avc'
>>>>>> FindVideoEncoder - Media: h264, UseHardwareCodecs: True, Mode: 2
Info FindVideoEncoder - Checking: 'qcom.video.avc' (Priority: 100)
Info Encoder supports input stream
Info FindVideoEncoder - Check successful - selecting 'qcom.video.avc'
/data/data/com.emby.embyserver/files/ffmpeg/ffmpeg -c:v h264_mediacodecndk -mediacodec_name OMX.qcom.video.decoder.avc -f mp4 -i file:"/storage/emulated/0/Download/redh264.mp4" -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 h264_mediacodecndk -mediacodec_name OMX.qcom.video.encoder.avc -mediacodec_output_size 1280x720 -b:v:0 3871985 -maxrate 3871985 -bufsize 7743970 -profile 8 -level 4096 -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 copy -disposition:a:0 default -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8" -y "/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4%d.ts"
ffmpeg version 4.0.2-emby_2018_11_14 Copyright (c) 2000-2018 the FFmpeg developers
built with Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
configuration: --cc=aarch64-linux-android-gcc --arch=aarch64 --prefix=/home/embybuilder/Buildbot/armv8_android/ffmpeg-armv8_android/staging --pkg-config=pkg-config --disable-doc --disable-ffplay --disable-vdpau --disable-xlib --enable-fontconfig --enable-gnutls --enable-gpl --enable-iconv --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libzvbi --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-libv4l2 --disable-v4l2-m2m --enable-mediacodecndk --enable-decoder=h264_mediacodecndk --enable-decoder=hevc_mediacodecndk --enable-decoder=mp1_mediacodecndk --enable-decoder=mp2_mediacodecndk --enable-decoder=mp3_mediacodecndk --enable-decoder=mpeg2_mediacodecndk --enable-decoder=mpeg4_mediacodecndk --enable-decoder=vc1_mediacodecndk --enable-decoder=vp8_mediacodecndk --enable-decoder=vp9_mediacodecndk --enable-encoder=h264_mediacodecndk --enable-cross-compile --cross-prefix=aarch64-linux-android- --extra-libs='-ldl -lexpat -lfreetype -lfribidi -lfontconfig -liconv -lpng -luuid -lz -lvorbis -logg -lnettle -lhogweed -lgmp -lm -lmediandk' --target-os=android --disable-shared --enable-static
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/storage/emulated/0/Download/redh264.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : ShanaEncoder
Duration: 00:03:18.61, start: 0.000000, bitrate: 10137 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 10003 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Please use -profile:a or -profile:v, -profile is ambiguous
Try loading embymc
embymc init function called
[h264_mediacodecndk @ 0x757c509400] NdkDec: mediacodec_name: OMX.qcom.video.decoder.avc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_mediacodecndk) -> h264 (h264_mediacodecndk))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size=N/A time=-577014:32:22.77 bitrate=N/A speed=N/A
frame= 0 fps=0.0 q=0.0 size=N/A time=-577014:32:22.77 bitrate=N/A speed=N/A
[h264_mediacodecndk @ 0x757c509400] NdkDec: MediaCodec output format changed: mime: string(video/raw), stride: int32(1920), slice-height: int32(1088), color-format: int32(21), image-data: data, crop: unknown(9), hdr-static-info: data, width: int32(1920), height: int32(1088)}
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: is_rtk: 0 pix_fmt: 23 pixelFormat: 21
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: Mime: video/avc Size: 1920x1088 rc_mode: 1 rc_max_rate: 3871985 rc_buffer_size: 7743970 bit_rate: 3871985
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: Framerate: 60000 / 1001
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: Profile: 8 Level: 4096
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: OutputSize: 1280x720
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: aspect: 135 / 136
[h264_mediacodecndk @ 0x757c50a800] NdkEnc: mediacodec_name: OMX.qcom.video.encoder.avc
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d40.ts' for writing
Output #0, segment, to '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4%d.ts':
Metadata:
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (h264_mediacodecndk), nv12, 1920x1088 [SAR 1:1 DAR 30:17], q=2-31, 3871 kb/s, 59.94 fps, 90k tbn, 59.94 tbc (default)
Metadata:
encoder : Lavc58.18.100 h264_mediacodecndk
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
[segment @ 0x757c465800] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
frame= 37 fps= 15 q=-0.0 size=N/A time=00:00:00.87 bitrate=N/A dup=18 drop=0 speed=0.346x
frame= 89 fps= 29 q=-0.0 size=N/A time=00:00:01.74 bitrate=N/A dup=44 drop=0 speed=0.578x
frame= 141 fps= 40 q=-0.0 size=N/A time=00:00:02.62 bitrate=N/A dup=70 drop=0 speed=0.743x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d41.ts' for writing
frame= 191 fps= 47 q=-0.0 size=N/A time=00:00:03.45 bitrate=N/A dup=95 drop=0 speed=0.856x
frame= 241 fps= 53 q=-0.0 size=N/A time=00:00:04.26 bitrate=N/A dup=120 drop=0 speed=0.938x
frame= 297 fps= 58 q=-0.0 size=N/A time=00:00:05.18 bitrate=N/A dup=148 drop=0 speed=1.02x
frame= 345 fps= 62 q=-0.0 size=N/A time=00:00:06.01 bitrate=N/A dup=172 drop=0 speed=1.08x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d42.ts' for writing
frame= 399 fps= 65 q=-0.0 size=N/A time=00:00:06.91 bitrate=N/A dup=199 drop=0 speed=1.13x
frame= 451 fps= 68 q=-0.0 size=N/A time=00:00:07.76 bitrate=N/A dup=225 drop=0 speed=1.18x
frame= 501 fps= 71 q=-0.0 size=N/A time=00:00:08.61 bitrate=N/A dup=250 drop=0 speed=1.21x
frame= 553 fps= 73 q=-0.0 size=N/A time=00:00:09.47 bitrate=N/A dup=276 drop=0 speed=1.24x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d43.ts' for writing
frame= 605 fps= 75 q=-0.0 size=N/A time=00:00:10.30 bitrate=N/A dup=302 drop=0 speed=1.27x
frame= 655 fps= 76 q=-0.0 size=N/A time=00:00:11.20 bitrate=N/A dup=327 drop=0 speed= 1.3x
frame= 707 fps= 77 q=-0.0 size=N/A time=00:00:12.05 bitrate=N/A dup=353 drop=0 speed=1.32x
frame= 759 fps= 79 q=-0.0 size=N/A time=00:00:12.90 bitrate=N/A dup=379 drop=0 speed=1.34x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d44.ts' for writing
frame= 809 fps= 80 q=-0.0 size=N/A time=00:00:13.78 bitrate=N/A dup=404 drop=0 speed=1.36x
frame= 861 fps= 81 q=-0.0 size=N/A time=00:00:14.59 bitrate=N/A dup=430 drop=0 speed=1.37x
frame= 911 fps= 82 q=-0.0 size=N/A time=00:00:15.46 bitrate=N/A dup=455 drop=0 speed=1.39x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d45.ts' for writing
frame= 963 fps= 83 q=-0.0 size=N/A time=00:00:16.34 bitrate=N/A dup=481 drop=0 speed= 1.4x
frame= 1019 fps= 84 q=-0.0 size=N/A time=00:00:17.25 bitrate=N/A dup=509 drop=0 speed=1.41x
frame= 1073 fps= 84 q=-0.0 size=N/A time=00:00:18.11 bitrate=N/A dup=536 drop=0 speed=1.42x
frame= 1123 fps= 85 q=-0.0 size=N/A time=00:00:18.96 bitrate=N/A dup=561 drop=0 speed=1.43x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d46.ts' for writing
frame= 1175 fps= 85 q=-0.0 size=N/A time=00:00:19.84 bitrate=N/A dup=587 drop=0 speed=1.44x
frame= 1223 fps= 86 q=-0.0 size=N/A time=00:00:20.67 bitrate=N/A dup=611 drop=0 speed=1.45x
frame= 1275 fps= 86 q=-0.0 size=N/A time=00:00:21.54 bitrate=N/A dup=637 drop=0 speed=1.46x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d47.ts' for writing
frame= 1329 fps= 87 q=-0.0 size=N/A time=00:00:22.44 bitrate=N/A dup=664 drop=0 speed=1.47x
frame= 1381 fps= 87 q=-0.0 size=N/A time=00:00:23.31 bitrate=N/A dup=690 drop=0 speed=1.48x
frame= 1427 fps= 88 q=-0.0 size=N/A time=00:00:24.06 bitrate=N/A dup=713 drop=0 speed=1.48x
frame= 1477 fps= 88 q=-0.0 size=N/A time=00:00:24.89 bitrate=N/A dup=738 drop=0 speed=1.48x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d48.ts' for writing
frame= 1527 fps= 88 q=-0.0 size=N/A time=00:00:25.70 bitrate=N/A dup=763 drop=0 speed=1.49x
frame= 1581 fps= 89 q=-0.0 size=N/A time=00:00:26.64 bitrate=N/A dup=790 drop=0 speed= 1.5x
frame= 1633 fps= 89 q=-0.0 size=N/A time=00:00:27.49 bitrate=N/A dup=816 drop=0 speed= 1.5x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d49.ts' for writing
frame= 1685 fps= 89 q=-0.0 size=N/A time=00:00:28.35 bitrate=N/A dup=842 drop=0 speed= 1.5x
frame= 1735 fps= 90 q=-0.0 size=N/A time=00:00:29.20 bitrate=N/A dup=867 drop=0 speed=1.51x
frame= 1787 fps= 90 q=-0.0 size=N/A time=00:00:30.08 bitrate=N/A dup=893 drop=0 speed=1.52x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d410.ts' for writing
frame= 1837 fps= 90 q=-0.0 size=N/A time=00:00:30.89 bitrate=N/A dup=918 drop=0 speed=1.52x
frame= 1887 fps= 90 q=-0.0 size=N/A time=00:00:31.74 bitrate=N/A dup=943 drop=0 speed=1.52x
frame= 1939 fps= 91 q=-0.0 size=N/A time=00:00:32.61 bitrate=N/A dup=969 drop=0 speed=1.53x
frame= 1991 fps= 91 q=-0.0 size=N/A time=00:00:33.47 bitrate=N/A dup=995 drop=0 speed=1.53x
More than 1000 frames duplicated
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d411.ts' for writing
frame= 2045 fps= 91 q=-0.0 size=N/A time=00:00:34.34 bitrate=N/A dup=1022 drop=0 speed=1.53x
frame= 2095 fps= 92 q=-0.0 size=N/A time=00:00:35.17 bitrate=N/A dup=1047 drop=0 speed=1.54x
frame= 2151 fps= 92 q=-0.0 size=N/A time=00:00:36.09 bitrate=N/A dup=1075 drop=0 speed=1.54x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d412.ts' for writing
frame= 2201 fps= 92 q=-0.0 size=N/A time=00:00:36.97 bitrate=N/A dup=1100 drop=0 speed=1.54x
frame= 2253 fps= 92 q=-0.0 size=N/A time=00:00:37.82 bitrate=N/A dup=1126 drop=0 speed=1.55x
frame= 2303 fps= 92 q=-0.0 size=N/A time=00:00:38.69 bitrate=N/A dup=1151 drop=0 speed=1.55x
frame= 2357 fps= 93 q=-0.0 size=N/A time=00:00:39.55 bitrate=N/A dup=1178 drop=0 speed=1.55x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d413.ts' for writing
frame= 2407 fps= 93 q=-0.0 size=N/A time=00:00:40.42 bitrate=N/A dup=1203 drop=0 speed=1.56x
frame= 2457 fps= 93 q=-0.0 size=N/A time=00:00:41.25 bitrate=N/A dup=1228 drop=0 speed=1.56x
frame= 2509 fps= 93 q=-0.0 size=N/A time=00:00:42.11 bitrate=N/A dup=1254 drop=0 speed=1.56x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d414.ts' for writing
frame= 2559 fps= 93 q=-0.0 size=N/A time=00:00:42.92 bitrate=N/A dup=1279 drop=0 speed=1.56x
frame= 2611 fps= 93 q=-0.0 size=N/A time=00:00:43.79 bitrate=N/A dup=1305 drop=0 speed=1.56x
frame= 2663 fps= 93 q=-0.0 size=N/A time=00:00:44.67 bitrate=N/A dup=1331 drop=0 speed=1.57x
frame= 2715 fps= 93 q=-0.0 size=N/A time=00:00:45.58 bitrate=N/A dup=1357 drop=0 speed=1.57x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d415.ts' for writing
frame= 2767 fps= 94 q=-0.0 size=N/A time=00:00:46.44 bitrate=N/A dup=1383 drop=0 speed=1.57x
frame= 2819 fps= 94 q=-0.0 size=N/A time=00:00:47.27 bitrate=N/A dup=1409 drop=0 speed=1.57x
frame= 2867 fps= 94 q=-0.0 size=N/A time=00:00:48.10 bitrate=N/A dup=1433 drop=0 speed=1.57x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d416.ts' for writing
frame= 2921 fps= 94 q=-0.0 size=N/A time=00:00:48.96 bitrate=N/A dup=1460 drop=0 speed=1.58x
frame= 2975 fps= 94 q=-0.0 size=N/A time=00:00:49.87 bitrate=N/A dup=1487 drop=0 speed=1.58x
frame= 3023 fps= 94 q=-0.0 size=N/A time=00:00:50.70 bitrate=N/A dup=1511 drop=0 speed=1.58x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d417.ts' for writing
frame= 3077 fps= 94 q=-0.0 size=N/A time=00:00:51.56 bitrate=N/A dup=1538 drop=0 speed=1.58x
frame= 3129 fps= 94 q=-0.0 size=N/A time=00:00:52.43 bitrate=N/A dup=1564 drop=0 speed=1.58x
frame= 3179 fps= 95 q=-0.0 size=N/A time=00:00:53.31 bitrate=N/A dup=1589 drop=0 speed=1.59x
frame= 3229 fps= 95 q=-0.0 size=N/A time=00:00:54.12 bitrate=N/A dup=1614 drop=0 speed=1.59x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d418.ts' for writing
frame= 3281 fps= 95 q=-0.0 size=N/A time=00:00:55.01 bitrate=N/A dup=1640 drop=0 speed=1.59x
frame= 3335 fps= 95 q=-0.0 size=N/A time=00:00:55.89 bitrate=N/A dup=1667 drop=0 speed=1.59x
frame= 3385 fps= 95 q=-0.0 size=N/A time=00:00:56.74 bitrate=N/A dup=1692 drop=0 speed=1.59x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d419.ts' for writing
frame= 3435 fps= 95 q=-0.0 size=N/A time=00:00:57.57 bitrate=N/A dup=1717 drop=0 speed=1.59x
frame= 3489 fps= 95 q=-0.0 size=N/A time=00:00:58.45 bitrate=N/A dup=1744 drop=0 speed=1.59x
frame= 3543 fps= 95 q=-0.0 size=N/A time=00:00:59.34 bitrate=N/A dup=1771 drop=0 speed=1.59x
frame= 3595 fps= 95 q=-0.0 size=N/A time=00:01:00.24 bitrate=N/A dup=1797 drop=0 speed= 1.6x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d420.ts' for writing
frame= 3647 fps= 95 q=-0.0 size=N/A time=00:01:01.07 bitrate=N/A dup=1823 drop=0 speed= 1.6x
frame= 3697 fps= 95 q=-0.0 size=N/A time=00:01:01.93 bitrate=N/A dup=1848 drop=0 speed= 1.6x
frame= 3749 fps= 95 q=-0.0 size=N/A time=00:01:02.82 bitrate=N/A dup=1874 drop=0 speed= 1.6x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d421.ts' for writing
frame= 3801 fps= 96 q=-0.0 size=N/A time=00:01:03.63 bitrate=N/A dup=1900 drop=0 speed= 1.6x
frame= 3853 fps= 96 q=-0.0 size=N/A time=00:01:04.53 bitrate=N/A dup=1926 drop=0 speed= 1.6x
frame= 3905 fps= 96 q=-0.0 size=N/A time=00:01:05.40 bitrate=N/A dup=1952 drop=0 speed= 1.6x
frame= 3957 fps= 96 q=-0.0 size=N/A time=00:01:06.30 bitrate=N/A dup=1978 drop=0 speed= 1.6x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d422.ts' for writing
frame= 4007 fps= 96 q=-0.0 size=N/A time=00:01:07.11 bitrate=N/A dup=2003 drop=0 speed= 1.6x
frame= 4055 fps= 96 q=-0.0 size=N/A time=00:01:07.92 bitrate=N/A dup=2027 drop=0 speed= 1.6x
frame= 4109 fps= 96 q=-0.0 size=N/A time=00:01:08.77 bitrate=N/A dup=2054 drop=0 speed=1.61x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d423.ts' for writing
frame= 4161 fps= 96 q=-0.0 size=N/A time=00:01:09.65 bitrate=N/A dup=2080 drop=0 speed=1.61x
frame= 4213 fps= 96 q=-0.0 size=N/A time=00:01:10.52 bitrate=N/A dup=2106 drop=0 speed=1.61x
frame= 4261 fps= 96 q=-0.0 size=N/A time=00:01:11.33 bitrate=N/A dup=2130 drop=0 speed=1.61x
frame= 4313 fps= 96 q=-0.0 size=N/A time=00:01:12.21 bitrate=N/A dup=2156 drop=0 speed=1.61x
frame= 4367 fps= 96 q=-0.0 size=N/A time=00:01:13.06 bitrate=N/A dup=2183 drop=0 speed=1.61x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d424.ts' for writing
frame= 4417 fps= 96 q=-0.0 size=N/A time=00:01:13.92 bitrate=N/A dup=2208 drop=0 speed=1.61x
frame= 4467 fps= 96 q=-0.0 size=N/A time=00:01:14.81 bitrate=N/A dup=2233 drop=0 speed=1.61x
frame= 4517 fps= 96 q=-0.0 size=N/A time=00:01:15.62 bitrate=N/A dup=2258 drop=0 speed=1.61x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d425.ts' for writing
frame= 4573 fps= 96 q=-0.0 size=N/A time=00:01:16.52 bitrate=N/A dup=2286 drop=0 speed=1.61x
frame= 4623 fps= 96 q=-0.0 size=N/A time=00:01:17.39 bitrate=N/A dup=2311 drop=0 speed=1.62x
frame= 4675 fps= 97 q=-0.0 size=N/A time=00:01:18.27 bitrate=N/A dup=2337 drop=0 speed=1.62x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d426.ts' for writing
frame= 4729 fps= 97 q=-0.0 size=N/A time=00:01:19.12 bitrate=N/A dup=2364 drop=0 speed=1.62x
frame= 4773 fps= 97 q=-0.0 size=N/A time=00:01:19.91 bitrate=N/A dup=2386 drop=0 speed=1.62x
frame= 4825 fps= 97 q=-0.0 size=N/A time=00:01:20.76 bitrate=N/A dup=2412 drop=0 speed=1.62x
frame= 4877 fps= 97 q=-0.0 size=N/A time=00:01:21.62 bitrate=N/A dup=2438 drop=0 speed=1.62x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d427.ts' for writing
frame= 4931 fps= 97 q=-0.0 size=N/A time=00:01:22.53 bitrate=N/A dup=2465 drop=0 speed=1.62x
frame= 4981 fps= 97 q=-0.0 size=N/A time=00:01:23.34 bitrate=N/A dup=2490 drop=0 speed=1.62x
frame= 5033 fps= 97 q=-0.0 size=N/A time=00:01:24.22 bitrate=N/A dup=2516 drop=0 speed=1.62x
frame= 5081 fps= 97 q=-0.0 size=N/A time=00:01:25.03 bitrate=N/A dup=2540 drop=0 speed=1.62x
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d4.m3u8.tmp' for writing
[segment @ 0x757c465800] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/9666bfeecb5a359319dabeda446c66d428.ts' for writing
frame= 5133 fps= 97 q=-0.0 size=N/A time=00:01
상기에도 마찬가지로 mediacodec_output_size 옵션이 1280x720 으로 들어가고 있고, NDK 관련 로그에서도 1280x720 으로 확인되고 있습니다만, 영상 출력은 원본 소스와 같습니다.
혹시나 VP9 Apink4k 영상 테스트 해보았습니다. 힘들어합니다. 인코딩 출력도 3840x2160 이다보니 속도가 많이 떨어집니다.
/data/data/com.emby.embyserver/files/ffmpeg/ffmpeg -c:v vp9_mediacodecndk -mediacodec_name OMX.qcom.video.decoder.vp9 -f matroska -i file:"/storage/emulated/0/Download/apinkvp9.mkv" -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 h264_mediacodecndk -mediacodec_name OMX.qcom.video.encoder.avc -mediacodec_output_size 1920x1080 -b:v:0 9808001 -maxrate 9808001 -bufsize 19616002 -profile 8 -level 4096 -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 copy -disposition:a:0 default -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e01925.m3u8" -y "/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e01925%d.ts"
ffmpeg version 4.0.2-emby_2018_11_14 Copyright (c) 2000-2018 the FFmpeg developers
built with Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
configuration: --cc=aarch64-linux-android-gcc --arch=aarch64 --prefix=/home/embybuilder/Buildbot/armv8_android/ffmpeg-armv8_android/staging --pkg-config=pkg-config --disable-doc --disable-ffplay --disable-vdpau --disable-xlib --enable-fontconfig --enable-gnutls --enable-gpl --enable-iconv --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libzvbi --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-libv4l2 --disable-v4l2-m2m --enable-mediacodecndk --enable-decoder=h264_mediacodecndk --enable-decoder=hevc_mediacodecndk --enable-decoder=mp1_mediacodecndk --enable-decoder=mp2_mediacodecndk --enable-decoder=mp3_mediacodecndk --enable-decoder=mpeg2_mediacodecndk --enable-decoder=mpeg4_mediacodecndk --enable-decoder=vc1_mediacodecndk --enable-decoder=vp8_mediacodecndk --enable-decoder=vp9_mediacodecndk --enable-encoder=h264_mediacodecndk --enable-cross-compile --cross-prefix=aarch64-linux-android- --extra-libs='-ldl -lexpat -lfreetype -lfribidi -lfontconfig -liconv -lpng -luuid -lz -lvorbis -logg -lnettle -lhogweed -lgmp -lm -lmediandk' --target-os=android --disable-shared --enable-static
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, matroska,webm, from 'file:/storage/emulated/0/Download/apinkvp9.mkv':
Metadata:
ENCODER : Lavf56.1.0
Duration: 00:03:33.17, start: 0.000000, bitrate: 25775 kb/s
Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, bt709/unknown/unknown), 3840x2160, SAR 1:1 DAR 16:9, 59.94 fps, 59.94 tbr, 1k tbn, 1k tbc (default)
Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp (default)
Metadata:
CREATION_TIME : 2015-04-05 09:01:29
LANGUAGE : und
Please use -profile:a or -profile:v, -profile is ambiguous
Try loading embymc
embymc init function called
[vp9_mediacodecndk @ 0x6f4f509400] NdkDec: mediacodec_name: OMX.qcom.video.decoder.vp9
Stream mapping:
Stream #0:0 -> #0:0 (vp9 (vp9_mediacodecndk) -> h264 (h264_mediacodecndk))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[vp9_mediacodecndk @ 0x6f4f509400] NdkDec: MediaCodec output format changed: mime: string(video/raw), stride: int32(3840), slice-height: int32(2160), color-format: int32(21), image-data: data, crop: unknown(9), hdr-static-info: data, width: int32(3840), height: int32(2160), color-standard: int32(1), color-transfer: int32(3)}
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: is_rtk: 0 pix_fmt: 23 pixelFormat: 21
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: Mime: video/avc Size: 3840x2160 rc_mode: 1 rc_max_rate: 9808001 rc_buffer_size: 19616002 bit_rate: 9808001
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: Framerate: 60000 / 1001
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: Profile: 8 Level: 4096
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: OutputSize: 1920x1080
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: aspect: 1 / 1
[h264_mediacodecndk @ 0x6f4f50a800] NdkEnc: mediacodec_name: OMX.qcom.video.encoder.avc
[segment @ 0x6f4f464c00] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e019250.ts' for writing
Output #0, segment, to '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e01925%d.ts':
Metadata:
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (h264_mediacodecndk), nv12, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 9808 kb/s, 59.94 fps, 90k tbn, 59.94 tbc (default)
Metadata:
encoder : Lavc58.18.100 h264_mediacodecndk
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
[segment @ 0x6f4f464c00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
frame= 11 fps=0.0 q=-0.0 size=N/A time=00:00:00.23 bitrate=N/A speed=0.443x
frame= 32 fps= 31 q=-0.0 size=N/A time=00:00:00.58 bitrate=N/A speed=0.56x
frame= 46 fps= 30 q=-0.0 size=N/A time=00:00:00.83 bitrate=N/A speed=0.544x
frame= 66 fps= 32 q=-0.0 size=N/A time=00:00:01.16 bitrate=N/A speed=0.559x
frame= 85 fps= 33 q=-0.0 size=N/A time=00:00:01.48 bitrate=N/A speed=0.574x
frame= 100 fps= 32 q=-0.0 size=N/A time=00:00:01.71 bitrate=N/A speed=0.546x
frame= 118 fps= 32 q=-0.0 size=N/A time=00:00:02.04 bitrate=N/A speed=0.56x
frame= 136 fps= 33 q=-0.0 size=N/A time=00:00:02.34 bitrate=N/A speed=0.564x
frame= 154 fps= 33 q=-0.0 size=N/A time=00:00:02.64 bitrate=N/A speed=0.565x
frame= 171 fps= 32 q=-0.0 size=N/A time=00:00:02.92 bitrate=N/A speed=0.555x
frame= 192 fps= 33 q=-0.0 size=N/A time=00:00:03.27 bitrate=N/A speed=0.567x
frame= 211 fps= 33 q=-0.0 size=N/A time=00:00:03.55 bitrate=N/A speed=0.563x
frame= 228 fps= 33 q=-0.0 size=N/A time=00:00:03.85 bitrate=N/A speed=0.563x
[segment @ 0x6f4f464c00] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e01925.m3u8.tmp' for writing
[segment @ 0x6f4f464c00] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e019251.ts' for writing
frame= 243 fps= 33 q=-0.0 size=N/A time=00:00:04.13 bitrate=N/A speed=0.562x
frame= 262 fps= 33 q=-0.0 size=N/A time=00:00:04.43 bitrate=N/A speed=0.56x
frame= 278 fps= 33 q=-0.0 size=N/A time=00:00:04.71 bitrate=N/A speed=0.559x
frame= 298 fps= 33 q=-0.0 size=N/A time=00:00:05.03 bitrate=N/A speed=0.561x
frame= 319 fps= 34 q=-0.0 size=N/A time=00:00:05.38 bitrate=N/A speed=0.567x
frame= 336 fps= 34 q=-0.0 size=N/A time=00:00:05.66 bitrate=N/A speed=0.566x
frame= 350 fps= 33 q=-0.0 size=N/A time=00:00:05.92 bitrate=N/A speed=0.561x
frame= 365 fps= 33 q=-0.0 size=N/A time=00:00:06.15 bitrate=N/A speed=0.557x
frame= 384 fps= 33 q=-0.0 size=N/A time=00:00:06.45 bitrate=N/A speed=0.559x
frame= 400 fps= 33 q=-0.0 size=N/A time=00:00:06.71 bitrate=N/A speed=0.557x
[segment @ 0x6f4f464c00] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e01925.m3u8.tmp' for writing
[segment @ 0x6f4f464c00] Opening '/storage/emulated/0/Android/data/com.emby.embyserver/files/transcoding-temp/86d8e853fb1f83fd5ad7a38ba3e019252.ts' for writing
frame= 419 fps= 33 q=-0.0 size=N/A time=00:00:07.05 bitrate=N/A speed=0.561x
frame= 435 fps= 33 q=-0.0 size=N/A time=00:00:07.33 bitrate=N/A speed=0.56x
frame= 455 fps= 33 q=-0.0 size=N/A time=00:00:07.63 bitrate=N/A speed=0.562x
frame= 472 fps= 33 q=-0.0 s
4. 아쉬움
실제로 하이실리콘 CV200 제품의 경우 VPU 에서 하드웨어 인코딩을 지원합니다만, 이게 OMX 쪽으로 연동이 되어있지 않은것 같습니다. 정말 아쉽습니다.
그리고 아직 ffmpeg 에서 미디어코덱을 완벽히 지원하지 못하고 있습니다.
혹시 버전이 낮아서 발생하는 문제인지 체크를 하기 위해, NDK 로 ffmpeg 를 빌드해보고 있습니다.
차후에 개선된 글로 찾아뵙겠습니다.
감사합니다.
아차차 마지막으로 Emby Server 의 대쉬보드 화면입니다.