mdhiggins / sickbeard_mp4_automator Goto Github PK
View Code? Open in Web Editor NEWAutomatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
License: MIT License
Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
License: MIT License
A nice feature would be to batch convert an entire directory of TV shows via manual.py.
I am currently experiencing an issue after separating my sabnzbd and sick beard setup into two servers. Once the download completes it kicks off the post process and the file converts. At that point, when it attempts to communicate back to sickbeard SAB spits out "Download failed - Out of your server's retention?" which I normally only get when the download can not complete. Perhaps the call to a different server is causing some a weird return error code to sab? The file does get moved by sickbeard to it's location, but not to the "move_to" location in this script.
Normally I see [Completed folder]->[sickbeard folder]->[automator move_to folder]
When I run manual.py I usually run it from the directory the show is in, that way when I am asked to enter the file path I can just enter the file name without the full path. However I've just found out that this is the reason my external subtitles are not added.
The problem code is here
for dirName, subdirList, fileList in os.walk(input_dir):
input_dir is empty in this scenario
Is there a way to get the full path of input_dir? In PHP there is a function "realpath" which takes an absolute OR relative path as the input and returns the full absolute path. If python has something similar you could run that on the input_dir variable.
So far this is the only movie with the issue....
CouchPotatoServer did not append the IMDB id to the nzb, guessing instead
Guessed movie title as: Good Will Hunting
Matched movie title as: Good Will Hunting 1997-12-05
Fetching info for imdb id tt0119217
http://api.themoviedb.org/2.1/Movie.imdbLookup/en/json/45e408d2851e968e6e4d0353ce621c66/tt0119217
Failed to connect to tMDB, trying again in 20 seconds
'ascii' codec can't encode character u'\xe5' in position 14: ordinal not in range(128)
http://api.themoviedb.org/2.1/Movie.imdbLookup/en/json/45e408d2851e968e6e4d0353ce621c66/tt0119217
Failed to connect to tMDB, trying again in 20 seconds
'ascii' codec can't encode character u'\xe5' in position 14: ordinal not in range(128)
Hi
i converted a and places the file in post processing folder.
sickbeard failed to execute your script and i cannot see why.
here is the error
Mar-27 11:18:42 INFO POSTPROCESSER :: Unable to run extra_script: 6
Mar-27 11:18:42 INFO POSTPROCESSER :: Executing command ['c:\Scripts\postConversion.cmd', u'D:\90210\90210 - S1E03 - Lucky Strike - SD TV.m4v', u'D:\post\90210 - S01E03 - Lucky Strike - SD TV.m4v', '82716', '1', '3', '2008-09-09']
attached is a screenshot of my sickbeard ini file and the autoprocess file in your directory
Getting this more and more specifically when working with larger files. Unsure what is going on
File "/home/craig/sickbeard_mp4_automator/mkvtomp4.py", line 105, in init
for timecode in conv:
File "/home/craig/sickbeard_mp4_automator/converter/init.py", line 240, in convert
timeout=timeout):
File "/home/craig/sickbeard_mp4_automator/converter/ffmpeg.py", line 406, in convert
ret = fd.read(10)
File "/home/craig/sickbeard_mp4_automator/converter/ffmpeg.py", line 389, in on_sigalrm
raise Exception('timed out while waiting for ffmpeg')
Exception: timed out while waiting for ffmpeg
I have been seeing this about 25% of the time now. Unusual to have this sort of failure rate on remuxes.
{
"subtitle": {
"0": {
"default": 1,
"map": 2,
"codec": "mov_text",
"language": "eng",
"forced": 0
}
},
"audio": {
"0": {
"channels": 7,
"map": 1,
"codec": "aac",
"bitrate": 1792,
"language": "eng"
}
},
"video": {
"map": 0,
"codec": "copy",
"bitrate": 7527035.0
},
"format": "mp4"
}
Traceback (most recent call last):
File "./manual.py", line 261, in
main()
File "./manual.py", line 248, in main
processFile(path, inputs)
File "./manual.py", line 213, in processFile
fileInfo = convertFile(filepath)
File "./manual.py", line 67, in convertFile
convert = MkvtoMp4(path, FFMPEG_PATH=settings.ffmpeg, FFPROBE_PATH=settings.ffprobe, delete=settings.delete, output_extension=settings.output_extension, relocate_moov=settings.relocate_moov, iOS=settings.iOS, awl=settings.awl, swl=settings.swl, adl=settings.adl, sdl=settings.sdl, processMP4=settings.processMP4)
File "/home/craig/sicktest/mkvtomp4.py", line 155, in init
for timecode in conv:
File "/home/craig/sicktest/converter/init.py", line 246, in convert
timeout=timeout):
File "/home/craig/sicktest/converter/ffmpeg.py", line 452, in convert
raise FFMpegConvertError('Encoding error: ' + line)
converter.ffmpeg.FFMpegConvertError: Encoding error: Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
The previous tool I was using to convert videos (http://www.videohelp.com/tools/MkvToMp4) would set a flag on the generated file that would display a little HD logo in iTunes if the file was at least 720p. I have no idea how this was done, but I know it relies on a bunch of third party tools, such as MP4Box and ExifTool - http://www.sno.phy.queensu.ca/~phil/exiftool/
I wonder if this is easy, or at all possible to do in sickbeard_mp4_automator. This is obviously a very minor feature but it all adds up!
How about a script that does nothing more then do the basic mkv->mp4 conversion without anything else? I thought a wrapper around manual.py would work but it doesn't seem to take a command line option to do that.
I know this is going away soon but I get misc errors from time to time with the imdv_mp4.py module.
Fetching info for imdb id 2306745
Tagging file :/home/craig/Movies/Movies/Sound City (2013)/Sound City.mp4
Traceback (most recent call last):
File "/home/craig/sickbeard_mp4_automator/manualConvert.py", line 55, in
imdbmp4.writeTags(convert.output)
File "/home/craig/sickbeard_mp4_automator/imdb_mp4.py", line 69, in writeTags
video["----:com.apple.iTunes:iTunEXTC"] = self.rating()
File "/home/craig/sickbeard_mp4_automator/imdb_mp4.py", line 98, in rating
mpaa = self.movie['mpaa']
File "/home/craig/sickbeard_mp4_automator/imdb/utils.py", line 1433, in getitem
rawData = self.data[key]
KeyError: 'mpaa'
Currently if a season has no poster on thetvdb.com the script will just throw an IOError. In this case I think it would be ideal to then find a poster for the series instead. If that doesn't exist we need to skip adding a poster.
An example of a show like this is 90210 Season 5 (my wife watches it).
http://thetvdb.com/?tab=season&seriesid=82716&seasonid=493163&lid=7
Probably the first "poster" for the series would be best.
http://thetvdb.com/?tab=series&id=82716&lid=7
Full output below of the error below.
C:>python "C:\Users\Michael\SickBeard\sickbeard_mp4_automator\postConversion.py
" "D:\TV Shows\90210\Season 5\90210 5x14 Brother From Another Mother.mkv" I:\Dow
nloads\Usenet\Complete\90210.S05E14.720p.HDTV.x264-EVOLVE\90210.S05E14.720p.HDTV
.x264-EVOLVE.mkv 82716 5 14 2013-02-18
Video codec detected: h264
Audiocodec detected: ac3
Channels detected: 6
[ ] 0%
[ ] 1%
[ ] 1%
[ ] 2%
[ ] 2%
[ ] 3%
[ ] 4%
[ ] 4%
[ ] 5%
[ ] 5%
[ ] 6%
[ ] 6%
[ ] 7%
[ ] 7%
[ ] 8%
[ ] 9%
[ ] 9%
[# ] 10%
[# ] 11%
[# ] 11%
[# ] 12%
[# ] 12%
[# ] 13%
[# ] 13%
[# ] 14%
[# ] 14%
[# ] 15%
[# ] 16%
[# ] 16%
[# ] 17%
[# ] 17%
[# ] 18%
[# ] 18%
[# ] 19%
[# ] 19%
[## ] 20%
[## ] 20%
[## ] 21%
[## ] 21%
[## ] 22%
[## ] 22%
[## ] 23%
[## ] 24%
[## ] 24%
[## ] 25%
[## ] 25%
[## ] 26%
[## ] 26%
[## ] 27%
[## ] 27%
[## ] 28%
[## ] 28%
[## ] 29%
[## ] 29%
[### ] 30%
[### ] 30%
[### ] 31%
[### ] 31%
[### ] 32%
[### ] 33%
[### ] 33%
[### ] 34%
[### ] 34%
[### ] 35%
[### ] 35%
[### ] 36%
[### ] 36%
[### ] 37%
[### ] 38%
[### ] 38%
[### ] 39%
[### ] 39%
[### ] 39%
[#### ] 40%
[#### ] 41%
[#### ] 41%
[#### ] 41%
[#### ] 42%
[#### ] 43%
[#### ] 43%
[#### ] 43%
[#### ] 44%
[#### ] 44%
[#### ] 45%
[#### ] 45%
[#### ] 46%
[#### ] 47%
[#### ] 47%
[#### ] 48%
[#### ] 48%
[#### ] 49%
[#### ] 49%
[##### ] 50%
[##### ] 50%
[##### ] 51%
[##### ] 51%
[##### ] 52%
[##### ] 52%
[##### ] 53%
[##### ] 53%
[##### ] 54%
[##### ] 54%
[##### ] 55%
[##### ] 55%
[##### ] 56%
[##### ] 57%
[##### ] 57%
[##### ] 57%
[##### ] 58%
[##### ] 58%
[##### ] 59%
[##### ] 59%
[###### ] 60%
[###### ] 61%
[###### ] 61%
[###### ] 61%
[###### ] 62%
[###### ] 62%
[###### ] 63%
[###### ] 63%
[###### ] 64%
[###### ] 64%
[###### ] 65%
[###### ] 65%
[###### ] 66%
[###### ] 66%
[###### ] 67%
[###### ] 67%
[###### ] 67%
[###### ] 68%
[###### ] 68%
[###### ] 69%
[###### ] 69%
[###### ] 69%
[####### ] 70%
[####### ] 70%
[####### ] 71%
[####### ] 71%
[####### ] 72%
[####### ] 72%
[####### ] 73%
[####### ] 73%
[####### ] 74%
[####### ] 74%
[####### ] 75%
[####### ] 75%
[####### ] 76%
[####### ] 76%
[####### ] 77%
[####### ] 77%
[####### ] 78%
[####### ] 78%
[####### ] 79%
[####### ] 79%
[######## ] 80%
[######## ] 81%
[######## ] 81%
[######## ] 82%
[######## ] 82%
[######## ] 83%
[######## ] 83%
[######## ] 84%
[######## ] 84%
[######## ] 85%
[######## ] 86%
[######## ] 86%
[######## ] 87%
[######## ] 87%
[######## ] 88%
[######## ] 88%
[######## ] 89%
[######## ] 89%
[######### ] 90%
[######### ] 91%
[######### ] 91%
[######### ] 92%
[######### ] 92%
[######### ] 92%
[######### ] 93%
[######### ] 94%
[######### ] 94%
[######### ] 95%
[######### ] 95%
[######### ] 96%
[######### ] 96%
[######### ] 97%
[######### ] 97%
[######### ] 98%
[######### ] 99%
[######### ] 99%
[##########] 100%
Conversion complete
90210 has queued to be refreshed
{}
success
Tagging file :D:\TV Shows\90210\Season 5\90210 5x14 Brother From Another Moth
er.m4v
Traceback (most recent call last):
File "C:\Users\Michael\SickBeard\sickbeard_mp4_automator\postConversion.py", l
ine 30, in
tagmp4.writeTags(path)
File "C:\Users\Michael\SickBeard\sickbeard_mp4_automator\tvdb_mp4.py", line 54
, in writeTags
path = self.getArtwork()
File "C:\Users\Michael\SickBeard\sickbeard_mp4_automator\tvdb_mp4.py", line 15
8, in getArtwork
return urllib.urlretrieve(posters.topPoster().bannerpath, tempfile.gettempdi
r() + "\poster.jpg")[0]
File "C:\Python27\lib\urllib.py", line 93, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "C:\Python27\lib\urllib.py", line 239, in retrieve
fp = self.open(url, data)
File "C:\Python27\lib\urllib.py", line 207, in open
return getattr(self, name)(url)
File "C:\Python27\lib\urllib.py", line 462, in open_file
return self.open_local_file(url)
File "C:\Python27\lib\urllib.py", line 476, in open_local_file
raise IOError(e.errno, e.strerror, e.filename)
IOError: [Errno 2] The system cannot find the path specified: ''
I am unable to add external .srt files with manual.py -silent. The srt files are in the same file as the original file and are named as recommended: for a video called 'video.mkv', the two subtitles are named 'video.eng.srt' and 'video.nld.srt'. However, the script does not recognize either file, which are therefore not muxed into the final version.
Before the latest merge of the dev and master branches my setup was working fine. Processing via sickbeard worked fine including downloading, transcoding, tagging and moving to the output_directory, which for me is the iTunes auto import directory.
However, after checking out the latest from master, manual processing of files is failing with an error saying the file can't be found but referencing it in the output_directory. If I remove the output_directory setting from my autoProcess.ini file it runs fine.
Additionally, processing by way of sickbeard is also failing with files seemingly being placed in my sickbeard file location rather than the defined output_directory. After both manual and sickbeard runs, I can find in my iTunes auto import directory, an unprocessed copy of the file in question in a "Not Added" folder.
I've checked the updated readme and added all the new config options with no luck. Any tips? Thanks!
Can I suggest an improvement to the handling of settings? When you add new features that require new settings you need to ship a new tvdb_mp4.ini file which overwrites any existing file and customisations. A common way to get around this is to ship a "default" settings file, eg tvdb_mp4.ini.default and ask users to copy it to tvdb_mp4.ini to perform their own customisations. Then when you're reading in the settings you can check the users customised file for the setting and if it doesn't exist you provide a default value, which ideally should be the same as in tvdb_mp4.ini.default. That way if a user has created their tvdb_mp4.ini file and updates to a newer version their old file remains in tact, and they inherit the default value for any new settings, which they can add to their customised file at any time.
I am not sure of any "best practise" ways of doing this in python, but other examples of this include MySQL (which ships my.ini, my.ini.huge,my-innodb-heavy-4G etc) and Drupal (of which I'm most familiar), shipping default.settings.php which you copy to settings.php. Oh and sublimetext2 is similar, in that it has Packages\Default\Preferences.sublime-settings and Packages\User\Preferences.sublime-settings.
Is it possible to import an external .srt file without specifying the language in the filename? I would imagine that it ought to just default to subtitle-default-language but instead it just ignores the subtitle file. This would save having to rename a season worth of subtitle files.
I would love the option to download the artwork and/or show artwork from the iTunes store instead / as well as The TVDB. I will look in to writing a patch for this.
For reference see http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html and as an example https://itunes.apple.com/search?term=Breaking+Bad&attribute=tvSeasonTerm&entity=tvEpisode
I pulled down the latest bits from the master branch yesterday and now after converting a mkv the converted files are not renamed with the .m4v extension like my autoProcess.ini states, they remain with the .mkv extension. On the converted files, if I manually remove the .mkv and replace it with a .m4v it successfully plays in quicktime and iTunes.
my autoprocess.ini looks like:
[SickBeard]
host = localhost
port = 8091
username =
password =
web_root =
ssl = 0
api_key = 83d02c177b6d409b12918ae786be6477
[MP4]
ffmpeg = /usr/local/bin/ffmpeg
ffprobe = /usr/local/bin/ffprobe
output_directory = /Volumes/Courage/addToiTunes
output_extension = m4v
delete_original = False
relocate_moov = True
audio-codec = dts
ios-audio = True
audio-language = eng
audio-default-language = eng
subtitle-language = eng
subtitle-default-language =
convert-mp4 = False
[CouchPotato]
host = localhost
port = 5050
username =
password =
web_root =
ssl = 0
apikey =
delay = 65
method = renamer
delete_failed = 0
Another bug found. Passed args are not always being read correctly.
I tried via python manual.py "/Volumes/NAS/TV Shows/Arrow/Arrow - 1x01 - Pilot - 720p.mkv" and python manual.py /Volumes/NAS/TV\ Shows/Arrow/Arrow\ -\ 1x01\ -\ Pilot\ -\ 720p.mkv
Both fail giving output "Enter path to file:" This also seems a bit dodgy as its worked once and failed many other times.
This kills automation.
Enter path to file:
File "manual.py", line 240, in
main()
File "manual.py", line 228, in main
path = getValue("Enter path to file")
File "manual.py", line 36, in getValue
value = raw_input("#: ").strip(' "')
KeyboardInterrupt
About halfway through a movie remux/audio encode this pops up...Everything is fine, just wondering if we are missing something in the lib's
[##### ] 58%
[##### ] 58%
[##/Users/craigsmith/sickbeard_mp4_automator/imdb/parser/http/utils.py:472: UserWarning: unable to use "lxml": No module named lxml.html
warnings.warn('unable to use "%s": %s' % (mod, str(e)))
/Users/craigsmith/sickbeard_mp4_automator/imdb/parser/http/utils.py:463: UserWarning: falling back to "beautifulsoup"
warnings.warn('falling back to "%s"' % mod)
[##### ] 58%
[##### ] 58%
[##### ] 58%
Can this support converting .ts files to mp4? Apparently this should be possible with ffmpeg. I hadn't heard of .ts until Sickbeard downloaded some 1080p Web-Rips last night. The streams are already h264/aac. If I had .ts to the valid input files and take the raw ffmpeg command I get this error below. Any ideas?
Input #0, mpegts, from 'D:\myfile.ts':
Duration: 00:31:18.69, start: 0.000022, bitrate: 8621 kb/s
Program 1
Stream #0:0[0x64]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x65]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 218 kb/s
[NULL @ 00000000044e00a0] Unable to find a suitable output format for 'c:a:0'
c:a:0: Invalid argument
I have a number of foreign language shows with .srt subtitles (same name as the video files) in the same folder.
Would it be possible to have ffmpeg automatically include the .srt if it finds one with the same filename in the processing folder (as soft subs) and then delete the .srt file when it's done?
Some of the original files will be .mp4 files, so not sure whether this processing can be triggered for them only if they don't already have a subtitle track (ie just adding the subtitle in rather than full processing), or if that will just mean they'll have to be ignored.
Thanks in advance
Is there a reason 448 is used as the bitrate of converted audio streams? From what I've read the maximum bitrate of AAC format is 640. Perhaps this could be configurable? MkvToMp4 has options for 192, 224, 320, 384, 448 and 640. I generally try and stick with as higher quality as possible.
Hi
im looking to use your script, but i see that during the mkvtomp4 script it forces audio to stereo, is there a way i can keep it in what ever format it is, so if it is 5.1 it will convert it to aac 5.1 or if its in stereo it will convert it to 2.0 aac
thanks
I would like to make a pull request to change the manual script so that it respects the tagfile setting. (in this particular case I want to convert my files and relocate moov atom but not tag them). Is there any reason this would not be a good idea? I only started using this script and I am certain I don't have a full grasp of everything.
Need to add an empty init.py file to the folder at a minimum....I can start testing this branch as soon as you would like. I have about 100 movies to convert/tag
I dislike subtitles. I know they can be disabled by most video playing clients, however I'd really like to just get rid of them.
Please add the ability to skip subtitles. (do not copy from original file)
I'm getting the following error when I try to tag a larger file:
C:\Users\Owner\Downloads\Pacific.Rim.2013.720p.WEB-DL.H264-PublicHD\Pacific.rim.
2013.720p.web-dl.h264-publichd-1.m4v detected - already correct format, skipping
reprocessing
Tagging file :C:\Users\Owner\Downloads\Pacific.Rim.2013.720p.WEB-DL.H264-PublicH
D\Pacific.rim.2013.720p.web-dl.h264-publichd-1.m4v
Trying to write tags
Traceback (most recent call last):
File "C:\scripts\manual.py", line 127, in
main()
File "C:\scripts\manual.py", line 121, in main
tagmp4.writeTags(convert.output)
File "C:\scripts\tmdb_mp4.py", line 87, in writeTags
video.save()
File "C:\scripts\mutagen__init__.py", line 134, in save
return self.tags.save(filename, **kwargs)
File "C:\scripts\mutagen\mp4.py", line 299, in save
self.__save_existing(fileobj, atoms, path, data)
File "C:\scripts\mutagen\mp4.py", line 352, in __save_existing
insert_bytes(fileobj, delta, offset)
File "C:\scripts\mutagen_util.py", line 226, in insert_bytes
map = mmap.mmap(fobj.fileno(), filesize + size)
OverflowError: cannot fit 'long' into an index-sized integer
Sick of me yet? Next issue is more of a workaround for iTunes being dumb. If you don't set the track number tag, and iTunes is responsible for organising your library, the file ends up something like C:\Path\To\iTunes\TV Shows\Arrested Development\Season 2\The One Where They Build a House.m4v, which is missing the episode number.
Personally I believe iTunes should use the "episode number" tag instead of "track number" for naming the files, but unfortunately Apple don't agree on that one.
Is it easy enough to set the track number while you're at it?
This is something what I want to try
But i'm not sure were to start. To begin with a fully automated process is not an option due to subtitles, sometimes i have to wait for subtitle and sometimes it's hard to find subtitle with correct framrate.
For me a perfect solution would be an inbox (mkv +optional srt) and a outbox (m4v +optional org. mkv and srt).
It would be great if I could run this post-processing script on my synology either manual or if the script is watching the inbox.
I'm more or less a noob on Linux so any guidelines would be very much appreciated.
I know what DTS is supported in mp4/m4v, is it possible with DTS passthrough?
I have never succeeded to create a m4v with DTS using subler and playback with DTS on aTV using aTV Flash.
Most of my mkv contains DTS and I have no problem to play them using aTV Flash with DTS sound
Ref: http://forums.plexapp.com/index.php/topic/39265-my-solution-for-all-apple-devices/page-1#entry249587
Running on CentOS 6.4 I get the following when running manual.py:
Traceback (most recent call last):
File "manual.py", line 240, in
main()
File "manual.py", line 237, in main
main()
File "manual.py", line 230, in main
walkDir(path, silent)
File "manual.py", line 181, in walkDir
print "Processing file %s" % (filepath.encode(sys.stdout.encoding, errors='ignore'))
TypeError: encode() takes no keyword arguments
Any ideas what is causing it?
Thanks!
Even though we have expanded the guessit approach, there still tend to be failures if the release group puts their name first... This is going to be a bit tricky, I just want to document it.
Just wondering if there is a way to only convert mkv files when sickbeard runs, at the moment when a video is sent to sickbeard it converts it even if its an avi.
I used manual.py for the first time today and was a little confused about which id to put in for the tvdb, I assumed the episode id. The script complained about a 404 not found and I had to start again. It would be an improvement to specify that you need to enter the series id, or perhaps even instead you could opt to enter the episode id and skip the series id, season number and episode number.
Accidentally submitted this before writing a description, however I think the title sums it up. An important consideration would be handling "forced" subtitles, eg. when a show (like Breaking Bad) is primarily in English but has a few Spanish parts there are two English tracks - English (forced) and English. The former is just the Spanish bits and the latter is everything. Is this doable via ffmpeg?
If an episode is not found in sickbeard, still try to tag, even if that fails lets maybe use guessit to figure out what show it is at least and give it some info. Then still move the file to the final location. Currently it just fails and stops.
Hi,
I was wondering if you could implement an option to not lookup show information? Or even just the poster, as plex chooses to use the poster instead of the image grab it creates?
Wow, lots of commits lately, I'll have to check it out. I've read a fair bit about relocating the "MOOV" atom to the start of the file to allow for much faster streaming of large files. I haven't really found any good reference material on it, but I downloaded Atomboxstudio to inspect the atoms, and an Adobe Air application called QT Index Swapper to rearrange the atoms.
You can see the correct order of atoms in the right hand pane here:
Is this easy/possible to do in sickbeard_mp4_automator? I imagine it involves tinkering with mp4.py. I found this issue but the patch doesn't really seem to do anything - http://code.google.com/p/mutagen/issues/detail?id=80&colspec=ID%20Type%20Status%20Priority%20Milestone%20Summary
At one point tagging was adding movie posters, that has seemed to stop before the switch to tmdb as well as after. Is this intended functionality?
I'm looking for a way to force the video conversion to be done in the original (local) path.
I'm running sickbeard and the postconverter on a pc with the files saved locally. After conversion and sickbeard processing they will be stored on a nas. As present, the original avi file (for instance) is copied to the nas first before mkv2mp4 is triggered. This leads to an increase in router/ethernet traffic back and forward and bottlenecks the conversion.
Would it be easy to edit the script (or create an option in the script) so that it can convert on the local disk (either in a temporary local folder, or in the original sickbeard processing folder), rather than only after the file has been transferred to the output path?
My settings create two audio streams one AAC and another AAC 2.0 (iOS compatible). When trying to force mp4 to convert, which this script had made. It created a third AAC 2.0 audio stream.
This seems to be a bug.
Hi, Sorry if this is a stupid post...
I have a problem where the converted mp4 is being moved straight from the SABnzbd completed dir (which is where the mkv->mp4 conversion is done), straight into the sick beard tv show directory.
This would normally be ok but I'm trying to use the import to iTunes folder.
I've tried a few things, sorting in SAB is disabled and post processing is disabled in Sickbeard. At the moment I'm only calling the SABtoSickbeardwithConvert.py script from SAB, I have not enabled the extra_script in sick beard.
Let me know what info you need me to post, here's an extract from my autoprocess.ini.
[MP4]
ffmpeg=ffmpeg
ffprobe=ffprobe
output_directory=
copy_to=
move_to=/mnt/iTunes/
output_extension=mp4
delete_original=True
relocate_moov=False
audio-codec=ac3
ios-audio=True
audio-language=eng
audio-default-language=eng
subtitle-language=eng
subtitle-default-language=eng
fullpathguess=True
convert-mp4=False
tagfile=True
I'm having trouble getting automatic tagging to work with sabToSickBeardwithConverter.py. The m4v file is created, but it is not tagged and I don't think the mov atom is relocated either. I have to run manual.py over everything that is downloaded. Have I got something wrong?
autoProcess.ini
[SickBeard]
host=localhost
port=8081
username=
password=
web_root=
ssl=0
api_key=1a622302f657d8ae18735c30ddd74477
[MP4]
ffmpeg=C:/ffmpeg/bin/ffmpeg.exe
ffprobe=C:/ffmpeg/bin/ffprobe.exe
output_directory=
copy_to=
move_to=
output_extension=m4v
delete_original=True
relocate_moov=True
audio-codec=ac3
ios-audio=True
audio-language=eng
audio-default-language=eng
subtitle-language=eng
subtitle-default-language=eng
fullpathguess=True
convert-mp4=False
tagfile=True
[CouchPotato]
host = localhost
port = 5050
username =
password =
web_root =
ssl = 0
apikey =
delay = 65
method = renamer
delete_failed = 0
Output from SABnzbd+
Video codec detected: h264
Audio stream detected: ac3 eng [Stream 1]
Creating dual audio channels for iOS compatability for this stream
Subtitle stream detected: subrip nor [Stream 2]
E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS\Homeland.S03E09.One.Last.Time.720p.WEB-DL.DD5.1.H.264-BS.m4v created
E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS\Homeland.S03E09.One.Last.Time.720p.WEB-DL.DD5.1.H.264-BS.mkv deleted
Loading config from C:\SickBeard\autoProcessTV\sickbeard_mp4_automator\autoProcess.ini
Opening URL: http://localhost:8081/home/postprocess/processEpisode?nzbName=Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS.nzb&quiet=1&dir=E%3A%5CDownloads%5Ccomplete%5CHomeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS
Processing folder E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS
Processing E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS\Homeland.S03E09.One.Last.Time.720p.WEB-DL.DD5.1.H.264-BS.m4v (Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS.nzb)
Found result in history: (247897, 3, [])
Parsed Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS.nzb into Homeland - S3E9 - 720p.WEB-DL.DD5.1.H.264 (BS) [ABD: False]
Checking scene exceptions for a match on Homeland
Looking up Homeland in the DB
Lookup successful, using tvdb id 247897
Loading show object for tvdb_id 247897
Retrieving episode object for 3x9
The old status had a quality in it, using that: 720p WEB-DL
SB snatched this episode so I'm marking it as priority
Is ep a priority download: True
There is no existing file so there's no worries about replacing it
This download is marked a priority download so I'm going to replace an existing file if I find one
Found release name Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS
Destination folder for this episode: E:\TV Shows\Homeland
Moving file from E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS\Homeland.S03E09.One.Last.Time.720p.WEB-DL.DD5.1.H.264-BS.m4v to E:\TV Shows\Homeland\Homeland - 3x09 - Horse and Wagon.m4v
Deleting folder E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS
Processing succeeded for E:\Downloads\complete\Homeland.S03E09.720p.WEB-DL.DD5.1.H.264-BS\Homeland.S03E09.One.Last.Time.720p.WEB-DL.DD5.1.H.264-BS.m4v
I've tried multiple ways to convert avi files with manual.py I continualy receive this error:
Video codec detected: mpeg4
Audio stream detected: mp3 und [Stream 1]
Undefined language detected, defaulting to eng
{
"subtitle": {},
"audio": {
"0": {
"channels": 2,
"map": 1,
"codec": "aac",
"bitrate": 512,
"language": "eng"
}
},
"video": {
"map": 0,
"codec": "h264",
"bitrate": 1081576.0
},
"format": "mov"
}
Traceback (most recent call last):
File "./manual.py", line 240, in
main()
File "./manual.py", line 221, in main
processFile(path, tagdata)
File "./manual.py", line 167, in processFile
output = converter.process(inputfile, True)
File "/Users/ncl/Development/sickbeard_mp4_automator/mkvtomp4.py", line 73, in process
outputfile, inputfile = self.convert(inputfile, options, reportProgress)
File "/Users/ncl/Development/sickbeard_mp4_automator/mkvtomp4.py", line 269, in convert
for timecode in conv:
File "/Users/ncl/Development/sickbeard_mp4_automator/converter/init.py", line 246, in convert
timeout=timeout):
File "/Users/ncl/Development/sickbeard_mp4_automator/converter/ffmpeg.py", line 454, in convert
raise FFMpegConvertError('Unknown ffmpeg error ' + line)
converter.ffmpeg.FFMpegConvertError: Unknown ffmpeg error Unknown encoder 'libx264'
Hey, I am having an issue with my converted media.
I use plex which stream to my ps3, all my mp4 (non-converted) files play fine but I receive an error on the ps3 when I try to play any of the converted files.
Error code from the sony is "The data type is not supported. (800288C9)", yet if I turn off directplay from plex, plex converts the file on the fly but only the audio not the video.
I have tried changing the audio to aac and ac3, still no luck.
The only difference in files I can see is when you open both files in mediainfo is;
Converted MKV
Format: MPEG-4
Format Profile: Quicktime
Codec ID: qt
Non-converted MP4
Format: MPEG-4
Format Profile: Base Media
Codec ID: isom
Hope you can shed some light on my little problem.
In some scenario (not sure what) s.language is not a string, but a "NoneType". This causes the script to fail. See traceback below.
Traceback (most recent call last):
File "C:\Users\Michael\SickBeard\sickbeard_mp4_automator\postConversion.py", line 18, in
convert = MkvtoMp4(path, settings.ffmpeg, settings.ffprobe, settings.delete, settings.output_extension, settings.relocate_moov)
File "C:\Users\Michael\SickBeard\sickbeard_mp4_automator\mkvtomp4.py", line 44, in init
print "Subtitle stream detected: " + s.language
TypeError: cannot concatenate 'str' and 'NoneType' objects
Either hide of shorten the audio encoding percentage for easier log reading. Maybe all it when debuging is turned on in the autoprocess.ini???
So, this is without doing much research into the code changes but it appears that the conversion is shooting the output directly into the destination directory (presumably to avoid a move action). This creates a few issues for me, but may not be big enough deals for the majority of script users. My destination is the "Automatically move to iTunes" folder.
The concern is two fold, There have been conversion failures that have left empty mp4's in the folder and imported as movies into iTunes and secondly there is a risk that the file will be imported into iTunes between conversion and tagging. This has been evidenced by a couple films that have been imported with no cover or tagging (EDIT: Further validated with running dev branch with sabnzbd, TV shows have imported without being tagged).
Firstly it would be nice to convert in-place to the same location as the source and then move afterwards.
Second perhaps it would be valuable to offer a -log flag to direct the output to a log file, this would help with large batch jobs so we can see where and if there were issues along the way.
Short of all that longwindedness the manual script is running very well.
Thoughts?
The MP4 files created by your tool have two audio tracks, the AAC stereo and the AC3 5.1 track, as expected. However, to work correctly with the AppleTV the AC3 track should be disabled, as two 'default' tracks are not allowed. (This is at least a problem for firmware 6.0, 5.1 has also been reported, see: http://forums.macrumors.com/showthread.php?t=1455090&page=3). This results in the audio of the resulting file not playing on the AppleTV unless a track is selected explicitly. Files in which the AC3 tracks have been disabled correctly play audio straight away.
Mp4box info output of an incorrect file:
Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:42:37.237
Media Info: Language "Undetermined" - Type "soun:mp4a" - 119871 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1
Track # 3 Info - TrackID 3 - TimeScale 48000 - Duration 00:42:37.216
Media Info: Language "Undetermined" - Type "soun:ac-3" - 79913 samples
AC3 stream - Sample Rate 48000 - 6 channel(s) - bitrate 0
Alternate Group ID 1
Mp4box info output of a correct file:
Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:43:11.573
Media Info: Language "Undetermined" - Type "soun:mp4a" - 121480 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1
Track # 3 Info - TrackID 3 - TimeScale 48000 - Duration 00:43:11.552
Track is disabled
Media Info: Language "Undetermined" - Type "soun:ac-3" - 80986 samples
AC3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 384000
Alternate Group ID 1
This is clearly an unexpected consequence of the ability to manually process files. I was updating the metadata on some files I'd previously acquired when I noticed the issue. To demonstrate the issue I copied a short video so that one filename had an apostrophe and the other didn't. First video runs fine and the subsequent one fails. Thanks.
saadiq@el-gigante:~/tmp$ cp blah.avi "don't blah.avi"
saadiq@el-gigante:~/tmp$ python ~/dev/sickbeard_mp4_automator/manual.py blah.avi -tv 247808 2 14
Processing Suits Season 2 Episode 14 - He's Back
Video codec detected: mpeg4
Audio stream detected: adpcm_ms und [Stream 1]
Undefined language detected, defaulting to eng
{'subtitle': {}, 'audio': {0: {'channels': 1, 'map': 1, 'codec': 'aac', 'bitrate': 256, 'language': 'eng'}}, 'video': {'map': 0, 'codec': 'h264', 'bitrate': 3902610.0}, 'format': 'mp4'}
Conversion complete
blah.avi deleted
Relocating MOOV atom to start of file
Cleanup successful
Tagging file :blah.mp4
Trying to write tags
Tags written successfully
saadiq@el-gigante:~/tmp$ python ~/dev/sickbeard_mp4_automator/manual.py don\'t\ blah.avi -tv 247808 2 14
Processing Suits Season 2 Episode 14 - He's Back
Traceback (most recent call last):
File "/Users/saadiq/dev/sickbeard_mp4_automator/manual.py", line 159, in <module>
main()
File "/Users/saadiq/dev/sickbeard_mp4_automator/manual.py", line 151, in main
convert = MkvtoMp4(path, FFMPEG_PATH=settings.ffmpeg, FFPROBE_PATH=settings.ffprobe, delete=settings.delete, output_extension=settings.output_extension, relocate_moov=settings.relocate_moov, iOS=settings.iOS, awl=settings.awl, swl=settings.swl, adl=settings.adl, sdl=settings.sdl, audio_codec=settings.acodec)
File "/Users/saadiq/dev/sickbeard_mp4_automator/mkvtomp4.py", line 19, in __init__
self.height = info.video.video_height
AttributeError: 'NoneType' object has no attribute 'video'
saadiq@el-gigante:~/tmp$
I must have messed something up....
File "/home/craig/sickbeard_mp4_automator/nzbToCouchPotatoMP4.py", line 61
except AttributeError:
^
SyntaxError: invalid syntax
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.