[FFmpeg-user] aresample filter position
adam smith
adamsmith79 at icloud.com
Tue Nov 17 15:55:33 EET 2020
Hi you lovely people,
I have an error caused when I use the aresample filter that I think has something to do with the position of the filter in the chain.
Failed to inject frame into filter network: I/O error
The system takes a variety of different source configurations so I have some code that tries to manipulate the audio tracks and channels to fill the output. This can mean straight up pass through, or splitting channels, copying them and then merging. It all depends on the input config and output config.
Anyhoo, some of the files that get encoded have audio that slowly drifts out of sync (possibly due to the supplied source). I wanted to add aresample=sync=1 to see if this resolves the issue.
It was easiest for me to add this filter to the start of the audio filter chain. In most cases this does not cause any errors regardless of what manipulation is required afterwards, but in the instance below it is causing an IO error.
In this instance, I see that the console output says Consider inserting the (a)format filter near their input or output
If I move the aresample after the amerge it is processed successfully.
As far as I can tell, the only time I get the Failed to inject frame into filter network: I/O error when the last filter is amerge.
Do you know what the rules are for the position of this filter in the chain?
Command:
aws s3 cp s3://s3-bucket/filename.mxf - --quiet | ffmpeg -y -i - -filter_complex \"[0:0]fifo[vout];[0:1]aresample=async=1[01_async];[0:2]aresample=async=1[02_async];[01_async][02_async]amerge=inputs=2[01_merger]\" -map \"[vout]\" -map \"[01_merger]\" -pix_fmt yuv420p -c:v libx264 -s 640x360 -profile:v main -level:v 3.1 -refs:v 2 -keyint_min 50 -b:v 736k -r 25.0 -ac 2 -bsf:a aac_adtstoasc -c:a libfdk_aac -ar 44100 -b:a 64k -flags +global_header -f tee \"[f=mp4:movflags=+faststart]/temporary/filename.mp4\”
Full console:
/usr/src/app # aws s3 cp s3://s3-bucket/filename <s3://s3-bucket/filename>.mxf - --quiet | ffmpeg -y -i - -filter_complex "[0:0]fifo[vout];[0:1]aresample=async=1[01_async];[0:2]aresample=async=1[02_async];[01_async][02_async]amerge=inputs=2[01_merger]" -map "[vout]" -map "[01_merger]" -pix_fmt yuv420
p -c:v libx264 -s 640x360 -profile:v main -level:v 3.1 -refs:v 2 -keyint_min 50 -b:v 736k -r 25.0 -ac 2 -bsf:a aac_adtstoasc -c:a libfdk_aac -ar 44100 -b:a 64k -flags +global_header -f tee "[f=mp4:movflags=+faststart]/data/temporary/filename.mp4"
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.0 (Alpine 9.3.0)
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[mxf @ 0x7fcf6fc8b500] file is not seekable - not parsing FooterPartition
[mxf @ 0x7fcf6fc8b500] broken or empty index
Guessed Channel Layout for Input Stream #0.1 : mono
Guessed Channel Layout for Input Stream #0.2 : mono
Input #0, mxf, from 'pipe:':
Metadata:
operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
uid : 182da8a5-28b1-11eb-912b-0c9d92be82bd
generation_uid : 182da8a6-28b1-11eb-9820-0c9d92be82bd
company_name : Adobe Inc.
product_name : Adobe Media Encoder
product_version : 14.5.0
application_platform: win32
product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f
modification_date: 2020-11-17T08:44:24.488000Z
material_package_umid: 0x060A2B340101010501010D1113000000B628E001709105A41C130C9D92BE82BD
timecode : 00:00:00:00
Duration: 00:00:30.84, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mpeg2video, yuv422p(tv, unknown/bt709/bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
file_package_umid: 0x060A2B340101010501010D1213EBE625AD28E001709105A49D950C9D92BE82BD
file_package_name: Source Package
track_name : Track 1
Side data:
cpb: bitrate max/min/avg: 50000000/0/0 buffer size: 17825792 vbv_delay: N/A
Stream #0:1: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D1213EBE625AD28E001709105A49D950C9D92BE82BD
file_package_name: Source Package
track_name : Track 2
Stream #0:2: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D1213EBE625AD28E001709105A49D950C9D92BE82BD
file_package_name: Source Package
track_name : Track 3
Stream mapping:
Stream #0:0 (mpeg2video) -> fifo
Stream #0:1 (pcm_s24le) -> aresample
Stream #0:2 (pcm_s24le) -> aresample
fifo -> Stream #0:0 (libx264)
amerge -> Stream #0:1 (libfdk_aac)
[Parsed_amerge_3 @ 0x559d3d788900] No channel layout for input 1
Last message repeated 1 times
[AVFilterGraph @ 0x559d3d786fc0] The following filters could not choose their formats: Parsed_amerge_3
Consider inserting the (a)format filter near their input or output.
Error reinitializing filters!
Failed to inject frame into filter network: I/O error
Error while processing the decoded data for stream #0:0
Conversion failed!
Thanks for any advice.
Adam
More information about the ffmpeg-user
mailing list