ekisu / mpv-webm

Simple WebM maker for mpv, with no external dependencies.
MIT License
571 stars 33 forks source link

Append metadata title during encoding #20

Closed ghost closed 6 years ago

ghost commented 6 years ago

Here is a suggestion: an option (toggled on by default if possible) that copies the filename and uses it during the video encoding to add a metadata title. This is useful for those video that lost the original name title. Thanks to this you can track down the origin of a file even after multiple encoding since the metadata title should be preserved even after additional encodings with ffmpeg. Right now I have to do this with a bash script like this:

filename=$(basename -- "$i")
tempname=${filename%.*}_tmp.${filename##*.}

mv "$filename" "$tempname"
ffmpeg -i "$tempname" -c copy -metadata title="$filename" "$filename"
rm "$tempname"

but I would rather do the job during video encoding so I don't need to make and remove useless temp files

ekisu commented 6 years ago

Duplicate of #12, although he closed the issue when he wrote his own code for that.

I still kinda doubt the usefulness of this, but I'll do it anyway. Soon(tm).

ghost commented 6 years ago

Thanks. Now that I'm thinking about it this shoukd be set off by default or it will affect other people who dont want to edit their metadata at all

ekisu commented 6 years ago

@leewdch I also think off by default makes more sense. Try it out.

ghost commented 6 years ago

I tried the script but the encode fails and it asks me to check the logs. I didn't find logs in my home, source directory or in my mpv config directory

ekisu commented 6 years ago

Please run mpv in the console with the -v and post the output, or add the log-file=log.txt line to your mpv.conf and upload the resulting log.txt file (it will be in the same directory as the video file you're watching).

ghost commented 6 years ago
$ mpv -v
[cplayer] Command line options: '-v'
[cplayer] mpv 0.28.2 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Mon Apr 23 21:31:45 CEST 2018
[cplayer] ffmpeg library versions:
[cplayer]    libavutil       56.14.100
[cplayer]    libavcodec      58.18.100
[cplayer]    libavformat     58.12.100
[cplayer]    libswscale      5.1.100
[cplayer]    libavfilter     7.16.100
[cplayer]    libswresample   3.1.100
[cplayer] ffmpeg version: 4.0
[cplayer] 
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --enable-cdda --enable-dvb --enable-dvdnav --enable-encoding --enable-libarchive --enable-libmpv-shared --enable-libsmbclient --enable-zsh-comp
[cplayer] List of enabled features: 52arch alsa asm atomics build-date caca cdda cplayer cplugins cuda-hwaccel debug-build drm drmprime dvbin dvdnav dvdread-common egl-drm egl-helpers egl-x11 encoding fchmod ffmpeg gbm gbm.h gl gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv jack jpeg lcms2 libaf libarchive libass libass-osd libav-any libavcodec libavdevice libbluray libdl libm libmpv-shared librt libsmbclient linux-fstatfs lua optimize oss-audio plain-gl posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vt.h x11 xv zlib zsh-comp
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Reading config file /home/leewdch/.config/mpv/mpv.conf
[ifo] Opening /home/leewdch/.config/mpv/input.conf
[ifo_dvdnav] Opening /home/leewdch/.config/mpv/input.conf
[bdmv/bluray] Opening /home/leewdch/.config/mpv/input.conf
[file] Opening /home/leewdch/.config/mpv/input.conf
[input] Parsing input config file /home/leewdch/.config/mpv/input.conf
[input] Input config file /home/leewdch/.config/mpv/input.conf parsed: 9 binds
[osd/libass] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.7.6 (COMPLEX)
[osd/libass] Setting up fonts...
[ytdl_hook] lua-settings/ytdl_hook.conf not found. 
[stats] lua-settings/stats.conf not found. 
[cplayer] mpv 0.28.2 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Mon Apr 23 21:31:45 CEST 2018
[cplayer] ffmpeg library versions:
[cplayer]    libavutil       56.14.100
[cplayer]    libavcodec      58.18.100
[cplayer]    libavformat     58.12.100
[cplayer]    libswscale      5.1.100
[cplayer]    libavfilter     7.16.100
[cplayer]    libswresample   3.1.100
[cplayer] ffmpeg version: 4.0
[cplayer] 
[cplayer] Usage:   mpv [options] [url|path/]filename
[cplayer] 
[cplayer] Basic options:
[cplayer]  --start=<time>    seek to given (percent, seconds, or hh:mm:ss) position
[cplayer]  --no-audio        do not play sound
[cplayer]  --no-video        do not play video
[cplayer]  --fs              fullscreen playback
[cplayer]  --sub-file=<file> specify subtitle file to use
[cplayer]  --playlist=<file> specify playlist file
[cplayer] 
[cplayer]  --list-options    list all mpv options
[cplayer]  --h=<string>      print options which contain the given string in their name
[cplayer] 
[ytdl_hook] Exiting...
[stats] Exiting...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[osc] Exiting...

log.zip

ekisu commented 6 years ago

I need that you try to encode something and trigger the error, so that I can examine the logs.

ghost commented 6 years ago

log.zip

ekisu commented 6 years ago
[  20.924][v][webm] Error parsing option oset-metadata (option not found)
[  20.924][v][webm] Setting commandline option --oset-metadata=title=%42%[HorribleSubs] Fumikiri Jikan - 05 [1080p] failed.

Is your mpv updated? This was added quite some time ago.

ghost commented 6 years ago

switching from mpv to mpv-git in the AUR fixed the issue