[FFmpeg-trac] #10623(ffmpeg:new): Metadata is written at the end of the process, making piped output miss metadata
FFmpeg
trac at avcodec.org
Tue Oct 17 06:50:01 EEST 2023
#10623: Metadata is written at the end of the process, making piped output miss
metadata
-------------------------------------+-------------------------------------
Reporter: vortex | Type: defect
Status: new | Priority: normal
Component: ffmpeg | Version: git-
Keywords: pipe | master
matroska -map | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
I use ffmpeg to modify (convert, copy or remove) some subtitles on mkv
files. The data is piped through stdin and stdout using this command:
{{{
% ffmpeg -i pipe:0 -map 0:a -c:a copy -map 0:v -c:v copy -map 0:s? -c:s:0
subrip -c:s:1 copy -hide_banner -loglevel warning -stats -f matroska
pipe:1
}}}
The result I get from stdout is missing metadata.
So I tried to let ffmpeg write the output to a file and I was reading the
file asynchronously while it was still be written.
{{{
% ffmpeg -i pipe:0 -map 0:a -c:a copy -map 0:v -c:v copy -map 0:s? -c:s:0
subrip -c:s:1 copy -hide_banner -loglevel warning -stats -f matroska
out.mkv
}}}
I notified the metadata in the asynchronously read file was still missing,
but the final output file had the metadata. I binary compared them and
they were mostly identical, but differed from address 0x300D to 0x700C (I
guess this is part the metadata).
So it looks like ffmpeg writes the metadata at the end of processing which
does not work well with pipes.
I also tried to build ffmpeg from master branch (commit 5ddabd49d) and use
it, but the problem persisted.
Is this a bug or are my ffmpeg commandline args not optimal?
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10623>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list