Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
397 stars 76 forks source link

Round-tripping MPEG-TS not working. #59

Open gliese1337 opened 3 years ago

gliese1337 commented 3 years ago

Before I do anything more complicated, I'm trying to just demux and decode an MPEG-TS file, and then re-encode and remux to get an equivalent file back out, using fs.createReadStream() for input and a PassThrough stream for output. (The end goal is to read from a network socket and write to another socket, with no file system involvement.)

My test code is here: https://gist.github.com/gliese1337/3e123764fec1e8792094e082a258d798

It creates a demuxer and a remuxer, creates an output stream for each input stream, then just loops over packets, decodes them, re-encodes them, and writes them back out to the remuxer.

Rather than actually producing an output file, through, I just get the following console output:

{ INIT_IN: 'INIT_OUTPUT' }
{ INIT_IN: 'INIT_OUTPUT' }
[aac @ 0000025ed8a2d300] The encoder timebase is not set.
[NULL @ 0000025ed8a2d300] No codec provided to avcodec_open2()
[NULL @ 0000025ed8a2d300] No codec provided to avcodec_open2()
[NULL @ 0000025ed8a2d300] No codec provided to avcodec_open2()
[libx264 @ 0000025ed8838100] The encoder timebase is not set.
[NULL @ 0000025ed8a2d300] No codec provided to avcodec_open2()
[NULL @ 0000025ed8838100] No codec provided to avcodec_open2()
{ a few hundred similar lines }
[NULL @ 0000025ed8838100] No codec provided to avcodec_open2()
[NULL @ 0000025ed8838100] No codec provided to avcodec_open2()
Flushing
[NULL @ 0000025ed8838100] No codec provided to avcodec_open2()
[NULL @ 0000025ed8838100] No codec provided to avcodec_open2()

I have checked that the input streams do have a timebase set.

Manually setting the output stream parameters doesn't fix it.

Any idea what I'm doing wrong?