I'm trying to change the aspect ratio of video, cause it's being showed in a wrong way (it sould be 16:9 but shows 3:4). I've tried a lot of things, and none worked. E.g. I've tried to set SAR, but it changes DAR, so the aspect ratio stays the same. Here's an example:
ffmpeg -y -i rtmp://localhost/in/air-hdmi -vf "setsar=sar=16/9" -f flv rtmp://localhost/in/ngoraltestffmpeg
ffmpeg version N-80388-gfd1d84b Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/home/anastasia/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/anastasia/ffmpeg_build/include --extra-ldflags=-L/home/anastasia/ffmpeg_build/lib --bindir=/home/anastasia/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 38.101 / 57. 38.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.101 / 6. 46.101
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
[flv @ 0x38143c0] audio stream discovered after head already parsed
[aac @ 0x3818f20] element type mismatch 1 != 0
[flv @ 0x38143c0] video stream discovered after head already parsed
Input #0, flv, from 'rtmp://localhost/in/air-hdmi':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 720
displayHeight : 576
fps : 0
profile :
level :
Duration: 00:00:00.00, start: 181748.084000, bitrate: N/A
Stream #0:0: Audio: aac (HE-AAC), 44100 Hz, stereo, fltp
Stream #0:1: Video: h264 (High), yuv420p, 720x576, 25 fps, 25 tbr, 1k tbn, 50 tbc
[flv @ 0x39bf5a0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, flv, to 'rtmp://localhost/in/ngoraltest':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 720
displayHeight : 576
fps : 0
profile :
level :
encoder : Lavf57.38.101
Stream #0:0: Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 16:9 DAR 20:9], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.46.100 flv
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, stereo, fltp
Metadata:
encoder : Lavc57.46.100 libmp3lame
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> flv1 (flv))
Stream #0:0 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[aac @ 0x3a37000] element type mismatch 1 != 0
Last message repeated 7 times
[flv @ 0x39bf5a0] Failed to update header with correct duration.ate= 942.7kbits/s speed=2.37x
[flv @ 0x39bf5a0] Failed to update header with correct filesize.
frame= 112 fps= 48 q=31.0 Lsize= 633kB time=00:00:05.18 bitrate= 999.9kbits/s speed=2.23x
video:546kB audio:82kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.846813%
Exiting normally, received signal 2.
Using setdar=16/9
do not succeeds: it changes PAR, so the result is the same:
Input #0, flv, from 'rtmp://localhost/in/air-hdmi':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 720
displayHeight : 576
fps : 0
profile :
level :
Duration: 00:00:00.00, start: 287464.746000, bitrate: N/A
Stream #0:0: Audio: aac (HE-AAC), 44100 Hz, stereo, fltp
Stream #0:1: Video: h264 (High), yuv420p, 720x576, 25 fps, 25 tbr, 1k tbn, 50 tbc
[flv @ 0x3a5ea20] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, flv, to 'rtmp://localhost/in/ngoraltest':
Metadata:
Server : NGINX RTMP (github.com/arut/nginx-rtmp-module)
displayWidth : 720
displayHeight : 576
fps : 0
profile :
level :
encoder : Lavf57.38.101
Stream #0:0: Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.46.100 flv
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, stereo, fltp
Metadata:
encoder : Lavc57.46.100 libmp3lame
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> flv1 (flv))
Stream #0:0 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
(When use setsar
, the params are 720x576 [SAR 16:9 DAR 20:9]
, when setdar
-- 720x576 [SAR 64:45 DAR 16:9]
)
I've also tried to apply scale=720:-1
and -aspect 16:9
and all left the same.
BUT! Wnen I write ffplay -vf setsar=16/9 rtmp://localhost/in/ngoraltest
it shows perfectly what I need.
What could be thae problem and hoe to solve it?
P.S. I'm little bit confused that there's no onformation about SAR and DAR of input signal, but I can do totally nothing with it.
flv1
. I doubt you want that. – llogan-c:v libx264
as an output option for H.264 video. – llogan