[Cin] Blu-ray compliant MPEG-2 SD video with LPCM audio

Andrew Randrianasulu randrianasulu at gmail.com
Tue Nov 30 01:57:14 CET 2021


On Tuesday, November 30, 2021, Terje J. Hanssen <terjejhanssen at gmail.com>
wrote:

>
> Den 29.11.2021 07:18, skrev Andrew Randrianasulu:
>
>>
>>
>> On Monday, November 29, 2021, Terje J. Hanssen <terjejhanssen at gmail.com
>> <mailto:terjejhanssen at gmail.com>> wrote:
>>
>>
>>
>>     Den 29.11.2021 02:07, skrev Andrew Randrianasulu:
>>
>>
>>
>>         On Monday, November 29, 2021, Terje J. Hanssen via Cin
>>         <cin at lists.cinelerra-gg.org
>>         <mailto:cin at lists.cinelerra-gg.org>
>>         <mailto:cin at lists.cinelerra-gg.org
>>         <mailto:cin at lists.cinelerra-gg.org>>> wrote:
>>
>>             2) SD ProRes.mov, 422 (HQ) 10-bit video with LPCM stereo
>>         audio :)
>>
>>
>>             Den 28.11.2021 22:48, skrev Terje J. Hanssen:
>>
>>                 The source video files I want to convert to Blu-ray
>>         compliant
>>                 MPEG-2 SD video with LPCM audio are:
>>                 1) DV25.dv, 720 x 576 (PAL), 50i 4:2:0 video with LPCM
>>         stereo
>>                 audio
>>                 and
>>                 2) SD ProRes.mov, 422 (HQ) 19-bit video with LPCM
>>         stereo audio
>>
>>                 The purpose is to get better MPEG-2 quality using higher
>>                 (highest) possible bitrate than for DVD video.
>>                 (Yes, I have tested h.264 via Cin-GG)
>>
>>
>>                 Here a sample ffmpeg command script found for HD video
>>         with
>>                 PCM (Blu-ray not mentioned):
>>         https://gist.github.com/avoidik/153879c06afdcaad8d69b38bcc00abb7
>>         <https://gist.github.com/avoidik/153879c06afdcaad8d69b38bcc00abb7
>> >
>>
>>         <https://gist.github.com/avoidik/153879c06afdcaad8d69b38bcc00abb7
>>         <https://gist.github.com/avoidik/153879c06afdcaad8d69b38bcc00abb7
>> >>
>>                 # with PCM 16-bit audio (uncompressed), constant video
>>         bitrate
>>                 with specific bitrate tolerance
>>
>>                 ffmpeg -i "input.mp4" \
>>                   -c:v mpeg2video -pix_fmt yuv422p -refs 1 -bf 2 -b:v 50M
>>                 -maxrate 50M -minrate 50M \
>>                   -s 1920x1080 -aspect 16:9 \
>>                   -c:a pcm_s16be -f vob \
>>                   "output.mpg"
>>
>>
>>
>>     Andrew,
>>
>>     Thank you for your review and suggestions. I'll put the pieces
>>     together tomorrow and start testing with em...
>>
>>
>>         for SD files replace '-s 1920x1080' with '-s 720x576' or omit
>>         this part {better} .
>>
>>
>>     Not sure how to treate 720x576 (4:3) with regards to displaying on
>>     a 16:9 Widescreen (HDTV), possibly crop the frames next to
>>     SD Wide (16:9) "These resolutions are stored anamorphically, i.e.
>>     they are stretched to the display aspect ratio by the player or
>>     display."
>>
>>
>> https://superuser.com/questions/907933/correct-aspect-ratio-
>> without-re-encoding-video-file <https://superuser.com/questio
>> ns/907933/correct-aspect-ratio-without-re-encoding-video-file>
>>
>> ===
>> for MPEG-2, -aspect is useless; you need to use -bsf:v
>> mpeg2_metadata=display_aspect_ratio=4/3 (the only valid values are 4/3,
>> 16/9, 221/100). Even this might not work {...}
>> ====
>>
>> try to experiment..
>>
>>
>>
>>         '-b:v 40M -maxrate 40M -minrate 40M'.  for 40 mbit/s fixed
>>         bitrate. for smaller bitrate just replace numbers.
>>
>>         -f m2ts for mpeg2 transport stream.
>>
>>         most likely remove -pix_fmt part.
>>
>>         -i your file (ffmpeg hopefully will detect its type and codecs
>>         automatically)
>>
>>
>>
>>     So any Mpeg2 Profile at Level is neither required as discussed here:
>>     https://forum.videohelp.com/threads/345143-mpeg2-MP-ML-with-
>> ffmpeg#post2153378
>>     <https://forum.videohelp.com/threads/345143-mpeg2-MP-ML-with
>> -ffmpeg#post2153378>
>>
>>
>>
>>         keep -c:v mpeg2video part
>>
>>         I do not think you need mp4box for further conversion, as name
>>         suggest it mostly deals {at output end} with mp4 format, not
>>         mpeg2 transport stream (but you mentioned putting pcm in mp4,
>>         so I researched this part too)
>>
>>
>>     PCM and ffmpeg was also discussed here
>>     https://forum.doom9.org/showthread.php?p=1811816#post1811816
>>     <https://forum.doom9.org/showthread.php?p=1811816#post1811816>
>>
>>
>>         try tsmuxer (gui) next (not sure if Appimage works for you, if
>>         not try their linux build from their github - tags - assets
>>         (there you need to expand 'assets' arrow/triangle to see
>>         various binary and source archives).
>>
>>
>>
>>     Yep, tsMuxer still launches fine from my Appimage installation.
>>     I'll have a look at it later....
>>
>> =======================================
>
> I've tried four ffmpeg tests, 1) -4) below with .m2ts and .mp4 containers
> I used data rate 25M (comparable with the source dv 25 mbps, compression
> 5:1)
> -f m2ts not accepted as format
> would not copy lpcm audio into any new streams
> VLC playback the video files OK - without audio
>
> Comments and new suggestions welcome ;)



