[FFmpeg-user] Reversing PAL->NTSC telecining.

Nicholas Robbins nickrobbins at yahoo.com
Tue Jan 7 16:05:50 CET 2014


> On Tuesday, January 7, 2014 5:27 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> > Nicholas Robbins <nickrobbins <at> yahoo.com> writes:
> 
>>  ffmpeg can't see the subtitles in the vob.
> 
> Did you try with increased probesize and analyzeduration?
> (Start with 2G)

Now it sees them, but it can't deal with them, I know you will want "full commands and output" but I've been trying a variety of commands and I can't get it to do what I want. What I want is to have the video, audio, subtitles, and chapters in a file I can play, which I can then transcode with ffmpeg to x264 video with the other streams just copied. 

I also don't want to have to copy the video an extra time.

Now it seems that ffmpeg can't even deal with the video inside the vob directly into a mkv.

ffmpeg -probesize 2G -analyzeduration 2G -i test.vob  -sn -an -c:v copy  /tmp/testing/out.mkv
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 11:21:38 with gcc 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.3, pie-0.5.5)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cxxflags='-O2 -pipe -march=native -fomit-frame-pointer' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --disable-ffplay --disable-vaapi --disable-vdpau --enable-zlib --disable-libvo-aacenc --disable-libvo-amrwbenc
 --enable-libmp3lame --disable-libfdk-aac --disable-libaacplus --enable  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpeg, from 'test.vob':
  Duration: 01:01:49.98, start: 0.280633, bitrate: 5559 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:2[0x20]: Subtitle: dvd_subtitle
Output #0, matroska, to '/tmp/testing/out.mkv':
  Metadata:
    encoder         : Lavf55.12.100
    Stream #0:0: Video: mpeg2video (mpg2 / 0x3267706D), yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=2-31, 29.97 fps, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[matroska @ 0xbf7a7f90] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument

Much less the subtitles and audio.


So instead I put together all of the other information into a mkv (subs, audio, chapters) and then put that back together with a command like (keeping only first 5 minutes for space reasons)

$ ffmpeg -i /var/tmp/dvd-import/test.vob  -i novid.mkv -map 0:v -map 1 -c:s copy -c:a copy -c:v copy -t 300 ffmpeged.mp4
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 11:21:38 with gcc 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.3, pie-0.5.5)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cxxflags='-O2 -pipe -march=native -fomit-frame-pointer' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --disable-ffplay --disable-vaapi --disable-vdpau --enable-zlib --disable-libvo-aacenc --disable-libvo-amrwbenc
 --enable-libmp3lame --disable-libfdk-aac --disable-libaacplus --enable  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpeg, from '/var/tmp/dvd-import/test.vob':
  Duration: 01:01:49.98, start: 0.280633, bitrate: 5559 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
Input #1, matroska,webm, from 'novid.mkv':
  Metadata:
    creation_time   : 2014-01-07 13:58:22
  Duration: 01:01:50.02, start: 0.000000, bitrate: 451 kb/s
    Chapter #1.0: start 0.000000, end 146.467000
    Metadata:
      title           : Chapter 01
    Chapter #1.1: start 146.467000, end 636.934000
    Metadata:
      title           : Chapter 02
    Chapter #1.2: start 636.934000, end 778.501000
    Metadata:
      title           : Chapter 03
    Chapter #1.3: start 778.501000, end 1389.501000
    Metadata:
      title           : Chapter 04
    Chapter #1.4: start 1389.501000, end 1792.968000
    Metadata:
      title           : Chapter 05
    Chapter #1.5: start 1792.968000, end 2080.568000
    Metadata:
      title           : Chapter 06
    Chapter #1.6: start 2080.568000, end 2459.834000
    Metadata:
      title           : Chapter 07
    Chapter #1.7: start 2459.834000, end 2677.834000
    Metadata:
      title           : Chapter 08
    Chapter #1.8: start 2677.834000, end 3123.668000
    Metadata:
      title           : Chapter 09
    Chapter #1.9: start 3123.668000, end 3318.934000
    Metadata:
      title           : Chapter 10
    Chapter #1.10: start 3318.934000, end 3610.868000
    Metadata:
      title           : Chapter 11
    Chapter #1.11: start 3610.868000, end 3710.016002
    Metadata:
      title           : Chapter 12
    Stream #1:0(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #1:1(eng): Subtitle: dvd_subtitle
