Estou tentando gravar vídeo do simulador do iOS usando o seguinte comando:
./fbsimctl stream --bgra --fps 12 - | ffmpeg -f rawvideo -pix_fmt bgra -s 414x736 -framerate 12 -i - -f h264 -r 12 - | ffplay -
O problema é que o vídeo resultante é distorcido.
Parece que o ffmpeg não está convertendo corretamente o formato bgra.
Existem outros parâmetros que eu preciso passar?
Existe um aviso no meio do exemplo de saída colado abaixo:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
[swscaler @ 0x7f8342009000] Warning: data is not aligned! This can lead to a speed loss
Aqui está o exemplo de saída;
./fbsimctl stream --bgra --fps 12 - | ffmpeg -f rawvideo -pix_fmt bgra -s 414x736 -framerate 12 -i - -f h264 -r 12 - | ffplay -
ffmpeg version 4.0.2ffplay version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers Copyright (c) 2003-2018 the FFmpeg developers
built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil 56. 14.100 / 56. 14.100
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
libpostproc 55. 1.100 / 55. 1.100
Running /usr/bin/xcode-select --print-path with environment {
HOME = "/Users/sumancherukuri";
PATH = "/Users/sumancherukuri/Projects/webrtc/webrtc_ios/depot_tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
}
Connection Did Connect => Bridge: Framebuffer ((null)) | HID (null) | (null)
079C6C51-C335-4273-A566-7D0667693F99 | iPhone X | Booted | iPhone X | iOS 11.4 | x86_64: launch: Bridge: Framebuffer ((null)) | HID (null) | (null)
Mounting Surface with Attributes: {
format = BGRA;
"frame_size" = 11069184;
height = 2436;
"row_size" = 4544;
width = 1125;
}
Input #0, rawvideo, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 117006 kb/s
Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 414x736, 117006 kb/s, 12 tbr, 12 tbn, 12 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
[swscaler @ 0x7f8342009000] Warning: data is not aligned! This can lead to a speed loss
[libx264 @ 0x7f8343801800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f8343801800] profile High 4:4:4 Predictive, level 2.2, 4:4:4 8-bit
Output #0, h264, to 'pipe:':
Metadata:
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (libx264), yuv444p, 414x736, q=-1--1, 12 fps, 12 tbn, 12 tbc
Metadata:
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
listen started: Streaming Video
frame= 56 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 79 fps= 77 q=26.0 size= 950kB time=00:00:01.75 bitrate=4448.9kbits/frame= 116 fps= 76 q=26.0 size= 2501kB time=00:00:04.83 bitrate=4239.1kbits/Input #0, h264, from 'pipe:':q= 0KB vq= 0KB sq= 0B f=0/0
Duration: N/A, bitrate: N/A
Obrigado,
- Suman
Tags ffmpeg video-conversion