[FFmpeg-user] filter_complex and map. Am i confused or bug?
Alex Molon
alex.molon at vision247.com
Thu Jan 31 15:03:35 EET 2019
In this case I used a "real life" scenario, picking up a live stream. The result is the same:
Command executed:
ffmpeg -i udp://226.45.23.147:2001?fifo_size=1000000 -filter_complex "[0:v]scale=720:576[vidout1];[0:v]scale=640:480[vidout2]" -c:v libx264 -c:a aac -b:v:vidout1 2M -minrate:v:vidout1 2M -maxrate:v:vidout1 2M -b:v:vidout2 1M -minrate:v:vidout2 1M -maxrate:v:vidout2 1M -map [vidout1] -map [vidout2] -map 0:a -t 10 -y -f mpegts test.ts
Expectation:
A file called test.ts containing 3 elementary streams:
One video stream 720x576 encoded at 2M with minimum and maximum bitrate 2M
One video stream 640x480 encoded at 1M with minimum and maximum bitrate 1M
One audio stream AAC
Result:
A file called test ts containing 3 elementary streams:
One video stream at 720x576 unexpectedly encoded at 1M
One video stream at 640x480 unexpectedly encoded with no specific settings
One audio stream AAC
Suspected cause:
I think the following section of the command is parsed wrongly or I’m totally confused
b:v:vidout1 2M -minrate:v:vidout1 2M -maxrate:v:vidout1 2M -b:v:vidout2 1M -minrate:v:vidout2 1M -maxrate:v:vidout2 1M
Output:
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
configuration: --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbs2b --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libzvbi --enable-opengl --enable-sdl2 --enable-libdrm --enable-chromaprint --enable-frei0r --enable-libx264 --disable-shared --enable-static --enable-libnpp --enable-nonfree --enable-nvenc --enable-cuvid --enable-libfdk-aac
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
Input #0, mpegts, from 'udp://226.45.23.147:2001?fifo_size=1000000':
Duration: N/A, start: 17355.533200, bitrate: N/A
Program 1408
Metadata:
service_name : BTV HD
service_provider:
Stream #0:0[0x1959]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x195a]: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s
Stream mapping:
Stream #0:0 (h264) -> scale (graph 0)
Stream #0:0 (h264) -> scale (graph 0)
scale (graph 0) -> Stream #0:0 (libx264)
scale (graph 0) -> Stream #0:1 (libx264)
Stream #0:1 -> #0:2 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'test.ts':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264), yuv420p(top coded first (swapped)), 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 1000 kb/s, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 1000000/0/1000000 buffer size: 0 vbv_delay: -1
Stream #0:1: Video: h264 (libx264), yuv420p, 640x480 [SAR 4:3 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.35.100 aac
frame= 228 fps= 39 q=-1.0 Lq=-1.0 size= 1832kB time=00:00:10.00 bitrate=1500.3kbits/s speed=1.69x
Thanks in advance,
Alex Molon
-----Original Message-----
From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of Alex Molon
Sent: 31 January 2019 12:52
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] filter_complex and map. Am i confused or bug?
Hi Carl,
My problem actually is not the order itself, but how the single tracks are actually encoded....
The complete command is:
ffmpeg -i INPUTFILE -filter_complex "[0:v]scale=720:576[vidout1];[0:v]scale=640:480[vidout2]" -c:v libx264 -c:a aac -b:v:vidout1 2M -minrate:v:vidout1 2M -maxrate:v:vidout1 2M -b:v:vidout2 1M -minrate:v:vidout2 1M -maxrate:v:vidout2 1M -map [vidout2] -map [vidout1] -map 0:a -f mpegts test.ts
And the result is that:
instead to have a stream with one video track 720x576 at 2M/2M/2M, one video track 640x480 at 1M/1M/1m and one audio track
as a result I have a stream with one video track with one video track 640x480 at 1M/1M/1M, one video track 720x576 with no specific encoding settings and one audio track.
Or, in alternative (if I change the order of the map commands) one video track 720x576 at 1M/1M/1M, one video track 640x480 with no specific encoding settings and one audio track.
Output #0, mpegts, to 'test.ts':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264), yuv420p(top coded first (swapped)), 640x480 [SAR 4:3 DAR 16:9], q=-1--1, 1000 kb/s, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 1000000/0/1000000 buffer size: 0 vbv_delay: -1
Stream #0:1: Video: h264 (libx264), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
Thanks in advance,
Alex
-----Original Message-----
From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of Carl Eugen Hoyos
Sent: 31 January 2019 12:45
To: FFmpeg user questions
Subject: Re: [FFmpeg-user] filter_complex and map. Am i confused or bug?
2019-01-31 13:41 GMT+01:00, Alex Molon <alex.molon at vision247.com>:
> Basically I have a file with a single video track and a single audio track.
>
> What I want to achieve is:
>
>
>
> a) Scale the video track to 720x576 and encode it in H264 @ 2M with 2M
> minrate and 2M maxrate
>
> b) Scale the video track to 640x480 and encode it in H264 @ 1M with 1M
> minrate and 1M maxrate
>
> c) Pick the audio track and encode it in aac
> d) Mux all the tracks together in this order: first Video 640x480, second
> Video 720x576, third Audio
Transport streams do not know about "order", this concept simply
doesn't apply.
If this does not answer your question, please provide your actual
command line (no variables) including the complete, uncut console
output if you need support here.
Carl Eugen
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list