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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th May 2013, 03:48   #1  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
How to generate a correct raw h.264 video?

Hi
Raw format videos such as raw h.264 videos (.264) does not have any container and sometimes it ended up with some malfunctioning. for example when i want to convert any .mp4 video to raw .264 format, the encoded video plays two times faster than the original mp4 video, which is probably due to lack of timing information in the raw format. i used ffmpeg command for the encoding.
Can you suggest any solution for this problem? maybe you offer other tools for generating .264 files.

cheers
Rouhi is offline   Reply With Quote
Old 29th May 2013, 07:51   #2  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 676
I'm guessing it was something to do with the way you converted it and / or the command line you used.

But if you want a no hassle way to encode a raw .264 you could use any decent front-end i.e MeGUI (uses x264) which will let you output a .h264 file only if you choose.

Load up MeGUI, and from the Tools Dropdown Menu, run the File Indexer (use ffmpegsource as the indexer for mkv/mp4 files), select whether you want audio demuxed or not, and after you're done setting things up hit the queue button. It will index the file.
Next select AVS script creator (which you shouldn't need to touch if you're not doing anything to the video) and select the generated index file. Hit "Save" and the AVS will be auto-loaded into the "Video encoding" section of the main window. Set your encoding profile, set output to RAWAVC, queue and wait.

Done.

Last edited by osgZach; 29th May 2013 at 08:01.
osgZach is offline   Reply With Quote
Old 29th May 2013, 17:51   #3  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 552
If it is playing exactly twice as fast as was original and not some fixed fps than it mostly sound as problem of parser/decoder part and not encoding part. IIRC there was bug like this in VLC. What are you using to play the files?
MasterNobody is offline   Reply With Quote
Old 29th May 2013, 19:01   #4  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Use x264.exe with the correct --fps option to generate proper vui data.
Guest is offline   Reply With Quote
Old 31st May 2013, 06:27   #5  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
MasterNobody: I use ffplay for playing the file. And i guess you noticed correctly the reason.
neuron2 & osgZach: I didnt use x264 but i found out using Mencoder can help me to encode any video to raw .264 file format without any problem in the playback file. But i dont know how to ask Mencoder to put an I-frame on each second of the video, no less and no more...Whats your advise? is it possible to request it from encoder?
Rouhi is offline   Reply With Quote
Old 10th June 2013, 01:57   #6  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
I noticed that when i use Mencoder to encode a video stream to a raw .264 video stream, the result is not actually a .264. it is an AVI in fact, with header and all the other parts needed by a container such as AVI. just the extension is .264.
do you have any idea how to generate a pure .264 stream by mencoder?
Rouhi is offline   Reply With Quote
Old 10th June 2013, 06:04   #7  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,989
Neuron2 has answered your question already. Have you tried this?

Here's an example command line, including your unusual request for a fixed one second IDR interval.

Code:
x264.exe --input foo.avs --fps 25 --keyint 25 --no-scenecut --output bar.264
Add --b-adapt 0 if you want to make the GOP truly fixed.
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 11th June 2013, 08:12   #8  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
Thanks for your reply.
I used the x264 and you can see the result as bellow. (The video fps is 30 and i used this value instead of 25 in your example)
But still when i play the result it plays so fast even more than the time i use ffmpeg as encoder.
please notice the result of x264 encoder at the last line. It says 20 fps but i mentioned 3o in encoding command. I really confused.


C:\>x264.exe --fps 30 --keyint 30 --no-scenecut --b-adapt 0 -o "c:\zarix264.264" "c:\zari.mp4"

ffms [info]: 1280x720p 0:1 @ 4283/143 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
x264 [info]: profile High, level 3.1
x264 [info]: frame I:13 Avg QP:20.48 size: 47230
x264 [info]: frame P:101 Avg QP:23.90 size: 12712
x264 [info]: frame B:265 Avg QP:26.67 size: 3545
x264 [info]: consecutive B-frames: 6.6% 0.5% 0.0% 92.9%
x264 [info]: mb I I16..4: 22.0% 55.2% 22.8%
x264 [info]: mb P I16..4: 1.9% 2.7% 0.3% P16..4: 49.3% 14.0% 7.2% 0.0% 0
.0% skip:24.6%
x264 [info]: mb B I16..4: 0.1% 0.1% 0.0% B16..8: 42.6% 2.0% 0.2% direct:
1.6% skip:53.4% L0:45.0% L1:52.5% BI: 2.4%
x264 [info]: 8x8 transform intra:54.9% inter:89.5%
x264 [info]: coded y,uvDC,uvAC intra: 60.0% 72.4% 32.4% inter: 9.6% 23.2% 0.3%
x264 [info]: i16 v,h,dc,p: 51% 20% 8% 21%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 20% 11% 5% 6% 6% 6% 9% 6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 22% 7% 5% 8% 7% 6% 7% 4%
x264 [info]: i8c dc,h,v,p: 38% 21% 27% 14%
x264 [info]: Weighted P-Frames: Y:2.0% UV:1.0%
x264 [info]: ref P L0: 62.4% 11.1% 20.0% 6.4% 0.0%
x264 [info]: ref B L0: 87.7% 10.5% 1.8%
x264 [info]: ref B L1: 94.7% 5.3%
x264 [info]: kb/s:1796.74

encoded 379 frames, 20.21 fps, 1796.74 kb/s

C:\>ffplay zarix264.264
ffplay version N-53577-gced0307 Copyright (c) 2003-2013 the FFmpeg developers
built on May 28 2013 12:27:19 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 34.100 / 52. 34.100
libavcodec 55. 12.100 / 55. 12.100
libavformat 55. 7.100 / 55. 7.100
libavdevice 55. 1.101 / 55. 1.101
libavfilter 3. 72.100 / 3. 72.100
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
[h264 @ 0000000002489220] max_analyze_duration 5000000 reached at 5000000 micros
econds
Input #0, h264, from 'zarix264.264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 1280x720, 30 fps, 30 tbr, 1200k tb
n, 60 tbc
nan A-V: 0.000 fd= 0 aq= 0KB vq= 41KB sq= 0B f=0/0

C:\>
Rouhi is offline   Reply With Quote
Old 11th June 2013, 10:08   #9  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 957
Quote:
Originally Posted by Rouhi View Post
encoded 379 frames, 20.21 fps, 1796.74 kb/s
That is the speed at which x264 encoded the video. As in it encoded 379 frames in 18.75 seconds. Not the video's framerate.
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.
J_Darnley is offline   Reply With Quote
Old 12th June 2013, 07:44   #10  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
ok, you are right.
assume that i want to play the raw .264 file. how can i play it normally? it does not have any time frame so ffplay can not show it in normal speed (fps) when i play the .264 file. Do you suggest any player to cope the problem?
BTW, if i want to force the .264 video stream has only one single i-frame per second, how can i do that by x264?
Thanks
Rouhi is offline   Reply With Quote
Old 12th June 2013, 10:06   #11  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,989
If your input video is indeed 30fps, then you are forcing one I frame per second in your command line.

I'm not sure why ffplay isn't playing correctly.
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 13th June 2013, 08:12   #12  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
if --b-adapt 0 make a fixed GoP, with an I-frame in each group, what if our video contains some huge scene changes in less than a second? how the raw .264 stream can handle this?
I say this because naturally encoders should create new I-Frames for every massive scene changes, regardless of their time frame, otherwise encoder would not be able to predict the content of following P and B frames from the previous frames. whats your suggestion?
Rouhi is offline   Reply With Quote
Old 13th June 2013, 13:14   #13  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by Rouhi View Post
But i dont know how to ask Mencoder to put an I-frame on each second of the video, no less and no more...Whats your advise? is it possible to request it from encoder?
Quote:
Originally Posted by Rouhi View Post
if --b-adapt 0 make a fixed GoP, with an I-frame in each group, what if our video contains some huge scene changes in less than a second? how the raw .264 stream can handle this?
I say this because naturally encoders should create new I-Frames for every massive scene changes, regardless of their time frame, otherwise encoder would not be able to predict the content of following P and B frames from the previous frames. whats your suggestion?
You have to make up your mind first. You either want a fixed gop with exactly one I(DR) frame after every second OR you want scenecut detection. You cannot have both. Usually, you do not want a fixed gop, but just tell the encoder to use at least one keyframe per second, i.e. leave scenecut detection on and just set --keyint to whatever maximum keyframe interval you want.
sneaker_ger is offline   Reply With Quote
Old 14th June 2013, 01:31   #14  |  Link
Rouhi
Registered User
 
Join Date: Apr 2011
Posts: 64
Actually i dont want scenecut detection. What i want is exactly one I-Frame in each second. Thats it. And if i get the time -slice of that i-frame, then it would be great more than enough .......
FFMPEG could not do that for me. I hope x264 can do.
Rouhi is offline   Reply With Quote
Reply


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 21:27.


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