[FFmpeg-user] Converting MPEG 2 issues

rava77 at gmx.de rava77 at gmx.de
Tue Apr 3 18:43:03 EEST 2018


> Sent: Monday, 02. April 2018 um 14:00 Uhr, by "Moritz Barsnick" <barsnick at gmx.net>

> > I want to keep audio track 1 ("aid=1") and audio track 2 ("aid=2"), or how ffmpeg usually addresses these: "audio0 audio1"
> > The other 2 audio tracks can be rejected / should not be added into the resulting mkv or ogv.
> 
> No problem.

Good to know.


> $ [...] -map 0:v -map 0:a:0 -map 0:a:1

That also fails:
_________________________

# ffmpeg -y -ss 1:15.500 -i capture_V0.mpg -map 0:v -map 0:a:0 -map 0:a:1 -t 30 capture_v1_30s.mkv
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/doc/ffmpeg-3.4.2/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-pthreads --enable-libtheora --enable-libvorbis --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-gnutls --enable-libcdio --enable-opengl --arch=x86_64 --enable-libmp3lame --enable-libxvid --enable-libx264 --enable-libspeex --enable-nonfree --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libbluray --enable-libass --enable-libopus --enable-libtwolame --enable-libpulse
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mpeg, from 'capture_V0.mpg':
  Duration: N/A, start: 0.280633, bitrate: N/A
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 7000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x28]: Subtitle: dvd_subtitle
    Stream #0:3[0x29]: Subtitle: dvd_subtitle
Stream map '0:a:0' matches no streams.
To ignore this, add a trailing '?' to the map.
_________________________

The above ends with no file being created. There are indeed also subtitles, but I don't want to keep any.

And here the version without mapping, the one that again (this time creating a mkv, not an mpg, and not using stream-copy as well) results in just video without any audio. (I leave out the banner, it is the very same than above.)
_________________________

# ffmpeg -hide_banner -y -ss 1:15.500 -i capture_V0.mpg -t 30 capture_V1_30s.mkv
Input #0, mpeg, from 'capture_V0.mpg':
  Duration: N/A, start: 0.280633, bitrate: N/A
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 7000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x28]: Subtitle: dvd_subtitle
    Stream #0:3[0x29]: Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mpeg @ 0x15b27c0] New audio stream 0:4 at pos:76978190 and DTS:75.3496s
