emk / subtitles-rs

Use SRT subtitle files to study foreign languages (in progress)
Apache License 2.0
304 stars 32 forks source link

I cannot get substudy to function #25

Closed Spinozza closed 7 years ago

Spinozza commented 7 years ago

When I run, substudy combine episode_01_01.es.srt episode_01_01.en.srt > episode_01_01.bilingual.srt

Nothing happens. If I drop the word substudy from the above, I get "Usage: combine Filel OP file2" as an error.

If I run substudy export csv episode_01_01.mkv episode_01_01.es.srt episode_01_01.en.srt then I get "MissingFieldError("streams")"

If I run that code wthout the ">" after mkv, then I get: Invalid arguments. Usage: substudy clean <subs> substudy combine <foreign-subs> <native-subs> substudy export csv <video> <foreign-subs> [<native-subs>] substudy export review <video> <foreign-subs> [<native-subs>] substudy export tracks <video> <foreign-subs> substudy list tracks <video> substudy --help substudy --version

https://forum.language-learners.org/viewtopic.php?f=19&t=6360&start=10 is where another person tried to help. I welcome your thoughts on where I am going wrong. I installed LinuxMint18 just to use your program, so maybe it is possible I am missing some foundational download I need before using substudy.

emk commented 7 years ago

Hi, I'm sorry for the inconvenience. :-(

Could you please run:

substudy --version
ffmpeg -version

...and let me know what you see? Something odd may be going on here, and I'm wondering if you have a working version of ffmpeg installed or not.

Also, when pasting command output into GitHub, could you please wrap it two lines of three backticks each, like this:

```
command output goes here
```

Thank you!

Spinozza commented 7 years ago

No need to be sorry! Your posts for language learning have been very inspirational and helpful over the years. Thank you so much for your time and consideration to help me try to resolve this :) Under substudy the version I get is 0.4.2

When I did the ffmpeg version, I got:

ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil      54. 31.100 / 54. 31.100
libavcodec     56. 60.100 / 56. 60.100
libavformat    56. 40.101 / 56. 40.101
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 40.101 /  5. 40.101
libavresample   2.  1.  0 /  2.  1.  0
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  2.101 /  1.  2.101
libpostproc    53.  3.100 / 53.  3.100
emk commented 7 years ago

OK, so your substudy and your ffmpeg both look pretty plausible.

Now let's try using the script command to record everything you type, and all the output. This works as follows:

script

Now try running the following commands, exactly as follows, pasting each in at the command prompt:

ls
export RUST_LOG=substudy=debug
substudy combine episode_01_01.es.srt episode_01_01.en.srt | head
substudy combine episode_01_01.es.srt episode_01_01.en.srt > combined.srt
ls
head combined.srt
substudy export csv episode_01_01.mkv episode_01_01.es.srt episode_01_01.en.srt
exit

When you've done all this, it should create a file named typescript, with everything you typed, and all the output. Please attach that file here.

The MissingFieldError("streams") suggests that your video file may be in an unusual format, and the ffmpeg is failing to find any tracks.

Thank you for trying this! Something weird is going on here, and script plus RUST_LOG will capture a considerable amount of fine-grained detail, so that I can get some idea of when things start to go wrong.

Spinozza commented 7 years ago

Okay, I think this is what you wanted. Just everything from start to end of typescript?

Script started, file is typescript
zmint18@mint18 ~ $ ls
Desktop    Downloads                    Music     Public    Templates   Videos
Documents  episode_01_01.bilingual.srt  Pictures  substudy  typescript
zmint18@mint18 ~ $ export RUST_LOG=substudy=debug
zmint18@mint18 ~ $ substudy combine episode_01_01.es.srt episode_01_01.en.srt | head
No such file or directory (os error 2)
zmint18@mint18 ~ $ substudy combine episode_01_01.es.srt episode_01_01.en.srt > combined.srt
zmint18@mint18 ~ $ ls
combined.srt  Downloads                    Pictures  Templates
Desktop       episode_01_01.bilingual.srt  Public    typescript
Documents     Music                        substudy  Videos
zmint18@mint18 ~ $ head combined.srt
No such file or directory (os error 2)
zmint18@mint18 ~ $ substudy export csv episode_01_01.mkv episode_01_01.es.srt episode_01_01.en.srt
DEBUG:substudy::video: Video metadata: {

}

MissingFieldError("streams")
zmint18@mint18 ~ $ exit
exit
Script done, file is typescript

As for the video file being unusual, perhaps there is an easier fix here? I have the actual physical DVDs for this TV show. I could always make another copy on Handbrake. When making the first copy, I set "Container" under "Output Settings" to MKV. But on the right side under Presets, is there perhaps a most ideal choice to select over there as well?

Spinozza commented 7 years ago

Sorry, accidentally closed and had to reopen the issue. But I am happy to try to redo handbrake again if you think that might be useful.

emk commented 7 years ago

Found it! Here's the problem:

zmint18@mint18 ~ $ ls
Desktop    Downloads                    Music     Public    Templates   Videos
Documents  episode_01_01.bilingual.srt  Pictures  substudy  typescript
zmint18@mint18 ~ $ export RUST_LOG=substudy=debug
zmint18@mint18 ~ $ substudy combine episode_01_01.es.srt episode_01_01.en.srt | head
No such file or directory (os error 2)

The command ls lists all the files in your current directory (like dir on Windows). Here, you can see that you don't have a episode_01_01.es.srt or episode_01_01.en.srt file, nor do you have a episode_01_01.mkv file. You need to make sure that all three files are present in whatever directory you're in when you run substudy. You can use cd path/to/my/directory to change your current directory in the shell.

The error messages from substudy are less than useful, I admit, and I should fix that.

emk commented 7 years ago

I've created issue #26 to remind me to improve these error messages. Other than that, I think we've figured out the major problem here, so I'm going to go ahead and close it. Please feel free to reopen this issue if it isn't actually resolved, of course. :-)

Spinozza commented 7 years ago

Sorry, I have one simple question....how do I change my directory? right now my code says:

zmint18@mint18 ~/substudy $ 

If I have the two srt files and the mkv file all in a folder called "MadMen" on the desktop/homescreen of LinuxMint, how do I change the directory to read to that? I typed in the "cd path/to/my/directory" but am unsure what to do since that brings up an error saying

zmint18@mint18 ~/substudy $ cd path/to/my/directory
bash: cd: path/to/my/directory: No such file or directory

That is my last question of the day, I promise!

emk commented 7 years ago

Try cd Desktop, in that case. (I don't know if that's correct, but it sounds promising, and I can see it in the ls output above.) path/to/my/directory was just a placeholder for you to replace. :-)