[mp4 @ 0x5aca9ccc0] track 1: codec frame size is not set
Output #0, mp4, to 'ffmpeged.mp4':
  Metadata:
    encoder         : Lavf55.12.100
    Chapter #0.0: start 0.000000, end 146.467000
    Metadata:
      title           : Chapter 01
    Chapter #0.1: start 146.467000, end 300.000000
    Metadata:
      title           : Chapter 02
    Stream #0:0: Video: mpeg2video (a[0][0][0] / 0x0061), yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 90k tbc
    Stream #0:1(eng): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), 448 kb/s (default)
    Stream #0:2(eng): Subtitle: dvd_subtitle ([224][0][0][0] / 0x00E0)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
  Stream #1:1 -> #0:2 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x5aca9ccc0] pts has no value
    Last message repeated 162 times
[mpeg @ 0x5aca99110] New subtitle stream 0:2 at pos:6881294 and DTS:11.692s
[mp4 @ 0x5aca9ccc0] pts has no value
    Last message repeated 1073 times
pts has no value0.0 q=-1.0 size=   60555kB time=00:01:23.32 bitrate=5953.2kbits/s    
[mp4 @ 0x5aca9ccc0] pts has no value
    Last message repeated 1491 times
pts has no value5291 q=-1.0 size=  133107kB time=00:03:03.16 bitrate=5953.1kbits/s    
[mp4 @ 0x5aca9ccc0] pts has no value
    Last message repeated 1167 times
pts has no value5040 q=-1.0 size=  187442kB time=00:04:27.74 bitrate=5735.1kbits/s    
[mp4 @ 0x5aca9ccc0] pts has no value
    Last message repeated 654 times
[mp4 @ 0x5aca9ccc0] pts has no value
    Last message repeated 28 times
frame= 8993 fps=4806 q=-1.0 Lsize=  216765kB time=00:05:00.03 bitrate=5918.5kbits/s    
video:199964kB audio:16408kB subtitle:238 global headers:0kB muxing overhead 0.071651%

I used mp4, since mkv in this command gives the same "Can't write packet with unknown timestamp av_interleaved_write_frame(): Invalid argument" error.

Looks good as an mp4, but then I try to transcode:

$ ffmpeg -i ffmpeged.mp4 -map 0 -c:s copy -c:a copy -c:v libx264 trans.mkv
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 11:21:38 with gcc 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.3, pie-0.5.5)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cxxflags='-O2 -pipe -march=native -fomit-frame-pointer' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --disable-ffplay --disable-vaapi --disable-vdpau --enable-zlib --disable-libvo-aacenc --disable-libvo-amrwbenc
 --enable-libmp3lame --disable-libfdk-aac --disable-libaacplus --enable  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ffmpeged.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.12.100
  Duration: 00:05:00.07, start: 0.000000, bitrate: 5917 kb/s
    Chapter #0.0: start 0.000000, end 146.467000
    Metadata:
      title           : Chapter 01
    Chapter #0.1: start 146.467000, end 300.067000
    Metadata:
      title           : Chapter 02
    Stream #0:0(und): Video: mpeg2video (Main) (mp4v / 0x7634706D), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 5459 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none ([224][0][0][0] / 0x00E0), 6 kb/s
    Metadata:
      handler_name    : SubtitleHandler
Data stream encoding not supported yet (only streamcopy)

The solution I found was to move the video to mp4 then merge that in

$ffmpeg -i /var/tmp/dvd-import/test.vob -sn -an -c:v copy -t 300 vid.mp4

$ffmpeg -i vid.mp4 -i novid.mkv -map 0:v -map 1 -c:s copy -c:a copy -c:v copy -t 300 ffmpeged.mkv

then the transcode went fine, and it was reported as 30fps. 

However, this process entails copying the video an extra time. So it seems like it is not worth it. So, given that I am always doing this with region 1 dvds, they should always be 30fps originally, so while I don't like shoving in the fps=30 filter either, I think it is actually the way to go.

Any suggestions? Are you on irc ever?

> [...]
> 
>>  So, it doesn't do anything? Rather than doing too much.
> 
> Please start without using yadif.
> If it does not work, try to understand why and if it's 
> because the original sample is badly cut and if 
> fieldmatch correctly identifies the frames (it does 
> not here for the only problematic sample I have), then 
> use yadif.
> 
> Carl Eugen

So you are saying that fieldmatch doesn't label the frames as interlaced if it can't fix them, so yadif won't don anything in this command.

So my choices are, leave all the interlaced frames or yadif the whole video. Is that correct?

-Nick


More information about the ffmpeg-user mailing list