[FFmpeg-user] Is FFV1 able to encode interlaced video?

MrNice wxcvbn2006 at iol.ie
Mon Aug 10 11:29:32 CEST 2015


On 10/08/15 08:44, Carl Eugen Hoyos wrote:
> MrNice <wxcvbn2006 <at> iol.ie> writes:
> 
>> From an interlaced input (video tape) is it 
>> possible to capture interlaced video file 
>> encoded with FFV1
> 
> What device or software is delivering the input 
> to FFmpeg? Whatever it is, it will provide frames 
> (because FFmpeg only accepts frames as input).
> 
>> (using -flags +ilme+ildct)?
> 
> These are flags intended to optimize encoding for 
> some codecs. The test in the mailing list thread 
> you linked indicated that there would be no gain 
> implementing such flags.
> 
> The more important question is:
> You are encoding frames with a lossless codec.
> Why do want to capture "interlaced video"?
> The lossless codec will encode your video and 
> it will be interlaced after decoding if it was 
> interlaced before encoding.
> 
> Please understand that there is a difference 
> between interlaced content and interlaced 
> encoding. There is no interlaced encoding 
> with FFv1 because it appears not to save any 
> bytes in the output file and if you have 
> interlaced content it will be still be 
> interlaced.
> 
> Most TV stations always use interlaced encoding 
> where I live, no matter if the content is 
> progressive or not.
> 
> Carl Eugen
> 
> 
>

- I am using a S-VHS tapes/player, Dazzle DVC 100 for the video and
direct audio to the PC integrated audio card.

The command is
./ffmpeg -debug 1 -f pulse -ar 44100 -ac 2 -channel_layout stereo
-thread_queue_size 512 -i alsa_input.pci-0000_00_14.2.analog-stereo -f
v4l2 -ts mono2abs -channel 1 -video_size 720x576 -pix_fmt yuyv422
-thread_queue_size 512 -i /dev/video0 -c:v ffv1 -level 3 -aspect 4:3
-pix_fmt yuv422p -c:a pcm_s16le /Store3/Test/t_`date +%Y%m%d_%H%M`.mkv
-aspect 4:3 -f sdl "Dazzle output"

So, AFAIK, the input to ffmpeg is interlaced.

- All the readings I did say interlaced input should be kept interlaced.
In this blog the guy tried FFV1 and FFV1 interlaced
http://linux.goeszen.com/comparison-of-lossless-video-compression-options.html
But I don't know if there are special options to do interlaced. Reading
your answer, there is no need for option.

- With mediainfo, a file encoded with x264 is noted as progressive or
interlaced, whereas FFV1 as no information.

- I tried to play FFV1 files and look the image to guess with VLC
(de-interlace disabled) and it looks progressive. Seems to be odds with
your answer.

- In your answer, do you mean that if I take the FFV1 file in a video
editor then render encoded with a encoder that can handle interlaced
video (x264), I will get interlaced?

- Is it better to encode the capture in x264 instead FFV1? I saw a big
difference in the CPU usage it's what I stay so far with FFV1.

- I can read in the output:
[video4linux2,v4l2 @ 0x24fdd80] The V4L2 driver is using the interlaced mode
For my information what does mean this (interl:0) in the output?:
[auto-inserted scaler 0 @ 0x24d3260] w:iw h:ih flags:'0x4' interl:0

- I need to learn more and I do thanks to you ;-)



./ffmpeg -debug 1 -f pulse -ar 44100 -ac 2 -channel_layout stereo
-thread_queue_size 512 -i alsa_input.pci-0000_00_14.2.analog-stereo -f
v4l2 -ts mono2abs -channel 1 -video_size 720x576 -pix_fmt yuyv422
-thread_queue_size 512 -i /dev/video0 -c:v ffv1 -level 3 -aspect 4:3
-pix_fmt yuv422p -c:a pcm_s16le /Store3/Test/t_`date +%Y%m%d_%H%M`.mkv
-aspect 4:3 -f sdl "Dazzle output"
ffmpeg version N-74246-ga0044be Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
  configuration: --enable-libpulse --enable-gpl --enable-libx264
  libavutil      54. 30.100 / 54. 30.100
  libavcodec     56. 56.101 / 56. 56.101
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 32.100 /  5. 32.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
 matched as AVOption 'debug' with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'pulse'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '44100'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-channel_layout' ... matched as option 'channel_layout'
