kaltura / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
2k stars 439 forks source link

some clip cannot play HLS well #1041

Open wnpllrzodiac opened 5 years ago

wnpllrzodiac commented 5 years ago

Hi, I convert a clip with ffmepg command like this:

ffmpeg -ss 60 -i xxxxx.mp4 -map 0:v -map 0:a -c copy -t 30 cut_bad.mp4
ffmpeg -ss 60 -i xxxxx.mp4 -map 0:v -map 0:a -c copy -t 30 -movflags +faststart cut_good.mp4

ffplay http://1.2.3.4:9880/hls/cut_bad.mp4/index.m3u8 play bad,

[h264 @ 000000ea9f3eea00] no frame!
[h264 @ 000000eaa3c6e5c0] Invalid NAL unit 9, skipping.  0B f=0/0
    Last message repeated 2 times
[h264 @ 000000eaa3c6e5c0] A non-intra slice in an IDR NAL unit.
[h264 @ 000000eaa3c6e5c0] decode_slice_header error
[h264 @ 000000eaa3c6e5c0] no frame!
[h264 @ 000000eaa5b99040] Invalid NAL unit 9, skipping.
[h264 @ 000000eaa5b99040] data partitioning is not implemented. Update your FFmp
eg version to the newest one from Git. If the problem still occurs, it means tha
t your file has a feature which has not been implemented.
[h264 @ 000000eaa5b99040] If you want to help, upload a sample of this file to f
tp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffm
peg-devel@ffmpeg.org)
[h264 @ 000000eaa5b99040] sps_id 1 out of range
[h264 @ 000000eaa5b99040] slice type 13 too large at 0
[h264 @ 000000eaa5b99040] decode_slice_header error
[h264 @ 000000eaa5b99040] no frame!
[h264 @ 000000ea9f372640] Invalid NAL unit 7, skipping.
[h264 @ 000000ea9f372640] Invalid NAL unit 9, skipping.

ffplay http://1.2.3.4:9880/hls/cut_good.mp4/index.m3u8 play well

option "-movflags +faststart" make the difference?

wnpllrzodiac commented 5 years ago

ffplay windows version: ffplay version 4.1 Copyright (c) 2003-2018 the FFmpeg developers

wnpllrzodiac commented 5 years ago

sample clip as follows:

http://iloveyaya.ga:9108/test/tmp/cut_bad.mp4 http://iloveyaya.ga:9108/test/tmp/cut_good.mp4

erankor commented 5 years ago

Both files produce identical TS segments -

# for i in {1..4}; do curl -s localhost:8001/local/hls/content/cut_bad.mp4/seg-$i-v1-a1.ts | cksum ; done
3086110997 3309176
3955747098 2154104
3556619675 3107640
2423141460 105656
# for i in {1..4}; do curl -s localhost:8001/local/hls/content/cut_good.mp4/seg-$i-v1-a1.ts | cksum ; done
3086110997 3309176
3955747098 2154104
3556619675 3107640
2423141460 105656

Fast start is not required, the module can locate the metadata without it, but when the file is 'fast start' it can save some read/seek operations when the metadata is not already cached. Maybe you updated the file in place, and you have some caching issue?

wnpllrzodiac commented 5 years ago

Yes, I transcode the media file using ffmpeg several time for test(with out restart nginx). May be it's the key point, I will check it.

The suggested work-flow is transcode media file in trans folder and move it to nginx vod distribution folder to avoid media meta data corruption?

erankor commented 5 years ago

If it's for testing, you can just disable the metadata cache. For production, we never change a video file on disk, if it needs to be changed, we create a new version (=file with a different name) + generate new URLs. Consider that on production, if someone is already playing v1 of the file, he needs to keep getting segments generated from v1. If you start returning segments from v2, playback will likely fail, or some other odd behaviors will be encountered.