[FFmpeg-user] Mpg

Juan O Batista orestesb at comcast.net
Thu Sep 15 05:00:05 EEST 2016


Thank you Marcelo great job congratulations. 

The statement you send me work pretty good. 
Preserve my close caption using this instruction. 

Let me ask you a question. 

What software do you use to put closed captions inside the video when the videos are .mpg, no embedded . I need to turn on / off closed caption. 
FFmpeg only work with subtitles embedded, but no really with closed caption. 

Exist any command line software to do that? 

Thank you again. 

----- Original Message -----

From: "Marcelo Boufleur" <mboufleur at gmail.com> 
To: "FFmpeg user questions" <ffmpeg-user at ffmpeg.org> 
Sent: Wednesday, September 14, 2016 6:24:52 PM 
Subject: Re: [FFmpeg-user] Mpg 

> 
> But i got error 
> bad option 'ac53' '1' 
> 

Ahh, nothing like actually trying the command. The "a53cc" option has to be 
used outside the internal parameters of x264. 

ffmpeg -i INPUT.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -a53cc 
1 -an -f mpegts OUTPUT.ts 

Here is a (working and tested) command line version, and the full command 
output: 

C:\>ffmpeg -i cea708_dtv.mpg -c:v libx264 -x264opts keyint=60:min-keyint=30 
-a53cc 1 -an -f mpegts OUTPUT.TS 

