Hi, how can I get the best (or good) results with FFMPEG command line MPEG-2 Video codec? I want to keep the bitrate at 5000kbps. I know 5000kbps is low for MPEG-2, I don't want a perfect picture, I just want it to look better. Here's my code.
for %%a in ("*.*") do ffmpeg -i "%%a" -s 704x576 -pix_fmt yuv420p -r 25 -codec:v mpeg2_qsv -vf setfield=tff -flags +ilme+ildct -g 1 -b:v 5000k -minrate:v 0k -maxrate:v 9000k -bufsize:v 1835008 -scan_offset 1 -ar 48000 -acodec ac3 -b:a 384k -f dvd -muxrate 10080k -packetsize 2048 "DVD %%~na.vob"
pause
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 25 of 25
Thread
-
-
The -g 1 is a big problem and likely your main issue, that means intra encoding (no p, b frames) . You would need many times more bitrate for it to look ok
Use -g 15 for PAL dvd
You can try multipass encoding too
You can look at this thread for supposedly optimal ffmpeg mpeg2 encoding. (But the results are still worse than other mpeg2 encoders)
http://forum.doom9.org/showthread.php?t=174620 -
Thanks for that tip, the video looks better using -g 15. But now I can't control my bitrate (outputting around 4000kbps no matter what my bitrate setting is).
-
To get the requested bitrate you have to use two pass encoding (I don't think the mpeg2_qsv encoder supports this). Or you can try setting the min, max, and average all to the same 5000k.
Last edited by jagabo; 21st Sep 2024 at 23:52.
-
for %%a in ("*.*") do ffmpeg -i "%%a" -s 720x576 -pix_fmt yuv420p -r 25 -codec:v mpeg2video -vf setfield=tff -flags +ilme+ildct -g 15 -b:v 5000k -minrate:v 5000k -maxrate:v 5000k -bufsize:v 1835008 -scan_offset 1 -ar 48000 -acodec ac3 -b:a 384k -f dvd -muxrate 10080k -packetsize 2048 "DVD %%~na.vob"
pauseLast edited by shampistols69; 22nd Sep 2024 at 12:15.
-
@ shampistols69.
Did the last code give you the results you wanted ?
The 5000 bitrate for example.
Since the change in the g setting helped.
Try using twice the framerate for this.
From the code you posted with -r 25 that would be -g 50.
You might read this topic also:
https://forum.videohelp.com/threads/404452-How-to-use-ffmpeg-to-de-telecine-%28de-inte...PAL-to-PAL-25pLast edited by cholla; 22nd Sep 2024 at 11:53.
-
So you switched to the software encoder and constant bitrate. If you want better overall quality you should switch to 2-pass encoding. That will get you the size (bitrate) you want with bits allocated as needed (ie, shots that need more than 5000 kbps will get more, shots that need less will get less, but all will remain between the specified min and max bitrates). So, run ffmpeg twice but add "-pass 1" to the first pass then "-pass 2" to the second.
-
-
REPLY TO cholla
That's confusing.
Did you want me to change it to this? It's not DVD compliant (50fps). It made my screen crash and I had to restart my laptop.
for %%a in ("*.*") do ffmpeg -i "%%a" -s 720x576 -pix_fmt yuv420p -r 50 -codec:v mpeg2video -vf setfield=tff -flags +ilme+ildct -g 50 -b:v 5000k -minrate:v 5000k -maxrate:v 5000k -bufsize:v 1835008 -scan_offset 1 -ar 48000 -acodec ac3 -b:a 384k -f dvd -muxrate 10080k -packetsize 2048 "DVD %%~na.vob"
pause
Keeping 25fps and using -g higher than 15 didn't make any noticeable change to me.
The code above your comment gave me consistent 5000kbps. I'll attach a sample so you can see the result. The source is progressive 25fps, I used the code to make it DVD compliant. -
@shampistols69.
I will take a look at the video samples you attached.
Your last code has an -r 50 also that should have been left at -r 25 with the -g 50.
But from what jagabo posted this is not DVD compliant.
I got the -g 50 from some information about streaming.
If you would like to read it:
http://trac.ffmpeg.org/wiki/EncodingForStreamingSites
jagabo is correct(nothing unusual about that)
-g 15 for PAL or -g 18 for NTSC.
@ jagabo, I have gspot & I took a look but I could not tell what -g was used in one of my video conversions. -
Info about GOP Structure in GSpot (for mpeg2 only, like .mpg or .vob)
See "Structure" in https://en.wikipedia.org/wiki/Group_of_pictures
g corresponds to N.Last edited by Sharc; 22nd Sep 2024 at 14:49. Reason: Link added
-
Yes, the N=12 to the right of |I| <--> |I| is the GOP length. If you press the VGS button to the left of the circled area you will get a dialog where you can see the frame types and other information:
[Attachment 82415 - Click to enlarge]
Red blocs are I frames, green blocks are B frames, blue blocks are P frames.Last edited by jagabo; 22nd Sep 2024 at 17:33.
-
@ Sharc & jagabo.
Thanks both worked to find the -g.
@ shampistols69
I worked on a code for you see if it looks better.
I'm not saying it will but it might.
The sample did not have audio but I left the audio you used in your code.
It has a deinterlacer but MediaInfo still shows it as interlaced.
Code:ffmpeg -i "original.mp4" -vf "dejudder=cycle=4,scale=interl=1,setfield=tff,fieldmatch=mode=pc_n_ub:combmatch=full:combpel=80:cthresh=18,scale=720:576,bwdif=mode=0:deint=1:parity=1" -c:v mpeg2video -r 25 -pix_fmt yuv420p -flags +ilme+ildct -b:v 5000k -minrate:v 0 -maxrate:v 9000k -bufsize:v 1835008 -g 15 -acodec ac3 -b:a 384k -ar 48000 -f dvd -muxrate 10080k -packetsize 2048 original.vob
-
For progressive PAL (25 fps) something relatively simple like this will do; I added some light denoising, it may help in some situations.
Code:ffmpeg -i "S:\shorts\baloons_2.mp4" -aspect 16:9 -vf "hqdn3d=0.5:0.0:2.0:0.0,scale=720:576,chromanr=23" -c:v mpeg2video -r 25 -pix_fmt yuv420p -b:v 7000k -minrate:v 0 -maxrate:v 9000k -bufsize:v 1835008 -g 15 -acodec ac3 -b:a 384k -ar 48000 -f dvd -muxrate 10080k -packetsize 2048 baloons2.vob
-
"Progressive PAL" doesn't exist in reality IMO. Even when the content is progressive it should be encoded - or at least flagged - as interlaced to be PAL DVD compliant (PsF). I have never come across a "progressive PAL" DVD encoded and flagged as progressive, although most (DVD) players may probably play it (?).
Just wondering if someone has ever seen a true "progressive PAL" DVD?
Edit: Proposal for interlaced encoded 2-pass VBR, denoised as suggested by davexnet:
Code:ffmpeg -y -i "%~1" -c:v mpeg2video -b:v 5000k -maxrate 8000k -bf 2 -b_strategy 2 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -mpv_flags qp_rd -flags +ilme+ildct -vf hqdn3d=0.5:0.0:2.0:0.0,crop=1440:1080,scale=720:576,setfield=tff,setsar=16/15 -c:a ac3 -sn -pass 1 "%~1_.vob" ffmpeg -y -i "%~1" -c:v mpeg2video -b:v 5000k -maxrate 8000k -bf 2 -b_strategy 2 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -mpv_flags qp_rd -flags +ilme+ildct -vf hqdn3d=0.5:0.0:2.0:0.0,crop=1440:1080,scale=720:576,setfield=tff,setsar=16/15 -c:a ac3 -sn -pass 2 "%~1_.vob"
Last edited by Sharc; 24th Sep 2024 at 05:55.
-
I only have 2 PAL DVDs.
Both are Written or burned & not commercial.
One was done by Nero .
This one has a nice printed label.
It shows as Interlaced.
The other is a Sintel/Big Bunny I got off the Internet.It was done in 2012 so I do not remember if I converted it to DVD formatted folders.
It shows to be written by ImgBurn.
It shows as progressive.
Similar Threads
-
Command line to update ffmpeg?
By Leanoric in forum Newbie / General discussionsReplies: 3Last Post: 4th Jun 2024, 16:52 -
How do I use QAAC AAC with FFMPEG command line?
By shampistols69 in forum Video ConversionReplies: 1Last Post: 26th Dec 2022, 11:20 -
Get the complete FFmpeg command line when using FFmpeg Batch Converter
By pascor in forum Newbie / General discussionsReplies: 8Last Post: 14th May 2021, 00:14 -
Command line youtube-dl & ffmpeg?
By Adeptus in forum Video Streaming DownloadingReplies: 2Last Post: 27th Feb 2020, 06:48 -
Need a command line for ffmpeg
By NTradd in forum Video ConversionReplies: 11Last Post: 14th Oct 2019, 12:25