2

I'm trying to play a video via CLI in Ubuntu 19.10

I run the command:

con@e:/mnt/Windows/Users/...$ vlc video.flv
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[000056347c5755b0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
[00007f7e20003430] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
[00007f7e20003430] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
[00007f7e20003430] glconv_vaapi_drm gl error: vaInitialize: unknown libva error
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
[flv @ 0x7f7e34c160c0] Unable to seek to the next packet
QObject::~QObject: Timers cannot be stopped from another thread

The video plays in both Totem and VLC, but when I try to seek to another time, the whole thing crashes. Totem does not print an error report, but VLC does so I pasted it above.

I have seen similar posts here, such as https://ubuntuforums.org/showthread.php?t=2387235 but I don't see a solution there or https://bugs.launchpad.net/ubuntu/+source/intel-vaapi-driver/+bug/1756380

I've also seen Why does LIBVA return an error while trying to init Intel GM965 driver? but I don't understand anything there that can help me.

listing the libva2 package, I see:

libva2/eoan,now 2.5.0-1 amd64 [installed]
libva2/eoan 2.5.0-1 i386

This error only happens for some videos, not others, and I don't know which ones exactly.

I've also seen VLC crashed when trying to play video

which suggests I do:

con@e:/mnt/Windows/Users/...$ vainfo
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

unfortunately that page is still unsolved after > 1 year.

I have also looked at https://forum.videolan.org/viewtopic.php?f=13&t=148280 but the solution there: vlc -V x11 video.mp4 still returns the same error.

VLC has the same problem when opening the same file from windows.

output from mediainfo:

con@e:/mnt/Windows/Users/...$ file.flv 
General
Complete name                            : file.flv
Format                                   : Flash Video
File size                                : 167 MiB
Tagged date                              : UTC 2009-05-30 03:59:09
Tagging application                      : MEGA

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 5 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : 7
Width                                    : 416 pixels
Height                                   : 224 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive

Audio
con
  • 338
  • 1
  • 4
  • 14

1 Answers1

2

When a file is probably damaged, as seems to be the case with your file, there are a couple of good choices:

  1. Simply change the container. In your case you have AVC or H.264 in an flv container and either no sound or more than likely AAC sound. Both of these codecs live quite happily in an mp4 container. So the following would be best to remux your file:

    ffmpeg -i file.flv -c copy test.mp4
    

    This would not be helpful if either video or audio codec were themselves damaged. Important to note as well that -c:copy only copies the first of all streams...

  2. Re-encode the file + new container. If remuxing is unsuccessful re-encoding would be another option with the caveat that there would be an appreciable loss of quality. Something like the following would accomplish this by re-encoding the video stream:

    ffmpeg -i file.flv -c:v libx264 -preset slow -crf 22 -c:a copy test.mp4
    

    If the audio stream (if this exists) is damaged you could also re-encode this by using -c:a aac -b:a 128k.

And hopefully this will resurrect your old file :)

andrew.46
  • 39,359