ffmpeg version N-80980-g7af44ce Copyright (c) 2000-2016 the FFmpeg 
developers 
built with gcc 5.4.0 (GCC) 
configuration: --enable-gpl --enable-version3 --disable-w32threads 
--enable-dxva2 --enable-libmfx 
--enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 
--enable-fontconfig --enable-fre 
i0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray 
--enable-libbs2b --enable-libc 
aca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc 
--enable-libmodplug --enab 
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libopenjpeg --enable-li 
bopus --enable-librtmp --enable-libschroedinger --enable-libsnappy 
--enable-libsoxr --enable-libspee 
x --enable-libtheora --enable-libtwolame --enable-libvidstab 
--enable-libvo-amrwbenc --enable-libvor 
bis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --enable- 
libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink 
--enable-zlib 
libavutil 55. 28.100 / 55. 28.100 
libavcodec 57. 50.100 / 57. 50.100 
libavformat 57. 41.100 / 57. 41.100 
libavdevice 57. 0.102 / 57. 0.102 
libavfilter 6. 47.100 / 6. 47.100 
libswscale 4. 1.100 / 4. 1.100 
libswresample 2. 1.100 / 2. 1.100 
libpostproc 54. 0.100 / 54. 0.100 
Input #0, mpegts, from 'cea708_dtv.mpg': 
Duration: 00:00:05.01, start: 0.300911, bitrate: 6482 kb/s 
Program 1 
Stream #0:0[0x1e1]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), 
yuv420p(tv, smpte170m), 720x480 [SAR 8:9 DAR 4:3], Closed Captions, 6000 
kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc 
Stream #0:1[0x1e2]: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, 
stereo, s16p, 256 kb/s 
[libx264 @ 00000000023c42a0] using SAR=8/9 
[libx264 @ 00000000023c42a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 
SSE4.2 AVX 
[libx264 @ 00000000023c42a0] profile High, level 3.0 
[mpegts @ 00000000024c64c0] Using AVStream.codec to pass codec parameters 
to muxers is deprecated, use AVStream.codecpar instead. 
Output #0, mpegts, to 'OUTPUT.TS': 
Metadata: 
encoder : Lavf57.41.100 
Stream #0:0: Video: h264 (libx264), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 
q=-1--1, 29.97 fps, 90ktbn, 29.97 tbc 
Metadata: 
encoder : Lavc57.50.100 libx264 
Side data: 
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 
Stream mapping: 
Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264)) 
Press [q] to stop, [?] for help 
frame= 150 fps= 25 q=-1.0 Lsize= 4690kB time=00:00:04.90 
bitrate=7833.2kbits/s speed=0.804x 
video:4333kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: 8.248154% 
[libx264 @ 00000000023c42a0] frame I:3 Avg QP:25.11 size: 57332 
[libx264 @ 00000000023c42a0] frame P:48 Avg QP:27.88 size: 45895 
[libx264 @ 00000000023c42a0] frame B:99 Avg QP:31.95 size: 20826 
[libx264 @ 00000000023c42a0] consecutive B-frames: 2.0% 5.3% 74.0% 18.7% 
[libx264 @ 00000000023c42a0] mb I I16..4: 5.7% 92.6% 1.7% 
[libx264 @ 00000000023c42a0] mb P I16..4: 1.7% 25.7% 2.0% P16..4: 22.2% 
26.0% 16.3% 0.0% 0.0% skip: 6.0% 
[libx264 @ 00000000023c42a0] mb B I16..4: 0.2% 3.3% 0.0% B16..8: 41.2% 
16.8% 7.4% direct:17.1% skip:14.0% L0:31.4% L1:30.1% BI:38.6% 
[libx264 @ 00000000023c42a0] 8x8 transform intra:89.0% inter:80.4% 
[libx264 @ 00000000023c42a0] coded y,uvDC,uvAC intra: 84.5% 81.6% 37.1% 
inter: 60.5% 46.5% 26.3% 
[libx264 @ 00000000023c42a0] i16 v,h,dc,p: 16% 41% 33% 10% 
[libx264 @ 00000000023c42a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 23% 38% 3% 
2% 2% 4% 3% 8% 
[libx264 @ 00000000023c42a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 25% 14% 5% 
5% 3% 12% 4% 20% 
[libx264 @ 00000000023c42a0] i8c dc,h,v,p: 51% 23% 20% 6% 
[libx264 @ 00000000023c42a0] Weighted P-Frames: Y:0.0% UV:0.0% 
[libx264 @ 00000000023c42a0] ref P L0: 54.4% 11.4% 21.2% 13.0% 
[libx264 @ 00000000023c42a0] ref B L0: 80.8% 16.4% 2.8% 
[libx264 @ 00000000023c42a0] ref B L1: 99.1% 0.9% 
[libx264 @ 00000000023c42a0] kb/s:7091.63 

And here is the ffmpeg command informing about the resulting file: 

C:\>ffmpeg -i OUTPUT.TS 

ffmpeg version N-80980-g7af44ce Copyright (c) 2000-2016 the FFmpeg 
developers 
built with gcc 5.4.0 (GCC) 
configuration: --enable-gpl --enable-version3 --disable-w32threads 
--enable-dxva2 --enable-libmfx 
--enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 
--enable-fontconfig --enable-fre 
i0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray 
--enable-libbs2b --enable-libc 
aca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc 
--enable-libmodplug --enab 
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libopenjpeg --enable-li 
bopus --enable-librtmp --enable-libschroedinger --enable-libsnappy 
--enable-libsoxr --enable-libspee 
x --enable-libtheora --enable-libtwolame --enable-libvidstab 
--enable-libvo-amrwbenc --enable-libvor 
bis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --enable- 
libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink 
--enable-zlib 
libavutil 55. 28.100 / 55. 28.100 
libavcodec 57. 50.100 / 57. 50.100 
libavformat 57. 41.100 / 57. 41.100 
libavdevice 57. 0.102 / 57. 0.102 
libavfilter 6. 47.100 / 6. 47.100 
libswscale 4. 1.100 / 4. 1.100 
libswresample 2. 1.100 / 2. 1.100 
libpostproc 54. 0.100 / 54. 0.100 
Input #0, mpegts, from 'OUTPUT.TS': 
Duration: 00:00:05.01, start: 1.466733, bitrate: 7676 kb/s 
Program 1 
Metadata: 
service_name : Service01 
service_provider: FFmpeg 
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), 
yuv420p, 720x480 [SAR 8:9 DAR 4:3], Closed Captions, 29.97 fps, 29.97 tbr, 
90k tbn, 59.94 tbc 


I'm attaching a report from Media info from the input and output vĂ­deos, 
just to compare how the Closed Caption is recognized: 

General 
ID : 1 (0x1) 
Complete name : C:\cea708_dtv.mpg 
Format : MPEG-TS 
File size : 3.87 MiB 
Duration : 4s 979ms 
Overall bit rate mode : Constant 
Overall bit rate : 6 500 Kbps 

Video 
ID : 481 (0x1E1) 
Menu ID : 1 (0x1) 
Format : MPEG Video 
Format version : Version 2 
Format profile : Main at Main 
Format settings, BVOP : Yes 
Format settings, Matrix : Default 
Format settings, GOP : M=3, N=15 
Codec ID : 2 
Duration : 5s 5ms 
Bit rate : 5 921 Kbps 
Maximum bit rate : 6 000 Kbps 
Width : 720 pixels 
Height : 480 pixels 
Display aspect ratio : 4:3 
Frame rate : 29.970 (30000/1001) fps 
Standard : NTSC 
Color space : YUV 
Chroma subsampling : 4:2:0 
Bit depth : 8 bits 
Scan type : Progressive 
Compression mode : Lossy 
Bits/(Pixel*Frame) : 0.572 
Time code of first frame : 00:00:00:01 
Time code source : Group of pictures header 
GOP, Open/Closed : Open 
GOP, Open/Closed of first frame : Closed 
Stream size : 3.53 MiB (91%) 
Color primaries : BT.601 NTSC 
Transfer characteristics : BT.601 
Matrix coefficients : BT.601 

Audio 
ID : 482 (0x1E2) 
Menu ID : 1 (0x1) 
Format : MPEG Audio 
Format version : Version 1 
Format profile : Layer 2 
Codec ID : 3 
Duration : 496ms 
Bit rate mode : Constant 
Bit rate : 256 Kbps 
Channel(s) : 2 channels 
Sampling rate : 44.1 KHz 
Compression mode : Lossy 
Stream size : 15.5 KiB (0%) 

Text 
ID : 481 (0x1E1)-1 
Menu ID : 1 (0x1) 
Format : EIA-608 
Muxing mode : A/53 / DTVCC Transport 
Muxing mode, more info : Muxed in Video #1 
Duration : 5s 5ms 
Bit rate mode : Constant 
Stream size : 0.00 Byte (0%) 



And here is the a report from OUTPUT.ts: 

General 
ID : 1 (0x1) 
Complete name : C:\OUTPUT.TS 
Format : MPEG-TS 
File size : 4.58 MiB 
Duration : 4s 938ms 
Overall bit rate mode : Variable 
Overall bit rate : 7 718 Kbps 

Video 
ID : 256 (0x100) 
Menu ID : 1 (0x1) 
Format : AVC 
Format/Info : Advanced Video Codec 
Format profile : High at L3 
Format settings, CABAC : Yes 
Format settings, ReFrames : 4 frames 
Codec ID : 27 
Duration : 5s 5ms 
Bit rate : 7 337 Kbps 
Width : 720 pixels 
Height : 480 pixels 
Display aspect ratio : 4:3 
Frame rate mode : Variable 
Color space : YUV 
Chroma subsampling : 4:2:0 
Bit depth : 8 bits 
Scan type : Progressive 
Stream size : 4.38 MiB (96%) 
Writing library : x264 core 148 r2705 3f5ed56 
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 
/ analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / 
mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / 
deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / 
lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / 
bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 
/ b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=60 / 
keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / 
mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / 
ip_ratio=1.40 / aq=1:1.00 

Text 
ID : 256 (0x100)-1 
Menu ID : 1 (0x1) 
Format : EIA-608 
Muxing mode : SCTE 128 / DTVCC Transport 
Muxing mode, more info : Muxed in Video #1 
Duration : 5s 5ms 
Bit rate mode : Constant 
Stream size : 0.00 Byte (0%) 

Menu 
ID : 4096 (0x1000) 
Menu ID : 1 (0x1) 
Duration : 4s 938ms 
List : 256 (0x100) (AVC) 
Service name : Service01 
Service provider : FFmpeg 
Service type : digital television 
_______________________________________________ 
ffmpeg-user mailing list 
ffmpeg-user at ffmpeg.org 
http://ffmpeg.org/mailman/listinfo/ffmpeg-user 

To unsubscribe, visit link above, or email 
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe". 



More information about the ffmpeg-user mailing list