View Full Version : Video broadcasting based on X264
MaiTiano
30th June 2011, 03:25
I am currently working on a project which push HD video stream online to the users. In other word, I am doing the video broadcasting work.
In this project, I need to compress the source video by x264. Therefore, I have been always finding a suitable x264 configuration, like max keyint, min-keyint, vbv-maxrate and so on.
Is there anyone who can help me on this topic? Maybe you can help me to provide some classic x264 configuration used by you.
Many thanks. :thanks:
Blue_MiSfit
30th June 2011, 04:58
What do you want to know?
What's the resolution of the content you're "broadcasting"? This isn't really broadcasting, it sounds a lot more like streaming or progressive download. You're not doing cable, satellite, or over-the-air broadcasting, right?
MaiTiano
30th June 2011, 07:26
What do you want to know?
What's the resolution of the content you're "broadcasting"? This isn't really broadcasting, it sounds a lot more like streaming or progressive download. You're not doing cable, satellite, or over-the-air broadcasting, right?
Thanks for your reply.
[1] The resolution used in my project are 1080i or 720p.
[2] Yes. It is not the real broadcasting. In fact, the simple process would be like this:
record the satellite signal -> store in the source file (like in wmv format) -> compress it and process the video file in real-time -> provide the video streaming.
:thanks:
Blue_MiSfit
30th June 2011, 08:02
Satellite source in WMV format? I've never heard of that.
If you want to do real-time streaming, I'm not sure what tools to suggest. I gather VLC has some functionality, maybe ffmpeg does too? Not sure.
Most of my experience is with offline encoding.
[2] Yes. It is not the real broadcasting. In fact, the simple process would be like this:
record the satellite signal -> store in the source file (like in wmv format) -> compress it and process the video file in real-time -> provide the video streaming.
If your source is a recording, why do you want to process it in real-time?
MaiTiano
30th June 2011, 10:35
If your source is a recording, why do you want to process it in real-time?
Here is the thing:
The video recorded is based on the satellite signal.
While the goal of my project is to push the video stream through internet which make more people can enjoy almost the same video program on there computer instead of watching the program on there TV set.
Any idea on the x264 parameter set for the middle step of video compression?
Boogerlad
30th June 2011, 16:30
why store when you can encode on the fly?
pandy
30th June 2011, 18:08
http://obe.wikia.com/wiki/Open_Broadcast_Encoder_Wiki
MaiTiano
1st July 2011, 01:27
http://obe.wikia.com/wiki/Open_Broadcast_Encoder_Wiki
Thanks, Pandy, I will take a look at this website.:)
kieranrk
1st July 2011, 01:49
Thanks, Pandy, I will take a look at this website.:)
At this time it can't do what you're looking for. Patches welcome though.
MaiTiano
1st July 2011, 02:21
At this time it can't do what you're looking for. Patches welcome though.
I have not carefully dig the functions and usage of that OBE system.
May I ask what do mean by "At this time it can't do what you're looking for ":confused:
Thanks
kieranrk
1st July 2011, 02:24
I have not carefully dig the functions and usage of that OBE system.
May I ask what do mean by "At this time it can't do what you're looking for ":confused:
Thanks
At the moment the current codebase can take in uncompressed video from SDI sources - this is a professional video transport system.
You can probably use VLC for your task.
MaiTiano
1st July 2011, 02:52
At the moment the current codebase can take in uncompressed video from SDI sources - this is a professional video transport system.
You can probably use VLC for your task.
Thank you very muck.
As you said, only the uncompressed video from SDI sources can be input in your system.
What a pity that I cannot use your system to help me on this project.
May I ask a further question? After the signal input, the video signal is still need to be compressed by x264, right? Then, do you have any idea or recommendation on x264 parameters setting for this kind of use?
Many thanks.:thanks:
Blue_MiSfit
1st July 2011, 06:49
resolution? bitrate? what player are you targeting?
MaiTiano
1st July 2011, 06:52
resolution? bitrate? what player are you targeting?
Source resolution would be 1920x1080.
Target resolution would be 720x576, target bitrate would be 600K~1200K.
Player would be flash player.
Blue_MiSfit
2nd July 2011, 05:53
Streaming or progressive download? What is the connection speed of your consumers?
Start with the following. I write in x264.exe speak, not sure how VLC implements x264 parameters.
x264.exe foo.bar --bitrate 1000 --vbv-maxrate 1200 --vbv-bufsize 1200 --tune film --output foo.baz
pandy
5th July 2011, 11:07
At the moment the current codebase can take in uncompressed video from SDI sources - this is a professional video transport system.
IP not work?
kieranrk
5th July 2011, 11:32
IP not work?
An FFmpeg module is included but it's not very good. Packets are delivered in the wrong order amongst other things.
pandy
5th July 2011, 12:37
Hmmm, not a good info.
kieranrk
5th July 2011, 12:50
Hmmm, not a good info.
A new threaded input, demux and decode will need to be written in the future - it'll be easier to take some of this from VLC.
pandy
5th July 2011, 13:03
reading from file and writing to file seems more useful from my perspective - i have many TS players and modulators but only one ASI/SDI card - anyway waiting for each new release OBE and once more THX Kieranrk.
MrVideo
17th July 2011, 10:19
Satellite source in WMV format? I've never heard of that.
Rightly so, since it doesn't exist. WMV would suck for this anyway. Sat muxes use Transport Streams. Every sat feed that I personally capture is saved in a transport stream, i.e., *.ts file.
pandy
18th July 2011, 12:05
Satellite source in WMV format? I've never heard of that.
Rightly so, since it doesn't exist. WMV would suck for this anyway. Sat muxes use Transport Streams. Every sat feed that I personally capture is saved in a transport stream, i.e., *.ts file.
perhaps VC-1 (misnamed as WMV)?
Anyway You can embed WMV (even non VC1) as private data in any TS.
popper
23rd July 2011, 17:28
Source resolution would be 1920x1080.
Target resolution would be 720x576, target bitrate would be 600K~1200K.
Player would be flash player.
600Kbit/s would be crap on most streaming 720P content for 16/9 720P today.
most good visual quality end user feeds on http://veetle.com/index.php/listing#movies/quality/2 for instance use
between at least 750Kbit/s and 1.3Mbit/s, average is 1.1Mbit/s ,
but even if you are a veetle broadcaster with enough upload rate remember if you
put in a crap fuzzy feed you get crap fuzzy quality out OC.
Streaming or progressive download? What is the connection speed of your consumers?
Start with the following. I write in x264.exe speak, not sure how VLC implements x264 parameters.
x264.exe foo.bar --bitrate 1000 --vbv-maxrate 1200 --vbv-bufsize 1200 --tune film --output foo.baz
the ffmpeg line would be something like this for producing veetle stream-able VLC/broadcast files.
MaiTiano, you may need a current ffmpeg for these options to work though http://ffmpeg.zeranoe.com/builds/
ffmpeg.exe -threads 4 -i "infile" -f mp4 -vcodec libx264 -crf 18 -minrate 750k -maxrate 1100k -bufsize 1100k -preset slow
-profile main "outfile.MP4"
you may also want to add in a selection of the included filters
-vf yadif -vf gradfun -vf hqdn3d -vf unsharp
for a given "infile" to try and improve the output quality sometimes.
this simple bat works fine for producing mp4 from mkv files sat in a dir somewhere for instance
copy your ffmpeg this bat and make a dir "2" in there and run the bat (change .mkv for .avi or whatever you like as input)
------------------------
@echo on
REM SETLOCAL ENABLEDELAYEDEXPANSION
set srcPATH=.\
set dstPATH=.\2\streamable-
FOR %%A in ("%srcPATH%*.mkv") DO (
ffmpeg.exe -threads 4 -i "%%A" -f mp4 -vcodec libx264 -crf 18 -minrate 800k -maxrate 1300k -bufsize 1300k -refs 3 -preset fast -profile main -strict experimental -acodec aac -ac 2 -ab 128k -vf hqdn3d -vf gradfun -vf unsharp "%dstPATH%%%~nA.MP4"
)
REM -vf yadif -vf gradfun -vf hqdn3d -vf unsharp
pause
-------------------------------
its a shame no one has got around to re-factoring all the x264 CLI options into a current ffmpeg/libav yet
such as --b-pyramid none --weightp 0 (VLC pyramid=none:weightp=0) for instance
(that i can find, then you could use -profile high) as veetle etc seem to
need these two options set to play back content properly in their old veetle/VLC browser plug-ins...
ooh and you might try feeding veetle or your new equivalent/better external streaming app like so
c:\vlc-1.2.0-git-20110701>vlc "c:\1\2\streamable-RocketshipXM-ffmpeg.ts" :sout=#std{access=http,mux=asf,dst=127.0.0.1:1234}
600Kbit/s would be crap on most streaming 720P content for 16/9 720P today.
He was talking about 576p which needs about half the bits of 720p. Although IMO, converting 1080p to non-square-pixel size doesn't make much sense for web distribution alone.
you may also want to add in a selection of the included filters
-vf yadif -vf gradfun -vf hqdn3d -vf unsharp
for a given "infile" to try and improve the output quality sometimes.
Only use yadif for interlaced sources. gradfun probably doesn't help at all when doing low-bitrate encodes. hqdn3d is useful for fast denoising and degraining, but it also removes detail. unsharp might be ok to sharpen blurry videos.
ffmpeg.exe -threads 4 -i "%%A" -f mp4 -vcodec libx264 -crf 18 -minrate 800k -maxrate 1300k -bufsize 1300k -refs 3 -preset fast -profile main -strict experimental -acodec aac -ac 2 -ab 128k -vf hqdn3d -vf gradfun -vf unsharp "%dstPATH%%%~nA.MP4"
You specify multiple -vf options, in which case ffmpeg will only use the last one: -vf unsharp
What you probably wanted is -vf hqdn3d,gradfun,unsharp, but I'd leave gradfun out for low-bitrate encoding.
its a shame no one has got around to re-factoring all the x264 CLI options into a current ffmpeg/libav yet
such as --b-pyramid none --weightp 0 (VLC pyramid=none:weightp=0) for instance
-flags2 -bpyramid and -wpredp 0
popper
3rd August 2011, 15:36
He was talking about 576p which needs about half the bits of 720p. Although IMO, converting 1080p to non-square-pixel size doesn't make much sense for web distribution alone.
Only use yadif for interlaced sources. gradfun probably doesn't help at all when doing low-bitrate encodes. hqdn3d is useful for fast denoising and degraining, but it also removes detail. unsharp might be ok to sharpen blurry videos.
You specify multiple -vf options, in which case ffmpeg will only use the last one: -vf unsharp
What you probably wanted is -vf hqdn3d,gradfun,unsharp, but I'd leave gradfun out for low-bitrate encoding.
-flags2 -bpyramid and -wpredp 0
thanks for the tips NM , its hard to find real tried and tested working full current ffmpeg command lines in the mass of old Google pages out there today.
ill amend my scripts and try it again sometime soon, it just seemed most logical to simply add each -vf filter option as you required and a current ffmpeg would parse and add them all to the chain as required, the help pages didn't help clarify the exact syntax there...
-flags2 -bpyramid and -wpredp 0
thanks for that, although again it seems odd to me that ffmpeg wants "-flags2 -bpyramid" to set bpyramid to 0 (or =none : off) without stating the =none option (in this options case), given both x264 and VLC want and need a =none or valid number for all their options to make it clear.
non the less, the working line for the script should be something like
ffmpeg.exe -threads 4 -i "%%A" -f mp4 -vcodec libx264 -crf 18 -minrate 800k -maxrate 1300k -bufsize 1300k -refs 3 -preset fast -profile high -flags2 -bpyramid -wpredp 0 -strict experimental -acodec aac -ac 2 -ab 128k -vf hqdn3d,unsharp "%dstPATH%%%~nA.MP4"
to produce content that will properly play back in the old veetle/VLC browser plug-ins now then, thanks again.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.