Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter generated by size() do not work with h264_vaapi codec #1120

Open
TheoLeCalvar opened this issue Apr 3, 2021 · 0 comments · May be fixed by #1121
Open

Filter generated by size() do not work with h264_vaapi codec #1120

TheoLeCalvar opened this issue Apr 3, 2021 · 0 comments · May be fixed by #1121

Comments

@TheoLeCalvar
Copy link

Version information

  • fluent-ffmpeg version: 2.1.2
  • ffmpeg version: 4.3.2
  • OS: linux

Code to reproduce

var FfmpegCommand = require('fluent-ffmpeg');
var command = new FfmpegCommand();

command .input('in.mkv')
        .videoCodec('h264_vaapi')
        .inputOptions([
            '-hwaccel vaapi',
            '-hwaccel_output_format vaapi',
            '-vaapi_device /dev/dri/renderD128'
        ])
        .size('?x720')
        .output('out.mp4')
        .on('start', (cmd) => {
            console.log(cmd)
        })
        .on('error', function(err, stdout, stderr) {
            console.log('Cannot process video: ' + err.message);
            console.log('stderr: ' + stderr);
        })
        .run()

Expected results

Generated filter for resize should use scale_vaapi instead of scale.

Expected ffmpeg command line:
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i in.mkv -y -vcodec h264_vaapi -filter:v scale_vaapi=w=trunc(oh*a/2)*2:h=720 out.mp4

Observed results

Ffmpeg fail because scale filter does not exists for vaapi encoders and scale_vaapi should be used instead.

Observed ffmpeg command line:
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i in.mkv -y -vcodec h264_vaapi -filter:v scale=w=trunc(oh*a/2)*2:h=720 out.mp4

Result of code above

ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i in.mkv -y -vcodec h264_vaapi -filter:v scale=w=trunc(oh*a/2)*2:h=720 out.mp4
Cannot process video: ffmpeg exited with code 1: Conversion failed!

stderr:   libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, matroska,webm, from 'in.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-04-20T07:35:28.000000Z
  Duration: 00:15:38.53, start: 0.000000, bitrate: 3446 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
    Metadata:
      BPS-eng         : 2676435
      DURATION-eng    : 00:15:38.375000000
      NUMBER_OF_FRAMES-eng: 22521
      NUMBER_OF_BYTES-eng: 313937551
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(jpn): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Metadata:
      BPS-eng         : 384000
      DURATION-eng    : 00:15:38.528000000
      NUMBER_OF_FRAMES-eng: 29329
      NUMBER_OF_BYTES-eng: 45049344
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Metadata:
      BPS-eng         : 384000
      DURATION-eng    : 00:15:38.528000000
      NUMBER_OF_FRAMES-eng: 29329
      NUMBER_OF_BYTES-eng: 45049344
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip (default)
    Metadata:
      title           : 1
      BPS-eng         : 57
      DURATION-eng    : 00:14:31.125000000
      NUMBER_OF_FRAMES-eng: 211
      NUMBER_OF_BYTES-eng: 6288
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:4(dut): Subtitle: subrip
    Metadata:
      BPS-eng         : 49
      DURATION-eng    : 00:14:45.125000000
      NUMBER_OF_FRAMES-eng: 150
      NUMBER_OF_BYTES-eng: 5481
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:5(spa): Subtitle: subrip
    Metadata:
      title           : European
      BPS-eng         : 60
      DURATION-eng    : 00:14:45.125000000
      NUMBER_OF_FRAMES-eng: 211
      NUMBER_OF_BYTES-eng: 6695
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:6(fre): Subtitle: subrip
    Metadata:
      BPS-eng         : 63
      DURATION-eng    : 00:14:45.125000000
      NUMBER_OF_FRAMES-eng: 212
      NUMBER_OF_BYTES-eng: 7000
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:7(ger): Subtitle: subrip
    Metadata:
      BPS-eng         : 58
      DURATION-eng    : 00:14:42.208000000
      NUMBER_OF_FRAMES-eng: 216
      NUMBER_OF_BYTES-eng: 6404
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-20 07:35:28
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x55f8502c1980] Using a PCE to encode channel layout "5.1(side)"
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[aac @ 0x55f8502c1980] Qavg: 65536.000
[aac @ 0x55f8502c1980] 2 frames left in the queue on closing
Conversion failed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant