axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
http://www.bento4.com
1.96k stars 478 forks source link

Any support for piping? #316

Open conteit opened 5 years ago

conteit commented 5 years ago

Given a valid file.fmp4: mp4split --pattern-parameters N --start-number 1 file.fmp4 works properly, while cat file.fmp4 | mp4split --pattern-parameters N --start-number 1 -stdin don't.

I've tried using mp4split (version 1-5-1-624) in pipe but it fails recognizing the Moov atom at the beginning (probably because it is in process of being written into the pipe?).

conteit commented 5 years ago

The failure occurs in AP4_AtomFactory.cpp, line 243.

After creating the atom successfully, it fails on seeking the stream: stream.Seek(start+size) returns -1.

Same outcome on Mac and Linux_x86_64.

barbibulle commented 5 years ago

Piping isn't supported, because for most operations, random access to the file is needed. There are limited cases where linear access is sufficient, but that's only for certain types of files with certain constraints.

alexbuisson commented 1 year ago

? that was a 2018 issue.... is there a way in 2022 to read/write a CMAF/MP4 stream using STDIN/STDOUT while catching the atom on the fly ?

Just to be sure as I saw that there is a class called AP4_StdcFileByteStream, not sure how to use that but seems promissing