[FFmpeg-user] Transcode mjpeg to mpeg-ts or ts-file
barsnick at gmx.net
Thu May 23 17:44:10 EEST 2019
On Tue, May 14, 2019 at 11:18:24 +0200, christian at ilm-provider.de wrote:
> i will transcode an mjpeg url from mobotix cam:
> to an mpegts ts.
> Is this possible?
It should be.
> [mpjpeg @ 000001c5e964a040] Expected boundary '--' not found, instead
> found a line of 4 bytes
> Invalid data found when processing input
This is an issue with reading the incoming stream, not with actual
reencoding or remuxing.
I found the issue for this. I don't know how to fix it though, or how
to work around it.
I tried with a publicly available stream of the same sort[*1]. With a
lot of printf debuggery, I figured out that ffmpeg reads the incoming
stream in chunks, incrementally searches for the multipart delimiter,
and then tries to rewind the incoming stream to this delimiter, in
order to subsequently begin parsing the next header and JPEG image.
This rewind fails under certain circumstances: avio_seek()[*2] returns
"Function not implemented" (according to av_err2str()) and doesn't
rewind. Therefore, the next attempt at parsing the multipart header
starts at some arbitrary point past the (previously determined) header
position, and fails with "Expected boundary '--' not found".
That the backward seek doesn't work may be due to something like
incoming stream buffer size, or that you can't seek backwards beyond
some last chunk, or something like this. I'm just speculating.
It tried to increase the stream buffer size with "-rtbufsize", but that
doesn't seem to have an effect on this scenario.
BTW, in the course of debugging, I found a bug or three in the
implementation of "-strict_mime_boundary 1" (which has nothing to do
I can go into more detail in a trac ticket or in a conversation with a
developer, unless I figure out a fix myself. ;-)
I hesitate to share the URL, in fear that hundreds of accesses from the
wild may cause the operator to shut it down. ;-)
More information about the ffmpeg-user