Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#5976 closed defect (fixed)

flv encoding for live stream no longer usable

Reported by: jyavenard Owned by: stevenliu
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 Changed 20 months ago by jyavenard

  • Component changed from undetermined to avformat
  • Version changed from unspecified to git-master

comment:2 Changed 20 months ago by stevenliu

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 Changed 20 months ago by stevenliu

  • Owner set to stevenliu
  • Status changed from new to open

comment:4 Changed 20 months ago by stevenliu

  • Owner set to stevenliu
  • Status changed from new to open

comment:5 Changed 20 months ago by stevenliu

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

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

comment:6 follow-up: Changed 20 months ago by 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) ?

comment:7 in reply to: ↑ 6 Changed 20 months ago by stevenliu

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 Changed 20 months ago by stevenliu

  • Resolution set to fixed
  • Status changed from open to closed

comment:9 Changed 20 months ago by jyavenard

Any chance this can be backported to 3.2 branch?

thank you

comment:10 Changed 20 months ago by cehoyos

  • Keywords flv regression added
  • Priority changed from normal to important
Note: See TracTickets for help on using tickets.