(set channel layout) with argument 'stereo'.
Reading option '-thread_queue_size' ... matched as option
'thread_queue_size' (set the maximum number of queued packets from the
demuxer) with argument '512'.
Reading option '-i' ... matched as input file with argument
'alsa_input.pci-0000_00_14.2.analog-stereo'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'v4l2'.
Reading option '-ts' ... matched as AVOption 'ts' with argument 'mono2abs'.
Reading option '-channel' ... matched as AVOption 'channel' with
argument '1'.
Reading option '-video_size' ... matched as AVOption 'video_size' with
argument '720x576'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuyv422'.
Reading option '-thread_queue_size' ... matched as option
'thread_queue_size' (set the maximum number of queued packets from the
demuxer) with argument '512'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'ffv1'.
Reading option '-level' ... matched as AVOption 'level' with argument '3'.
Reading option '-aspect' ... matched as option 'aspect' (set aspect
ratio (4:3, 16:9 or 1.3333, 1.7777)) with argument '4:3'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuv422p'.
Reading option '-c:a' ... matched as option 'c' (codec name) with
argument 'pcm_s16le'.
Reading option '/Store3/Test/t_20150810_1016.mkv' ... matched as output
file.
Reading option '-aspect' ... matched as option 'aspect' (set aspect
ratio (4:3, 16:9 or 1.3333, 1.7777)) with argument '4:3'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'sdl'.
Reading option 'Dazzle output' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file
alsa_input.pci-0000_00_14.2.analog-stereo.
Applying option f (force format) with argument pulse.
Applying option ar (set audio sampling rate (in Hz)) with argument 44100.
Applying option ac (set number of audio channels) with argument 2.
Applying option channel_layout (set channel layout) with argument stereo.
Applying option thread_queue_size (set the maximum number of queued
packets from the demuxer) with argument 512.
Successfully parsed a group of options.
Opening an input file: alsa_input.pci-0000_00_14.2.analog-stereo.
[pulse @ 0x24e4be0] All info found
Input #0, pulse, from 'alsa_input.pci-0000_00_14.2.analog-stereo':
  Duration: N/A, start: 1439198170.351592, bitrate: 1411 kb/s
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 44100 Hz, stereo, s16,
1411 kb/s
Successfully opened the file.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument v4l2.
Applying option pix_fmt (set pixel format) with argument yuyv422.
Applying option thread_queue_size (set the maximum number of queued
packets from the demuxer) with argument 512.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x24fdd80] fd:6 capabilities:85220001
[video4linux2,v4l2 @ 0x24fdd80] Selecting input_channel: 1
[video4linux2,v4l2 @ 0x24fdd80] Current input_channel: 1, input_name:
S-Video, input_std: ffffff
[video4linux2,v4l2 @ 0x24fdd80] The V4L2 driver is using the interlaced mode
[video4linux2,v4l2 @ 0x24fdd80] Current standard: PAL, id: ff,
frameperiod: 1/25
[video4linux2,v4l2 @ 0x24fdd80] Detected monotonic timestamps, converting
[video4linux2,v4l2 @ 0x24fdd80] All info found
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1439198171.558372, bitrate: 165888 kb/s
    Stream #1:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (YUY2
