Opened 2 years ago
Closed 2 years ago
#9752 closed defect (invalid)
ffmpeg is affecting the parent shell's file stream
Reported by: | rgovostes | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I am invoking ffmpeg from within a bash loop like this:
while IFS="" read -r PLAYLIST; do ... ffmpeg -f concat -i concat.txt -i chapters.txt -map_metadata 1 \ -c copy merged.mp4 .... done < <(head -n 3 playlists.txt)
Each iteration of this loop, it should read one line from playlists.txt
into the variable PLAYLIST
. However, the lines are being unexpectedly truncated. Each line should start {"ie_key": "YoutubeTab"
but when the truncation occurs the first 7 bytes are skipped and the loop reads y": "YoutubeTab"
.
This *only* happens when ffmpeg is invoked within the loop. I wasn't aware a child process could affect the parent like this but maybe ffmpeg is inheriting a file descriptor and inadvertently seeking it?
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 13.1.6 (clang-1316.0.21.2)
Note:
See TracTickets
for help on using tickets.
This is not specific to ffmpeg, it will happen with any program that reads from its standard input. In case you did not know, ffmpeg reads interactive commands from its standard input; if you do not want it, redirect the input or use the
-nostdin
option.