so yeah, it seems '-f mpegts' is way to go. does sound appear if you replace
 -c:a pcm_s16be with pcm_s16le?


>
> ===================
>
> du -sh dv28*
>
> 470M    dv28.dv  (the source input file)
> 452M    dv28.m2ts
> 443M    dv28.mkv
> 443M    dv28.mp4
> 443M    dv28.mts
>
>
> ffmpeg -i dv28.dv  2>&1 >/dev/null | egrep "Video|Audio"
>   Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25000
> kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
>   Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
>
> 1)
> ffmpeg -i dv28.dv -c:v mpeg2video -refs 1 -bf 2 -b:v 25M -maxrate 25M
> -minrate 25M -s 720x756 -c:a pcm_s16be -f m2ts dv28.m2ts
>
> [NULL @ 0x557007bcd900]
> Requested output format 'm2ts' is not a suitable output format dv28.m2ts:
> Invalid argument
>
> 2)
> ffmpeg -i dv28.dv -c:v mpeg2video -refs 1 -bf 2 -b:v 25M -maxrate 25M
> -minrate 25M -s 720x756 -c:a pcm_s16be -f m2ts dv28.mp4
>
> [NULL @ 0x55f3112e3900]
> Requested output format 'm2ts' is not a suitable output format dv28.mp4:
> Invalid argument
>
> 3)
> ffmpeg -i dv28.dv -c:v mpeg2video -refs 1 -bf 2 -b:v 25M -maxrate 25M
> -minrate 25M -s 720x756 -c:a pcm_s16be -f mpegts dv28.m2ts
>
> [mpeg2video @ 0x55bc49d1c040]
> Automatically choosing VBV buffer size of 372 kbyte
> [mpegts @ 0x55bc49d1a900]
> Stream 1, codec pcm_s16be, is muxed as a private data stream and may not
> be recognized upon reading.
>
> ffmpeg -i dv28.m2ts  2>&1 >/dev/null | egrep "Video|Audio"
>   Stream #0:0[0x1011]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, progressive), 720x756 [SAR 7:5 DAR 4:3], 25000 kb/s, 25 fps, 25
> tbr, 90k tbn, 50 tbc
>
> 4)
> ffmpeg -i dv28.dv -c:v mpeg2video -refs 1 -bf 2 -b:v 25M -maxrate 25M
> -minrate 25M -s 720x756 -c:a pcm_s16be -f mpegts dv28.mp4
>
> mpeg2video @ 0x56173fa7e040]
> Automatically choosing VBV buffer size of 372 kbyte
> [mpegts @ 0x56173fa7c900]
> Stream 1, codec pcm_s16be, is muxed as a private data stream and may not
> be recognized upon reading.
>
> ffmpeg -i dv28.mp4  2>&1 >/dev/null | egrep "Video|Audio"
>   Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, progressive), 720x756 [SAR 7:5 DAR 4:3], 25000 kb/s, 25 fps, 25
> tbr, 90k tbn, 50 tbc
>
> ================
>
> Terje J. H
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211130/0c3eae8d/attachment-0001.htm>


More information about the Cin mailing list