/ 0x32595559), yuyv422, 720x576, 1/1000000, 165888 kb/s, 25 fps, 25 tbr,
1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output file /Store3/Test/t_20150810_1016.mkv.
Applying option c:v (codec name) with argument ffv1.
Applying option aspect (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777))
with argument 4:3.
Applying option pix_fmt (set pixel format) with argument yuv422p.
Applying option c:a (codec name) with argument pcm_s16le.
Successfully parsed a group of options.
Opening an output file: /Store3/Test/t_20150810_1016.mkv.
Successfully opened the file.
Parsing a group of options: output file Dazzle output.
Applying option aspect (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777))
with argument 4:3.
Applying option f (force format) with argument sdl.
Successfully parsed a group of options.
Opening an output file: Dazzle output.
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 1:0 @ 0x24c7340] Setting 'video_size' to
value '720x576'
[graph 0 input from stream 1:0 @ 0x24c7340] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 1:0 @ 0x24c7340] Setting 'time_base' to value
'1/1000000'
[graph 0 input from stream 1:0 @ 0x24c7340] Setting 'pixel_aspect' to
value '0/1'
[graph 0 input from stream 1:0 @ 0x24c7340] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 1:0 @ 0x24c7340] Setting 'frame_rate' to
value '25/1'
[graph 0 input from stream 1:0 @ 0x24c7340] w:720 h:576 pixfmt:yuyv422
tb:1/1000000 fr:25/1 sar:0/1 sws_param:flags=2
[format @ 0x24daa00] compat: called with args=[yuv422p]
[format @ 0x24daa00] Setting 'pix_fmts' to value 'yuv422p'
[auto-inserted scaler 0 @ 0x24d3260] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0x24d3260] w:iw h:ih flags:'0x4' interl:0
[format @ 0x24daa00] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x24bca40] query_formats: 4 queried, 2 merged, 1
already done, 0 delayed
[auto-inserted scaler 0 @ 0x24d3260] w:720 h:576 fmt:yuyv422 sar:0/1 ->
w:720 h:576 fmt:yuv422p sar:0/1 flags:0x4
[graph 1 input from stream 0:0 @ 0x24da680] Setting 'time_base' to value
'1/44100'
[graph 1 input from stream 0:0 @ 0x24da680] Setting 'sample_rate' to
value '44100'
[graph 1 input from stream 0:0 @ 0x24da680] Setting 'sample_fmt' to
value 's16'
[graph 1 input from stream 0:0 @ 0x24da680] Setting 'channel_layout' to
value '0x3'
[graph 1 input from stream 0:0 @ 0x24da680] tb:1/44100 samplefmt:s16
samplerate:44100 chlayout:0x3
[audio format for output stream 0:1 @ 0x24dab60] Setting 'sample_fmts'
to value 's16'
[AVFilterGraph @ 0x24d0a60] query_formats: 4 queried, 9 merged, 0
already done, 0 delayed
[graph 2 input from stream 1:0 @ 0x24bcf80] Setting 'video_size' to
value '720x576'
[graph 2 input from stream 1:0 @ 0x24bcf80] Setting 'pix_fmt' to value '1'
[graph 2 input from stream 1:0 @ 0x24bcf80] Setting 'time_base' to value
'1/1000000'
[graph 2 input from stream 1:0 @ 0x24bcf80] Setting 'pixel_aspect' to
value '0/1'
[graph 2 input from stream 1:0 @ 0x24bcf80] Setting 'sws_param' to value
'flags=2'
[graph 2 input from stream 1:0 @ 0x24bcf80] Setting 'frame_rate' to
value '25/1'
[graph 2 input from stream 1:0 @ 0x24bcf80] w:720 h:576 pixfmt:yuyv422
tb:1/1000000 fr:25/1 sar:0/1 sws_param:flags=2
[AVFilterGraph @ 0x24ce020] query_formats: 3 queried, 2 merged, 0
already done, 0 delayed
[sdl @ 0x25148c0] w:720 h:576 fmt:yuyv422 -> w:720 h:540
Output #0, matroska, to '/Store3/Test/t_20150810_1016.mkv':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0, 0, 1/1000: Video: ffv1, 1 reference frame (FFV1 /
0x31564646), yuv422p, 720x576 [SAR 16:15 DAR 4:3], 1/25, q=2-31, 200
kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.56.101 ffv1
    Stream #0:1, 0, 1/1000: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc56.56.101 pcm_s16le
Output #1, sdl, to 'Dazzle output':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #1:0, 0, 1/25: Video: rawvideo, 1 reference frame (YUY2 /
0x32595559), yuyv422, 720x576 [SAR 16:15 DAR 4:3], 1/25, q=2-31, 200
kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.56.101 rawvideo
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
  Stream #1:0 -> #1:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Cliping frame in rate conversion by 0.000008
