Closed nguyenduybinh closed 3 years ago
Have the same issue. I've found that it happens on recordings of ~ 2hrs or more. Would love to see a solution for this. Perhaps it's an issue with mp4 and not flv?
@franzwarning not exactly about record duration, its error when file size larger than 2GB. I think it error when unpublish stream, because mp4 format need to re write moov header when finish
@franzwarning not exactly about record duration, its error when file size larger than 2GB. I think it error when unpublish stream, because mp4 format need to re write moov header when finish
Did you have the same issue? And you have any solution for this issue? I'm considering to use dvr segment plan to separate to small MP4 file and join them together after stream unpublish
because mp4 format need to re write moov header when finish
Does this mean that flv doesn't need to? Might consider switching to flv in that case. Or using the segment plan, just makes my life a little more difficult.
@franzwarning yes, you can change dvr format to flv, if you choose dvr plan is segment make surre dvr file size not larger than 2GB (I used it). Then just wait contributor fix this bug
mdat->nb_data = uint32_t(mdat_bytes);nb_data overflow int->uint32
It seems the overflow of mdat size, which use uint32_t.
class ISrsCodec
{
public:
ISrsCodec();
virtual ~ISrsCodec();
public:
/**
* get the number of bytes to code to.
*/
// TODO: FIXME: change to uint64_t.
virtual int nb_bytes() = 0;
定义的这个字节是int,所以只有2GB大小,需要改成uint64_t。
MacBookPro:live cheng.ycl$ ls -lh *.mp4*
-rw-r--r-- 1 cheng.ycl staff 5.0G Dec 17 15:08 ffmpeg.mp4
-rw-r--r-- 1 cheng.ycl staff 5.0G Dec 17 15:08 livestream.1608188848270.mp4
MacBookPro:live cheng.ycl$ od -t x1 -N64 ffmpeg.mp4
0000000 00 00 00 20 66 74 79 70 69 73 6f 6d 00 00 02 00
0000020 69 73 6f 6d 69 73 6f 32 61 76 63 31 6d 70 34 31
0000040 00 00 00 01 6d 64 61 74 00 00 00 01 40 ce 1f 42
0000060 00 00 02 cb 06 05 ff ff c7 dc 45 e9 bd e6 d9 48
0000100
MacBookPro:live cheng.ycl$ od -t x1 -N64 livestream*.mp4
0000000 00 00 00 20 66 74 79 70 69 73 6f 6d 00 00 02 00
0000020 69 73 6f 6d 69 73 6f 32 61 76 63 31 6d 70 34 31
0000040 00 00 00 01 6d 64 61 74 00 00 00 01 40 ce 1f 42
0000060 00 00 02 cb 06 05 ff ff c7 dc 45 e9 bd e6 d9 48
0000100
注意,前32字节就是ftyp,跟着后面16字节是mdat的头,其中Size就是00 00 00 01 40 ce 1f 42
,即0x0140ce1f42
,也就是5GB。
解析如下:
00 00 00 01 // small size 是1,代表使用8字节的large size
6d 64 61 74 // 字符mdat
00 00 00 01 40 ce 1f 42 // 这个就是large size,5GB
使用mp4box查看:
MacBookPro:live cheng.ycl$ mp4box livestream.1608188848270.mp4 -info
* Movie Info *
Timescale 1000 - 2 tracks
Computed Duration 00:00:43.142 - Indicated Duration 00:00:43.100
Fragmented File: no
File Brand isom - version 512
Compatible brands: isom iso2 avc1 mp41
Created: UNKNOWN DATE Modified: UNKNOWN DATE
File has no MPEG4 IOD/OD
Track # 1 Info - TrackID 1 - TimeScale 1000
Media Duration 00:00:43.133 - Indicated Duration 00:00:43.100
Track has 1 edit lists: track duration is 00:00:43.100
Media Info: Language "Undetermined (und)" - Type "vide:avc1" - 1294 samples
Visual Sample Entry Info: width=1920 height=1088 (depth=24 bits)
Visual Track layout: x=0 y=0 width=1920 height=1088
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1920 x 1088
AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 6.2
NAL Unit length bits: 32
Chroma format YUV 4:2:0 - Luma bit depth 8 - chroma bit depth 8
SPS#1 hash: 20C2D4AEFD2357FF529F0BA5E83E6F763CA2A003
PPS#1 hash: F215A69003100A0F0AC7DDC8A61D259724402482
Self-synchronized
RFC6381 Codec Parameters: avc1.42C03E
Average GOP length: 10 samples
Max sample duration: 34 / 1000
Track # 2 Info - TrackID 2 - TimeScale 1000
Media Duration 00:00:43.142 - Indicated Duration 00:00:43.096
Media Info: Language "Undetermined (und)" - Type "soun:mp4a" - 929 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC (AOT=2 backward compatible) (HE-AAC v1) - 2 Channel(s) - SampleRate 22050 - SBR: SampleRate 44100 Type MPEG-4 Audio SBR
Synchronized on stream 1
RFC6381 Codec Parameters: mp4a.40.2
All samples are sync
Max sample duration: 47 / 1000
MacBookPro:live cheng.ycl$ mp4box ffmpeg.mp4 -info
* Movie Info *
Timescale 1000 - 2 tracks
Computed Duration 00:00:43.142 - Indicated Duration 00:00:43.142
Fragmented File: no
File Brand isom - version 512
Compatible brands: isom iso2 avc1 mp41
Created: UNKNOWN DATE Modified: UNKNOWN DATE
File has no MPEG4 IOD/OD
iTunes Info:
Encoder Software: Lavf58.45.100
1 UDTA types: meta (1)
Track # 1 Info - TrackID 1 - TimeScale 16000
Media Duration 00:00:43.133 - Indicated Duration 00:00:43.133
Track has 1 edit lists: track duration is 00:00:43.133
Media Info: Language "Undetermined (und)" - Type "vide:avc1" - 1294 samples
Visual Sample Entry Info: width=1920 height=1080 (depth=24 bits)
Visual Track layout: x=0 y=0 width=1920 height=1080
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1920 x 1080
AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 6.2
NAL Unit length bits: 32
Chroma format YUV 4:2:0 - Luma bit depth 8 - chroma bit depth 8
SPS#1 hash: 20C2D4AEFD2357FF529F0BA5E83E6F763CA2A003
PPS#1 hash: F215A69003100A0F0AC7DDC8A61D259724402482
Self-synchronized
RFC6381 Codec Parameters: avc1.42C03E
Average GOP length: 10 samples
Max sample duration: 544 / 16000
Track # 2 Info - TrackID 2 - TimeScale 44100
Media Duration 00:00:43.141 - Indicated Duration 00:00:43.141
Track has 1 edit lists: track duration is 00:00:43.142
Media Info: Language "Undetermined (und)" - Type "soun:mp4a" - 929 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC (AOT=2 backward compatible) (HE-AAC v1) - 2 Channel(s) - SampleRate 22050 - SBR: SampleRate 44100 Type MPEG-4 Audio SBR
Synchronized on stream 1
RFC6381 Codec Parameters: mp4a.40.2
Alternate Group ID 1
All samples are sync
Max sample duration: 2048 / 44100
(Description)
Hi all, I use SRS for my livestream system. Everything OK but sometime, when have long livestream, the mp4 dvr file after livestream is break. I used ffmpeg to check the file, and the error like that: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x41e55c0] moov atom not found 5e8ab3d7b3b1a2001b5e9b93.1586148554308.mp4: Invalid data found when processing input
Anyone have the same issue and how to fix this?
SRS(Version):
3.0release
SRS(Config):