After making some experiences with the latest ffmpeg (version N-62004-g5b03caf built on Mar 31 2014 22:12:13 by Zeranoe) together with x265 encoder, I found that I could build a .mp4 file with a "hev1" bitstream where each keyframe has the VPS and SPS header (AFAIK this option can only be used with ffmpeg through the API of the x265 encoder: repeat-headers=1):
* Movie Info *
Timescale 1000 - Duration 00:00:04.011
2 track(s)
Fragmented File: no
File Brand isom - version 512
Created: UNKNOWN DATE Modified: UNKNOWN DATE
File has no MPEG4 IOD/OD
iTunes Info:
Encoder Software: Lavf55.36.100
Track # 1 Info - TrackID 1 - TimeScale 12800 - Media Duration 00:00:04.000
Track has 1 edit lists: track duration is 00:00:04.000
Media Info: Language "English" - Type "vide:hev1" - 100 samples
Visual Track layout: x=0 y=0 width=1280 height=720
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x23
HEVC Video - Visual Size 1280 x 720
HEVC Info: Profile Main @ Level 3.1 - Chroma Format 1
NAL Unit length bits: 32 - general profile compatibility 0x60000000
Parameter Sets: 1 VPS 1 SPS 1 PPS
SPS resolution 1280x720 - Pixel Aspect Ratio 1:1 - Indicated track size 1280 x 720
Bit Depth luma 8 - Chroma 8 - 1 temporal layers
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 48000 - Media Duration 00:00:04.010
Track has 1 edit lists: track duration is 00:00:03.971
Media Info: Language "English" - Type "soun:mp4a" - 188 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1
But aparently when I extract both bitstreams and remux them to .mp4 with mp4box, the video bitstream is converted to "hvc1":
* Movie Info *
Timescale 600 - Duration 00:00:04.010
2 track(s)
Fragmented File: no
File suitable for progressive download (moov before mdat)
File Brand iso4 - version 1
Created: GMT Tue Apr 01 16:23:55 2014
Modified: GMT Tue Apr 01 16:23:55 2014
File has root IOD (9 bytes)
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: No visual capability required (0xff)
Audio PL: AAC Profile @ Level 2 (0x29)
No streams included in root OD
Track # 1 Info - TrackID 1 - TimeScale 25 - Media Duration 00:00:04.000
Media Info: Language "Undetermined" - Type "vide:hvc1" - 100 samples
Visual Track layout: x=0 y=0 width=1280 height=720
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x23
HEVC Video - Visual Size 1280 x 720
HEVC Info: Profile Main @ Level 3.1 - Chroma Format 1
NAL Unit length bits: 32 - general profile compatibility 0x60000000
Parameter Sets: 1 VPS 1 SPS 1 PPS
SPS resolution 1280x720 - Pixel Aspect Ratio 1:1 - Indicated track size 1280 x 720
Bit Depth luma 8 - Chroma 8 - 1 temporal layers
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 48000 - Media Duration 00:00:04.010
Media Info: Language "Undetermined" - Type "soun:mp4a" - 188 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
To rebuild the .mp4, I tried different parameters (-rap -ocr -iod -hint) but with no luck. Is mp4box supposed to mess with the bitstream?
The command I used for ffmpeg is: ffmpeg.exe -i "%fname%.mp4" -vf scale=%resolution% -c:a copy -frames:v 100 -c:v libx265 -preset ultrafast -x265-params repeat-headers=1:vui=1:timinginfo=1:hash=2:bitrate=%bitrate%:vbv-maxrate=%mux_bitrate%:vbv-bufsize=%buffer%:no-open-gop=1:keyint=%GOP%:no-scenecut=1:rc-lookahead=4:ref=4 "play_%fname%%resolution%%bitrate%.mp4"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
'hvc1' stores SPS/PPS in a specific avcC box while 'hev1' stores SPS/PPS inband. It does not change the stream itself, it separates the metadata from the data (which is a key element of ISOBMF).
Can you be little more precise about how this bothers you? What do you expect from writing here?
Romain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a player that was shown to work only with 'hev1' streams, but since mp4box transforms it to 'hvc1', I could not play it. Meanwhile I figured out how to produce a .mp4 file with ffmpeg that outputs 'hev1' (using the repeat-headers flag).
Unfortunately the player still has problems, more precisely, when playing a DASH stream, it stops playing the stream after the first fragment. I though it was because of the Parameters Sets, but I am not sure anymore.
Last edit: Luis R 2014-04-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the clarification. The feature to convert an mp4 file between 'hev1' and 'hvc1' (and similarly for AVC) would be interesting. We will try to implement it.
In the meantime, in A DASH context you can try to use the "-bs-switching" option (see MP4Box -h dash). In particular the "single" mode should work for you. It should create an initialization segment of type 'hev1'.
HTH. Let us know if this solves your problem.
Cyril
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I finally resolved my problem. I needed to split the file into 2 independent streams:
"mp4box.exe -profile live -dash-scale 1000 -dash 9000 -frag 3000 .\media.mp4#video:role=video .\media.mp4#audio:role=audio -out .\dash_media.mpd"
Meanwhile while trying to do the same thing with dash-live option
"mp4box.exe -profile live -dynamic -dash-live 3000 .\media.mp4#video:role=video .\media.mp4#audio:role=audio -out C:\DASH\media.mpd"
I keep getting the error after the sleep:
Live DASH-ing - press 'q' to quit, 's' to save context and quit [DASH]: WARNING! DASH Live profile requested but no -segment-name
using "%s_dash" by default
DASH-ing files: 3.00s segments 3.00s fragments single sidx per segment
Spliting segments at GOP boundaries [DASH] Generating MPD at time 2014-05-19T15:29:06Z [DASH] MPD AvailabilityStartTime 2014-05-19T15:29:06Z
DASHing file .\media.mp4
DASHing file .\media.mp4
sleep for 29602 ms [DASH] Removing segment C:\DASH\media_dash_track1_1.m4s - 26.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_2.m4s - 23.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_3.m4s - 20.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_4.m4s - 17.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_5.m4s - 14.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_6.m4s - 11.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_7.m4s - 8.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_8.m4s - 5.026 sec too late [DASH] Removing segment C:\DASH\media_dash_track1_9.m4s - 2.026 sec too late [DASH]: WARNING! DASH Live profile requested but no -segment-name
using "%s_dash" by default
DASH-ing files: 3.00s segments 3.00s fragments single sidx per segment
Spliting segments at GOP boundaries [DASH] Generating MPD at time 2014-05-19T15:29:36Z [DASH] MPD AvailabilityStartTime 2014-05-19T15:29:06Z
DASHing file .\media.mp4
Error while DASH-ing file: Bad Parameter
Error DASHing file: Bad Parameter
I don't think it is the source stream that has a problem, since I used 3s GOPs with H264 codec.
If I don't split the files "mp4box.exe -profile live -dynamic -dash-live 3000 .\media.mp4 -out C:\DASH\media.mpd" everything works fine.
I am using the current build (0.5.1-DEV-rev5258)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Meanwhile I discovered another error while trying a workaround. I tried to DASH a stream with the "dynamic" flag as demonstrated here:
"mp4box -profile live -rap -dash-scale 1000 -dash 3000 -dynamic media.mp4#video media.mp4#audio -out DASH/media.mpd"
But I keep getting core dumps:
[DASH]: WARNING! DASH Live profile requested but no -segment-name
using "%s_dash" by default
DASH-ing files: 3.00s segments 3.00s fragments single sidx per segment
Spliting segments at GOP boundaries [DASH] Generating MPD at time 2014-06-24T15:26:09Z
Segmentation fault (core dumped)
Is it normal?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After making some experiences with the latest ffmpeg (version N-62004-g5b03caf built on Mar 31 2014 22:12:13 by Zeranoe) together with x265 encoder, I found that I could build a .mp4 file with a "hev1" bitstream where each keyframe has the VPS and SPS header (AFAIK this option can only be used with ffmpeg through the API of the x265 encoder: repeat-headers=1):
But aparently when I extract both bitstreams and remux them to .mp4 with mp4box, the video bitstream is converted to "hvc1":
To rebuild the .mp4, I tried different parameters (-rap -ocr -iod -hint) but with no luck. Is mp4box supposed to mess with the bitstream?
The command I used for ffmpeg is:
ffmpeg.exe -i "%fname%.mp4" -vf scale=%resolution% -c:a copy -frames:v 100 -c:v libx265 -preset ultrafast -x265-params repeat-headers=1:vui=1:timinginfo=1:hash=2:bitrate=%bitrate%:vbv-maxrate=%mux_bitrate%:vbv-bufsize=%buffer%:no-open-gop=1:keyint=%GOP%:no-scenecut=1:rc-lookahead=4:ref=4 "play_%fname%%resolution%%bitrate%.mp4"
Hi,
'hvc1' stores SPS/PPS in a specific avcC box while 'hev1' stores SPS/PPS inband. It does not change the stream itself, it separates the metadata from the data (which is a key element of ISOBMF).
Can you be little more precise about how this bothers you? What do you expect from writing here?
Romain
Hi Romain,
I have a player that was shown to work only with 'hev1' streams, but since mp4box transforms it to 'hvc1', I could not play it. Meanwhile I figured out how to produce a .mp4 file with ffmpeg that outputs 'hev1' (using the repeat-headers flag).
Unfortunately the player still has problems, more precisely, when playing a DASH stream, it stops playing the stream after the first fragment. I though it was because of the Parameters Sets, but I am not sure anymore.
Last edit: Luis R 2014-04-07
Hi Luis,
Thanks for the clarification. The feature to convert an mp4 file between 'hev1' and 'hvc1' (and similarly for AVC) would be interesting. We will try to implement it.
In the meantime, in A DASH context you can try to use the "-bs-switching" option (see MP4Box -h dash). In particular the "single" mode should work for you. It should create an initialization segment of type 'hev1'.
HTH. Let us know if this solves your problem.
Cyril
I finally resolved my problem. I needed to split the file into 2 independent streams:
"mp4box.exe -profile live -dash-scale 1000 -dash 9000 -frag 3000 .\media.mp4#video:role=video .\media.mp4#audio:role=audio -out .\dash_media.mpd"
Meanwhile while trying to do the same thing with dash-live option
"mp4box.exe -profile live -dynamic -dash-live 3000 .\media.mp4#video:role=video .\media.mp4#audio:role=audio -out C:\DASH\media.mpd"
I keep getting the error after the sleep:
Live DASH-ing - press 'q' to quit, 's' to save context and quit
[DASH]: WARNING! DASH Live profile requested but no -segment-name
using "%s_dash" by default
DASH-ing files: 3.00s segments 3.00s fragments single sidx per segment
Spliting segments at GOP boundaries
[DASH] Generating MPD at time 2014-05-19T15:29:06Z
[DASH] MPD AvailabilityStartTime 2014-05-19T15:29:06Z
DASHing file .\media.mp4
DASHing file .\media.mp4
sleep for 29602 ms
[DASH] Removing segment C:\DASH\media_dash_track1_1.m4s - 26.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_2.m4s - 23.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_3.m4s - 20.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_4.m4s - 17.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_5.m4s - 14.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_6.m4s - 11.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_7.m4s - 8.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_8.m4s - 5.026 sec too late
[DASH] Removing segment C:\DASH\media_dash_track1_9.m4s - 2.026 sec too late
[DASH]: WARNING! DASH Live profile requested but no -segment-name
using "%s_dash" by default
DASH-ing files: 3.00s segments 3.00s fragments single sidx per segment
Spliting segments at GOP boundaries
[DASH] Generating MPD at time 2014-05-19T15:29:36Z
[DASH] MPD AvailabilityStartTime 2014-05-19T15:29:06Z
DASHing file .\media.mp4
Error while DASH-ing file: Bad Parameter
Error DASHing file: Bad Parameter
I don't think it is the source stream that has a problem, since I used 3s GOPs with H264 codec.
If I don't split the files "mp4box.exe -profile live -dynamic -dash-live 3000 .\media.mp4 -out C:\DASH\media.mpd" everything works fine.
I am using the current build (0.5.1-DEV-rev5258)
Hi,
I can indeed reproduce your problem with a source of mine. Thanks for reporting. We'll try to fix it asap.
Cyril
Hi,
Ok, I'll be waiting on the new version.
Meanwhile I discovered another error while trying a workaround. I tried to DASH a stream with the "dynamic" flag as demonstrated here:
"mp4box -profile live -rap -dash-scale 1000 -dash 3000 -dynamic media.mp4#video media.mp4#audio -out DASH/media.mpd"
But I keep getting core dumps:
[DASH]: WARNING! DASH Live profile requested but no -segment-name
using "%s_dash" by default
DASH-ing files: 3.00s segments 3.00s fragments single sidx per segment
Spliting segments at GOP boundaries
[DASH] Generating MPD at time 2014-06-24T15:26:09Z
Segmentation fault (core dumped)
Is it normal?
obviously not normal, now fixed on SVN thanks for the report