[mpeg @ 0x15b27c0] New audio stream 0:5 at pos:76980238 and DTS:75.3496s
[mpeg @ 0x15b27c0] New audio stream 0:6 at pos:76982286 and DTS:75.3496s
[mpeg @ 0x15b27c0] New audio stream 0:7 at pos:77015054 and DTS:75.4456s
[libx264 @ 0x16169e0] using SAR=64/45
[libx264 @ 0x16169e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x16169e0] profile High, level 3.0
[libx264 @ 0x16169e0] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: 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=12 lookahead_threads=2 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=250 keyint_min=25 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
Output #0, matroska, to 'capture_V1_30s.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[mpeg @ 0x15b27c0] New subtitle stream 0:8 at pos:79061006 and DTS:77.4616s
[mpeg @ 0x15b27c0] New subtitle stream 0:9 at pos:79067150 and DTS:77.4616s
[mpeg @ 0x15b27c0] New subtitle stream 0:10 at pos:79073294 and DTS:77.4616s
frame=   46 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   88 fps= 82 q=28.0 size=       1kB time=00:00:01.16 bitrate=   5.2kbits/frame=  127 fps= 77 q=28.0 size=      50kB time=00:00:02.72 bitrate= 151.5kbits/[mpeg @ 0x15b27c0] New subtitle stream 0:11 at pos:84781070 and DTS:82.7016s
frame=  187 fps= 87 q=28.0 size=      50kB time=00:00:05.12 bitrate=  80.5kbits/frame=  253 fps= 96 q=28.0 size=     125kB time=00:00:07.76 bitrate= 131.9kbits/frame=  323 fps=102 q=28.0 size=     125kB time=00:00:10.56 bitrate=  96.9kbits/frame=  387 fps=105 q=28.0 size=     185kB time=00:00:13.12 bitrate= 115.3kbits/frame=  453 fps=108 q=28.0 size=     185kB time=00:00:15.76 bitrate=  96.0kbits/frame=  517 fps=110 q=28.0 size=     270kB time=00:00:18.32 bitrate= 120.5kbits/frame=  574 fps=111 q=28.0 size=     270kB time=00:00:20.60 bitrate= 107.2kbits/[mpeg @ 0x15b27c0] New subtitle stream 0:12 at pos:104108046 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:13 at pos:104112142 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:14 at pos:104116238 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:15 at pos:104120334 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:16 at pos:104132622 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:17 at pos:104136718 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:18 at pos:104140814 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:19 at pos:104146958 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:20 at pos:104151054 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:21 at pos:104157198 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:22 at pos:104161294 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:23 at pos:104165390 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:24 at pos:104175630 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:25 at pos:104179726 and DTS:100.422s
[mpeg @ 0x15b27c0] New subtitle stream 0:26 at pos:104220686 and DTS:100.462s
[mpeg @ 0x15b27c0] New subtitle stream 0:27 at pos:104224782 and DTS:100.462s
[mpeg @ 0x15b27c0] New subtitle stream 0:28 at pos:104306702 and DTS:100.502s
[mpeg @ 0x15b27c0] New subtitle stream 0:29 at pos:104314894 and DTS:100.502s
[mpeg @ 0x15b27c0] New subtitle stream 0:30 at pos:104318990 and DTS:100.502s
[mpeg @ 0x15b27c0] New subtitle stream 0:31 at pos:104323086 and DTS:100.502s
frame=  625 fps=110 q=28.0 size=     387kB time=00:00:22.64 bitrate= 140.0kbits/frame=  671 fps=108 q=28.0 size=     535kB time=00:00:24.48 bitrate= 179.0kbits/frame=  710 fps=106 q=28.0 size=     535kB time=00:00:26.04 bitrate= 168.2kbits/frame=  750 fps= 94 q=-1.0 Lsize=    1471kB time=00:00:29.88 bitrate= 403.3kbits/s speed=3.74x    
video:1465kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.423144%
[libx264 @ 0x16169e0] frame I:14    Avg QP:16.74  size:  8947
[libx264 @ 0x16169e0] frame P:221   Avg QP:19.90  size:  3946
[libx264 @ 0x16169e0] frame B:515   Avg QP:21.15  size:   975
[libx264 @ 0x16169e0] consecutive B-frames:  2.9%  5.6% 32.8% 58.7%
[libx264 @ 0x16169e0] mb I  I16..4: 62.1% 32.9%  5.0%
[libx264 @ 0x16169e0] mb P  I16..4:  3.1%  3.3%  0.5%  P16..4: 16.5%  5.1%  3.8%  0.0%  0.0%    skip:67.7%
[libx264 @ 0x16169e0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 15.5%  1.1%  0.4%  direct: 1.0%  skip:81.8%  L0:40.6% L1:56.6% BI: 2.8%
[libx264 @ 0x16169e0] 8x8 transform intra:40.6% inter:72.9%
[libx264 @ 0x16169e0] coded y,uvDC,uvAC intra: 24.7% 35.2% 19.9% inter: 4.2% 6.5% 1.5%
[libx264 @ 0x16169e0] i16 v,h,dc,p: 61% 23%  6%  9%
[libx264 @ 0x16169e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 17% 44%  3%  3%  4%  4%  4%  4%
[libx264 @ 0x16169e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 14% 20%  6%  7% 10%  5%  7%  4%
[libx264 @ 0x16169e0] i8c dc,h,v,p: 64% 19% 14%  3%
[libx264 @ 0x16169e0] Weighted P-Frames: Y:4.1% UV:3.2%
[libx264 @ 0x16169e0] ref P L0: 66.5%  9.3% 17.6%  6.5%  0.0%
[libx264 @ 0x16169e0] ref B L0: 86.6% 11.3%  2.1%
[libx264 @ 0x16169e0] ref B L1: 97.6%  2.4%
[libx264 @ 0x16169e0] kb/s:399.87
_________________________

No sound:

# mpv capture_V1_30s.mkv 
Playing: capture_V1_30s.mkv
 (+) Video --vid=1 (*) (h264 720x576 25.000fps)
VO: [opengl] 720x576 => 1024x576 yuv420p
V: 00:00:01 / 00:00:30 (6%) Cache: 10s+1MB
_________________________


Cheers


--


> Gesendet: Montag, 02. April 2018 um 14:00 Uhr
> Von: "Moritz Barsnick" <barsnick at gmx.net>
> An: "FFmpeg user discussions" <ffmpeg-user at ffmpeg.org>
> Betreff: Re: [FFmpeg-user] Converting MPEG 2 issues
>
> On Sun, Apr 01, 2018 at 03:22:10 +0200, rava77 at gmx.de wrote:
> > I want to keep audio track 1 ("aid=1") and audio track 2 ("aid=2"), or how ffmpeg usually addresses these: "audio0 audio1"
> > The other 2 audio tracks can be rejected / should not be added into the resulting mkv or ogv.
> 
> No problem.
> 
> > Here is how I tried creating the 30 seconds test video:
> > __________
> > 
> > ffmpeg -y -v error -ss 1:15.500 -i capture_V0.mpg -map 0:0 -map 0:1 -c:a ac3 -codec copy -acodec copy -t 30 capture_V1_30s.mpg
> > [mpeg @ 0x2540de0] Invalid media type data for output stream #0
> > Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
> > 
> > $ ffmpeg -y -v error -ss 1:15.500 -i capture_V0.mpg -map 0 -codec copy -acodec copy -t 30 capture_V1_30s.mpg
> > [mpeg @ 0x1a71b20] Invalid media type data for output stream #0
> > Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
> > 
> > $ ffmpeg -y -v error -ss 1:15.500 -i capture_V0.mpg -map 0:0 -map 0:1 -codec copy -t 30 capture_V1_30s.mpg
> > [mpeg @ 0xe5fae0] Invalid media type data for output stream #0
> > Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
> 
> First of all, you need to should us the *complete* console output,
> while omitting "-v error". Because when using this option, you are
> surpressing all the valuable information.
> 
> Secondly, your command lines are a bit confusing:
> $ [...] -c:a ac3 -codec copy -acodec copy
>              ^^^
> Do you want to (re-)encode your audio to ac3, or do you want to keep it
> (copy)?
> 
> Thirdly:
> $ [...] -map 0:0 -map 0:1
> will map streams 0 and 1 from your file. Presumably the video track and
> the first audio track. If you want the first *two* audio tracks, you
> probably need to add "-map 0:2", or you do
> $ [...] -map 0:v -map 0:a:0 -map 0:a:1
> 
> > That /looks/ like it did work… but there is no audio track in the resulting 30 seconds test video:
> 
> Again, you need to show us the console output *without -v error*. You
> are hiding all the information about your input files and the process
> from us.
> 
> Moritz
> _______________________________________________
> 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