Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#5976 closed defect (fixed)

flv encoding for live stream no longer usable

Reported by: jyavenard Owned by: Steven Liu
Priority: important Component: avformat
Version: git-master Keywords: flv regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

% ffmpeg -i input ... output
ffmpeg version
built on ...

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=5702416c57afb2bb062eb69d60fc42c31c91b674

introduced a regression.
If the stream isn't seekable, it no longer update the duration / file size.
This assumed that the file size / duration could only be determined by seeking to the end of the file.

But this is an invalid assumption. Continuously reading the stream will automatically update the value returned by ftell. From that we can deduct what the new duration and file size is.

This introduced a mythtv regression https://code.mythtv.org/trac/ticket/12936

This commit should be reverted, or modified so that it can still attempt to estimate the current filesize/duration even when the stream isn't seekable.

Change History (10)

comment:1 by jyavenard, 7 years ago

Component: undeterminedavformat
Version: unspecifiedgit-master

comment:2 by Steven Liu, 7 years ago

If the rtmp isn't seekable, ffmpeg cannot update the metadata. and ffmpeg will give you a warning message,
there have many flv living stream have no metadata, then the server will modify, add or fix it.
of course, if you think non-seekable don't update(NOT no) duration and filesize is a better way, i think ffmpeg need a patch to add option for choose by users, because there have many server and player reading the duration and filesize first, if no the duration and filesize use stream mode. when the filesize and duration error when it is 0, That's a fetal error.

comment:3 by Steven Liu, 7 years ago

Owner: set to Steven Liu
Status: newopen

comment:4 by Steven Liu, 7 years ago

Owner: set to Steven Liu
Status: newopen

comment:5 by Steven Liu, 7 years ago

I have sent a new patch to maillist, you can try it.

[PATCH] avformat/flvenc: fix ticket 5976 and use old commit

comment:6 by jyavenard, 7 years ago

Thank you for the quick fix.

So by default, the old behavior is back.

@@ -844,7 +846,7 @@ end:
         avio_seek(pb, flv->datasize_offset, SEEK_SET);
         put_amf_double(pb, flv->datasize);
     }
-    if (pb->seekable) {
+    if (!(flv->flags & FLV_NO_DURATION_FILESIZE)) {
         /* update information */

why not use if (write_duration_filesize) ?

in reply to:  6 comment:7 by Steven Liu, 7 years ago

Replying to jyavenard:

Thank you for the quick fix.

So by default, the old behavior is back.

@@ -844,7 +846,7 @@ end:
         avio_seek(pb, flv->datasize_offset, SEEK_SET);
         put_amf_double(pb, flv->datasize);
     }
-    if (pb->seekable) {
+    if (!(flv->flags & FLV_NO_DURATION_FILESIZE)) {
         /* update information */

why not use if (write_duration_filesize) ?

Because this is in flv_write_trailer and only be used once, so don't need use other variable to make it simple.

comment:8 by Steven Liu, 7 years ago

Resolution: fixed
Status: openclosed

comment:9 by jyavenard, 7 years ago

Any chance this can be backported to 3.2 branch?

thank you

comment:10 by Carl Eugen Hoyos, 7 years ago

Keywords: flv regression added
Priority: normalimportant
Note: See TracTickets for help on using tickets.