Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th January 2011, 05:54   #81  |  Link
7ekno
Guest
 
Posts: n/a
Quote:
Originally Posted by reinen View Post
I also tried to lower the reference frames from 16 to 4
Only way of doing that is via transcoding, changing a number in the header won't affect how many reference frames appear in the physical video stream ....

7ek
  Reply With Quote
Old 22nd February 2011, 12:12   #82  |  Link
LRN
TeMa=) team member
 
LRN's Avatar
 
Join Date: Apr 2005
Location: Universe, Galaxy, Solar System, Earth, Russia, Moscow
Posts: 212
There's a problem with this fork. At http colon slash slash lrn.no-ip.info/other/wb_100/wb_100.tar.xz you can grab:
ffmpeg.exe - the remuxer i've used.
wb_100.264 - original sequence encoded with x264 without any SAR changes. Recognized as valid h.264 stream.
wb_100_x264_sar.264 - original sequence encoded with x264 with --sar 64:45 option. Recognized as valid h.264 stream.
wb_100_fixed.264 - a result of running `ffmpeg.exe -i wb_100.264 -vcodec copy -vbsf h264_changesps=sar=64:45 wb_100_fixed.264' . It is not regognized as valid h.264 stream
With a hex editor i was able to fix wb_100_fixed.264 by changing 3rd byte from 0x1D to 0x01 (so that it matches wb_100_x264_sar.264 and wb_100.264). I have not bothered to debug the fork to find why this byte changes suddenly.
__________________
Without effort, you can't even pull a fish out of the pond.
Without a pond you can't pull it out even with effort.
LRN is offline   Reply With Quote
Old 22nd February 2011, 19:49   #83  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
@LRN have you tested for other arguments too? (fps, level, crop, etc)...
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!
b66pak is offline   Reply With Quote
Old 24th February 2011, 14:19   #84  |  Link
LRN
TeMa=) team member
 
LRN's Avatar
 
Join Date: Apr 2005
Location: Universe, Galaxy, Solar System, Earth, Russia, Moscow
Posts: 212
No, i did not.
I did test it with different combinations of sar. For example, it produces valid file when invoked with sar=4:3 (or was it 5:4? i don't remember).
__________________
Without effort, you can't even pull a fish out of the pond.
Without a pond you can't pull it out even with effort.
LRN is offline   Reply With Quote
Old 24th February 2011, 16:25   #85  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
My bad. Because 64:45 is not in H264's pre-defined SAR list(while 4:3 is), setting to such SAR value will change the length of SPS. For MP4 style bitstream, there is a 4-byte field before each nal telling the size of the nal. The filter tries to modify it even if the bitstream is AnnexB which has no such bytes.
This bug will be fixed in next release.

P.S. mplayer/ffmpeg's svn server is blocking all IPs from China mainland and Hong Kong. It is now difficult for me to sync to the latest ffmpeg code.
Further worse, sf.net has reset passwords for all users by email and unfortunately my email address registered on sf.net is no longer available. I can neither upload code nor release files.

Last edited by roozhou; 24th February 2011 at 16:31.
roozhou is offline   Reply With Quote
Old 24th February 2011, 16:47   #86  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by roozhou View Post
P.S. mplayer/ffmpeg's svn server is blocking all IPs from China mainland and Hong Kong. It is now difficult for me to sync to the latest ffmpeg code.
Does the same happen with the git repository?
nm is offline   Reply With Quote
Old 24th February 2011, 17:20   #87  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Quote:
Originally Posted by nm View Post
Does the same happen with the git repository?
git is OK
roozhou is offline   Reply With Quote
Old 24th February 2011, 23:42   #88  |  Link
bernd_b
Registered User
 
Join Date: Jan 2003
Location: Germany
Posts: 65
I wanted a h264-video being 23.976 fps becoming 24fps:

Code:
ffmpeg.exe -i Monk.S07E01_conv.mkv -vcodec copy -acodec copy -vbsf h264_changesps=fps=24000:1000 Monk.S07E01_video.mkv
But mediainfo still indicates me, that only the container has turned into 24 fps, there is still the information of the h264-stream to be 23,976 fps - or am I on the wrong track here:

Code:
mediainfo Monk.S07E01_video.mkv 
General
Unique ID                        : 302061734355895109743642512766325178364 (0xE33EF953255B3DC619A6ADC0A4D33FFC)
Complete name                    : Monk.S07E01_video.mkv
Format                           : Matroska
File size                        : 1.34 GiB
Duration                         : 43mn 7s
Overall bit rate                 : 4 456 Kbps
Writing application              : Lavf52.92.0
Writing library                  : Lavf52.92.0

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L3.1
Format settings, CABAC           : No
Format settings, ReFrames        : 2 frames
Codec ID                         : V_MPEG4/ISO/AVC
Duration                         : 43mn 7s
Bit rate mode                    : Variable
Bit rate                         : 3 919 Kbps
Maximum bit rate                 : 2 097 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate                       : 24.000 fps
Original frame rate              : 23.976 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.177
Stream size                      : 1.18 GiB (88%)
Language                         : English
Color primaries                  : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics         : BT.709-5, BT.1361
Matrix coefficients              : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

Audio
ID                               : 2
Format                           : AC-3
Format/Info                      : Audio Coding 3
Mode extension                   : CM (complete main)
Codec ID                         : A_AC3
Duration                         : 43mn 7s
Bit rate mode                    : Constant
Bit rate                         : 448 Kbps
Channel(s)                       : 6 channels
Channel positions                : Front: L C R, Side: L R, LFE
Sampling rate                    : 48.0 KHz
Bit depth                        : 16 bits
Compression mode                 : Lossy
Stream size                      : 138 MiB (10%)
Language                         : English
bernd_b is offline   Reply With Quote
Old 25th February 2011, 02:40   #89  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
@bernd_b
Add -muxerfps 24000/1001 to ffmpeg's parameters.
roozhou is offline   Reply With Quote
Old 26th February 2011, 21:40   #90  |  Link
bernd_b
Registered User
 
Join Date: Jan 2003
Location: Germany
Posts: 65
Thanks for your reply - but I am still stuck.

Code:
ffmpeg.exe -i Monk.S07E01_conv.mkv -muxerfps 24000/1001 -vcodec copy -acodec copy -vbsf h264_changesps=fps=24000:1000 Monk.S07E01_video.mkv

...

mediainfo Monk.S07E01_video.mkv
...
Display aspect ratio             : 16:9
Frame rate                       : 23.976 fps
Color space                      : YUV
...
Is it a problem that I actually use the windows version with wine under Linux?

Even If I try to transform the video alone I get the input and the output to be 23.976fps:
Quote:
mediainfo Monk.S07E01_conv.h264
General
Complete name : Monk.S07E01_conv.h264
Format : AVC
Format/Info : Advanced Video Codec
File size : 1.21 GiB

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : No
Format settings, ReFrames : 2 frames
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
...

wine ffmpeg.exe -i Monk.S07E01_conv.h264 -vcodec copy -acodec copy -vbsf h264_changesps=fps=24000:1000 Monk.S07E01_video.h264

...

FFmpeg version SVN-r26292, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 24 2011 20:49:50 with gcc 4.4.5
configuration:
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 0 / 0.16. 0
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.92. 0 / 52.92. 0
libavdevice 52. 2. 3 / 52. 2. 3
libswscale 0.12. 0 / 0.12. 0
[h264 @ 00120470] max_analyze_duration reached
[h264 @ 00120470] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (48000/2002)
Input #0, h264, from 'Monk.S07E01_conv.h264':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1200k tbn, 47.95 tbc
fixme:msvcrt:MSVCRT__sopen_s : pmode 0x01b6 ignored
Output #0, h264, to 'Monk.S07E01_video.h264':
Metadata:
encoder : Lavf52.92.0
Stream #0.0: Video: [0][0][0][0] / 0x0000, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=0-0, 90k tbn, 23.98 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=62102 fps=971 q=-1.0 Lsize= 1264842kB time=2590.11 bitrate=4000.4kbps
video:1264842kB audio:0kB global headers:0kB muxing overhead 0.000000%


mediainfo Monk.S07E01_video.h264
General
Complete name : Monk.S07E01_video.h264
Format : AVC
Format/Info : Advanced Video Codec
File size : 1.21 GiB

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : No
Format settings, ReFrames : 2 frames
Bit rate mode : Variable
Maximum bit rate : 2 097 Kbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
...
bernd_b is offline   Reply With Quote
Old 2nd March 2011, 18:45   #91  |  Link
chompy
Registered User
 
Join Date: Jul 2004
Posts: 213
Could this tool be used to "repair" DTS of a h264 stream (DTS of AU is not greater than DTS of previous AU), that is, is there a way to remove all DTS, and then correctly regenerate them again?

Greetings

EDIT:

Quote:
Originally Posted by roozhou View Post
MKV contains only PTS while MP4/FLV require both PTS and DTS. FFmpeg currently lacks the ability to generate DTS based on PTS. I have done some hack on the MKV demuxer so my ffmpeg generates correct DTS from MKV. That's why only my ffmpeg works on MKV.
I've tried H264 -> mkv -> H264 but the resulting file doesn't work, what should I do? Maybe H264 -> mkv -> mp4 -> H264? Or this DTS generation only works on containers but not on raw streams?

Last edited by chompy; 3rd March 2011 at 10:10.
chompy is offline   Reply With Quote
Old 11th March 2011, 19:35   #92  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Quote:
Originally Posted by chompy View Post
Could this tool be used to "repair" DTS of a h264 stream (DTS of AU is not greater than DTS of previous AU), that is, is there a way to remove all DTS, and then correctly regenerate them again?
Greetings
EDIT:
I've tried H264 -> mkv -> H264 but the resulting file doesn't work, what should I do? Maybe H264 -> mkv -> mp4 -> H264? Or this DTS generation only works on containers but not on raw streams?
Sorry, my tool only modifies SPS and nothing else in H264 bitstream.
roozhou is offline   Reply With Quote
Old 11th March 2011, 19:36   #93  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
New build available.

@LRN
bug fixed.
roozhou is offline   Reply With Quote
Old 11th March 2011, 20:31   #94  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
thanks a lot...
_

L.E. is not working for me...a line like this is a deadlock!
Code:
ffmpeg -i sample.mkv -vcodec copy -an -sn sample.mp4
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!

Last edited by b66pak; 11th March 2011 at 20:53.
b66pak is offline   Reply With Quote
Old 12th March 2011, 09:35   #95  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Quote:
Originally Posted by b66pak View Post
thanks a lot...
_

L.E. is not working for me...a line like this is a deadlock!
Code:
ffmpeg -i sample.mkv -vcodec copy -an -sn sample.mp4
_
I have no idea where does this problem come. I was using git branch from videolan. Plz download the new build which I build from the official git branch.
roozhou is offline   Reply With Quote
Old 12th March 2011, 20:58   #96  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
now its ok...thanks a lot...
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!
b66pak is offline   Reply With Quote
Old 2nd May 2011, 21:32   #97  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
How to correctly crop 1088 to 1080?

I tried:
Code:
ffmpeg -i 1088.h264 -vcodec copy -an -vbsf h264_changesps=crop=0:8 1080.h264
But mkvmerge still detects 1088 lines and mediainfo says the following about the output:
Code:
Width                            : 1 920 pixels
Height                           : 1 088 pixels
Original height                  : 1 080 pixels
sneaker_ger is offline   Reply With Quote
Old 3rd May 2011, 03:45   #98  |  Link
Audionut
Registered User
 
Join Date: Nov 2003
Posts: 1,281
You cannot crop without recoding.
__________________
http://www.7-zip.org/
Audionut is offline   Reply With Quote
Old 3rd May 2011, 04:34   #99  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by Audionut View Post
You cannot crop without recoding.
I'm certainly not sure, but I don't think it is true for all cases - at least 1088 to 1080 should be possible, because H.264 works with mod16 resolutions internally anyways. I think that there may also be a SPS for the resolution which also needs to be changed and this feature might be missing at the moment.
sneaker_ger is offline   Reply With Quote
Old 3rd May 2011, 04:42   #100  |  Link
Audionut
Registered User
 
Join Date: Nov 2003
Posts: 1,281
Quote:
Originally Posted by sneaker_ger View Post
at least 1088 to 1080 should be possible, because H.264 works with mod16 resolutions internally anyways.
Blu-ray 1088 is cropped to 1080 by the decoder.

When x264 adds lines to bring content to mod16 for encoding, the decoder crops that information at playback.

If you want to actually remove (crop) lines of resolution from the source. You will have to re-encode.
__________________
http://www.7-zip.org/
Audionut is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.