[matroska @ 0x24ff880] Writing block at offset 829, size 272354, pts 0,
dts 0, duration 40, keyframe 1
[matroska @ 0x24ff880] Writing block at offset 273191, size 65472, pts
0, dts 0, duration 371, keyframe 1
[matroska @ 0x24ff880] Writing block at offset 338671, size 269130, pts
40, dts 40, duration 40, keyframe 0
Cliping frame in rate conversion by 0.000221
[matroska @ 0x24ff880] Writing block at offset 607809, size 266419, pts
80, dts 80, duration 40, keyframe 0
Cliping frame in rate conversion by 0.001961
[matroska @ 0x24ff880] Writing block at offset 874236, size 269868, pts
120, dts 120, duration 40, keyframe 0
Cliping frame in rate conversion by 0.002663
[matroska @ 0x24ff880] Writing block at offset 1144112, size 271178, pts
160, dts 160, duration 40, keyframe 0
Cliping frame in rate conversion by 0.001915
[matroska @ 0x24ff880] Writing block at offset 1415298, size 272257, pts
200, dts 200, duration 40, keyframe 0
Cliping frame in rate conversion by 0.000664
[matroska @ 0x24ff880] Writing block at offset 1687563, size 269390, pts
240, dts 240, duration 40, keyframe 0
Cliping frame in rate conversion by 0.003075
[matroska @ 0x24ff880] Writing block at offset 1956961, size 271661, pts
280, dts 280, duration 40, keyframe 0
Cliping frame in rate conversion by 0.001091
[matroska @ 0x24ff880] Writing block at offset 2228630, size 271625, pts
320, dts 320, duration 40, keyframe 0
Cliping frame in rate conversion by 0.000648
[matroska @ 0x24ff880] Writing block at offset 2500263, size 266854, pts
360, dts 360, duration 40, keyframe 0
Cliping frame in rate conversion by 0.002647
[matroska @ 0x24ff880] Writing block at offset 2767125, size 46412, pts
371, dts 371, duration 263, keyframe 1
[matroska @ 0x24ff880] Writing block at offset 2813545, size 269591, pts
400, dts 400, duration 40, keyframe 0
Cliping frame in rate conversion by 0.001122
[matroska @ 0x24ff880] Writing block at offset 3083144, size 267854, pts
440, dts 440, duration 40, keyframe 0
Cliping frame in rate conversion by 0.003288
[matroska @ 0x24ff880] Starting new cluster at offset 3351006 bytes, pts
480dts 480
[matroska @ 0x24ff880] Writing block at offset 3351022, size 270531, pts
480, dts 480, duration 40, keyframe 1
Cliping frame in rate conversion by 0.003471
[matroska @ 0x24ff880] Writing block at offset 3621561, size 269318, pts
520, dts 520, duration 40, keyframe 0
Cliping frame in rate conversion by 0.001472
[matroska @ 0x24ff880] Writing block at offset 3890887, size 270613, pts
560, dts 560, duration 40, keyframe 0
Cliping frame in rate conversion by 0.003792
[matroska @ 0x24ff880] Writing block at offset 4161508, size 267993, pts
600, dts 600, duration 40, keyframe 0
Cliping frame in rate conversion by 0.002037326kB time=00:00:01.00
bitrate=35259.8kbits/s
[matroska @ 0x24ff880] Writing block at offset 4429509, size 65472, pts
634, dts 634, duration 371, keyframe 1
[matroska @ 0x24ff880] Writing block at offset 4494989, size 265002, pts
640, dts 640, duration 40, keyframe 0
Cliping frame in rate conversion by 0.002068
[matroska @ 0x24ff880] Writing block at offset 4759999, size 266196, pts
680, dts 680, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004494
[matroska @ 0x24ff880] Writing block at offset 5026203, size 263703, pts
720, dts 720, duration 40, keyframe 0
Cliping frame in rate conversion by 0.002586
[matroska @ 0x24ff880] Writing block at offset 5289914, size 260548, pts
760, dts 760, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004539
[matroska @ 0x24ff880] Writing block at offset 5550470, size 258442, pts
800, dts 800, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004768
[matroska @ 0x24ff880] Writing block at offset 5808920, size 258467, pts
840, dts 840, duration 40, keyframe 0
Cliping frame in rate conversion by 0.005287
[matroska @ 0x24ff880] Writing block at offset 6067395, size 254765, pts
880, dts 880, duration 40, keyframe 0
Cliping frame in rate conversion by 0.003090
[matroska @ 0x24ff880] Writing block at offset 6322168, size 255117, pts
920, dts 920, duration 40, keyframe 0
Cliping frame in rate conversion by 0.006920
[matroska @ 0x24ff880] Starting new cluster at offset 6577293 bytes, pts
960dts 960
[matroska @ 0x24ff880] Writing block at offset 6577309, size 258490, pts
960, dts 960, duration 40, keyframe 1
Cliping frame in rate conversion by 0.003319
[matroska @ 0x24ff880] Writing block at offset 6835807, size 261313, pts
1000, dts 1000, duration 40, keyframe 0
Cliping frame in rate conversion by 0.003120
[matroska @ 0x24ff880] Writing block at offset 7097128, size 47676, pts
1005, dts 1005, duration 270, keyframe 1
[matroska @ 0x24ff880] Writing block at offset 7144812, size 260221, pts
1040, dts 1040, duration 40, keyframe 0
Cliping frame in rate conversion by 0.003639
[matroska @ 0x24ff880] Writing block at offset 7405041, size 256511, pts
1080, dts 1080, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004723482kB time=00:00:01.64
bitrate=37237.2kbits/s
[matroska @ 0x24ff880] Writing block at offset 7661560, size 255137, pts
1120, dts 1120, duration 40, keyframe 0
Cliping frame in rate conversion by 0.005287
[matroska @ 0x24ff880] Writing block at offset 7916705, size 257635, pts
1160, dts 1160, duration 40, keyframe 0
Cliping frame in rate conversion by 0.005547
[matroska @ 0x24ff880] Writing block at offset 8174348, size 254874, pts
1200, dts 1200, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004814
[matroska @ 0x24ff880] Writing block at offset 8429230, size 255689, pts
1240, dts 1240, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004265
[matroska @ 0x24ff880] Writing block at offset 8684927, size 65472, pts
1275, dts 1275, duration 371, keyframe 1
[matroska @ 0x24ff880] Writing block at offset 8750407, size 262359, pts
1280, dts 1280, duration 40, keyframe 0
Cliping frame in rate conversion by 0.006447
[matroska @ 0x24ff880] Writing block at offset 9012774, size 277796, pts
1320, dts 1320, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004463
[matroska @ 0x24ff880] Writing block at offset 9290578, size 269863, pts
1360, dts 1360, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004692
[matroska @ 0x24ff880] Writing block at offset 9560449, size 260536, pts
1400, dts 1400, duration 40, keyframe 0
Cliping frame in rate conversion by 0.004585
[matroska @ 0x24ff880] Starting new cluster at offset 9820993 bytes, pts
1440dts 1440
[matroska @ 0x24ff880] Writing block at offset 9821009, size 263536, pts
1440, dts 1440, duration 40, keyframe 1
Cliping frame in rate conversion by 0.004967
[matroska @ 0x24ff880] Writing block at offset 10084553, size 266245,
pts 1480, dts 1480, duration 40, keyframe 0
av_interleaved_write_frame(): Input/output error
No more output streams to write to, finishing.
[matroska @ 0x24ff880] Writing block at offset 10350806, size 62264, pts
1647, dts 1647, duration 353, keyframe 1
[matroska @ 0x24ff880] end duration = 2000
frame=   38 fps= 20 q=-0.0 Lq=-0.0 size=   10169kB time=00:00:02.00
bitrate=41652.7kbits/s
video:40603kB audio:344kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
Input file #0 (alsa_input.pci-0000_00_14.2.analog-stereo):
  Input stream #0:0 (audio): 6 packets read (352768 bytes); 6 frames
decoded (88192 samples);
  Total: 6 packets (352768 bytes) demuxed
Input file #1 (/dev/video0):
  Input stream #1:0 (video): 38 packets read (31518720 bytes); 38 frames
decoded;
  Total: 38 packets (31518720 bytes) demuxed
Output file #0 (/Store3/Test/t_20150810_1016.mkv):
  Output stream #0:0 (video): 38 frames encoded; 38 packets muxed
(10059081 bytes);
  Output stream #0:1 (audio): 6 frames encoded (88192 samples); 6
packets muxed (352768 bytes);
  Total: 44 packets (10411849 bytes) muxed
Output file #1 (Dazzle output):
  Output stream #1:0 (video): 38 frames encoded; 38 packets muxed
(31518720 bytes);
  Total: 38 packets (31518720 bytes) muxed
44 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x250b3e0] Statistics: 42 seeks, 369 writeouts
Conversion failed!



More information about the ffmpeg-user mailing list