I've been successfully using your excellent scripts on an Intel based QNAP to effectively leverage ffmpeg to re-container MKV to MP4, transcode an AAC track for iOS support and place it first, then copy DTS audio track if it exists. At least I think that's what I've done. :)
This has been working well until today. This appears to be the specific cause of the ffmpeg failure.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Transcoder section of autoProcessMedia.cfg is as follows:
[Transcoder]
# getsubs. enable to download subtitles.
getSubs = 0
# subLanguages. create a list of languages in the order you want them in your subtitles.
subLanguages = eng, spa, fra
# transcode. enable to use transcoder
transcode = 1
###### duplicate =1 will cretae a new file. =0 will replace the original
duplicate = 0
# concat. joins cd1 cd2 etc into a single video.
concat = 1
ignoreExtensions = .mp4
# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used.
outputFastStart = 0
# outputQualityPercent. used as -q:a value. 0 will disable this from being used.
outputQualityPercent = 0
# outputVideoPath. Set path you want transcoded videos moved to. Leave blank to disable.
outputVideoPath = ""
# processOutput. 1 will send the outputVideoPath to SickBeard/CouchPotato. 0 will send original files.
processOutput = 1
# audioLanguage. set the 3 letter language code you want as your primary audio track.
audioLanguage = eng
# allAudioLanguages. 1 will keep all audio tracks (uses AudioCodec3) where available.
allAudioLanguages = 1
# allSubLanguages. 1 will keep all exisiting sub languages. 0 will discare those not in your list above.
allSubLanguages = 0
# embedSubs. 1 will embded external sub/srt subs into your video if this is supported.
embedSubs = 0
# burnInSubtitle. burns the default sub language into your video (needed for players that don't support subs)
burnInSubtitle = 0
# extractSubs. 1 will extract subs from the video file and save these as external srt files.
extractSubs = 0
# externalSubDir. set the directory where subs should be saved (if not the same directory as the video)
externalSubDir = ""
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg)
hwAccel = 1
# generalOptions. Enter your additional ffmpeg options here with commas to separate each option/value (i.e replace spaces with commas).
generalOptions = -report
# outputDefault. Loads default configs for the selected device. The remaining options below are ignored.
# If you want to use your own profile, leave this blank and set the remaining options below.
# outputDefault profiles allowed: iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mp4-scene-release
outputDefault = ""
#### Define custom settings below.
outputVideoExtension = .mp4
outputVideoCodec = copy
VideoCodecAllow = "libx264,h264,h.264"
outputVideoPreset = medium
outputVideoResolution = 1920:1080
outputVideoFramerate = 24
outputVideoBitrate = 800000
outputVideoCRF = 19
outputVideoLevel = 3.1
outputAudioCodec = ac3
AudioCodecAllow = "ac3,mp3,aac"
outputAudioChannels = 6
outputAudioBitrate = 640k
outputAudioTrack2Codec = libfaac
AudioCodec2Allow = ""
outputAudioTrack2Channels = 2
outputAudioTrack2Bitrate = 128000
outputAudioOtherCodec = libmp3lame
AudioOtherCodecAllow = ""
outputAudioOtherChannels = ""
outputAudioOtherBitrate = 128000
outputSubtitleCodec = ""
Here's the relevant SABNZBD logging:
[07:46:33] [INFO]::MAIN: Checking for files to be transcoded
[07:46:33] [DEBUG]::MAIN: calling command: /opt/Qffmpeg/bin/ffprobe -v quiet -print_format json -show_format -show_streams -show_error /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mkv
[07:46:34] [INFO]::MAIN: Transcoding video: /share/Multimedia/Videos/TV/<my_video>.mp4
[07:46:34] [DEBUG]::MAIN: calling command: nice -n0 ionice -c0 -n0 /opt/Qffmpeg/bin/ffmpeg -loglevel warning -hwaccel auto -report -fflags +genpts -i /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mkv -map 0:0 -map 0:1 -map 0:1 -map 0:2 -c:v copy -c:a:0 ac3 -b:a:0 640000 -c:a:1 libfaac -ac:a:1 2 -b:a:1 128000 -c:s copy /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mp4
[07:46:34] [ERROR]::MAIN: Transcoding of video to /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mp4 failed with result 1
[07:46:34] [ERROR]::SICKBEARD: FAILED: Transcoding failed for files in /share/Multimedia/Videos/TV/<my_video_subfolder>
[07:46:34] [ERROR]::MAIN: A problem was reported in the /share/Download/nzbToMedia/nzbToSickBeard.py script.
SickBeard: Failed to post-process - Transcoding failed!
`
Heres' the ffmpeg logging:
`
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mkv.
Applying option hwaccel (use HW accelerated decoding) with argument auto.
Successfully parsed a group of options.
Opening an input file: /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mkv.
[matroska,webm @ 0x80b3300] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
st:2 removing common factor 1000000 from timebase
[matroska,webm @ 0x80b3300] Before avformat_find_stream_info() pos: 5673 bytes read:94882 seeks:2
[h264 @ 0x80b7f20] Increasing reorder buffer to 1
[h264 @ 0x80b7f20] no picture
[matroska,webm @ 0x80b3300] All info found
[matroska,webm @ 0x80b3300] After avformat_find_stream_info() pos: 503613 bytes read:592822 seeks:2 frames:29
Input #0, matroska,webm, from '/share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.1
creation_time : 2014-10-11 18:58:35
Duration: 00:21:30.58, start: 0.000000, bitrate: 5622 kb/s
Stream #0:0(eng), 10, 1/1000: Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 2k tbc (default)
Stream #0:1(eng), 19, 1/1000: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
Stream #0:2(eng), 0, 1/1000: Subtitle: subrip (default)
Stream #0:3, 0, 1/90000: Attachment: mjpeg
Metadata:
filename : small_cover.jpg
mimetype : image/jpeg
Stream #0:4, 0, 1/90000: Attachment: mjpeg
Metadata:
filename : cover.jpg
mimetype : image/jpeg
Stream #0:5, 0, 1/90000: Attachment: mjpeg
Metadata:
filename : cover_land.jpg
mimetype : image/jpeg
Stream #0:6, 0, 1/90000: Attachment: mjpeg
Metadata:
filename : small_cover_land.jpg
mimetype : image/jpeg
Successfully opened the file.
Parsing a group of options: output file /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mp4.
Applying option map (set input stream mapping) with argument 0:0.
Applying option map (set input stream mapping) with argument 0:1.
Applying option map (set input stream mapping) with argument 0:1.
Applying option map (set input stream mapping) with argument 0:2.
Applying option c:v (codec name) with argument copy.
Applying option c:a:0 (codec name) with argument ac3.
Applying option b:a:0 (video bitrate (please use -b:v)) with argument 640000.
Applying option c:a:1 (codec name) with argument libfaac.
Applying option ac:a:1 (set number of audio channels) with argument 2.
Applying option b:a:1 (video bitrate (please use -b:v)) with argument 128000.
Applying option c:s (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: /share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mp4.
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:1 @ 0x80a3ec0] Setting 'time_base' to value '1/48000'
[graph 0 input from stream 0:1 @ 0x80a3ec0] Setting 'sample_rate' to value '48000'
[graph 0 input from stream 0:1 @ 0x80a3ec0] Setting 'sample_fmt' to value 'fltp'
[graph 0 input from stream 0:1 @ 0x80a3ec0] Setting 'channel_layout' to value '0x60f'
[graph 0 input from stream 0:1 @ 0x80a3ec0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
[audio format for output stream 0:1 @ 0x80b8e40] Setting 'sample_fmts' to value 'fltp'
[audio format for output stream 0:1 @ 0x80b8e40] Setting 'channel_layouts' to value '0x4|0x3|0x103|0x7|0x603|0x33|0x107|0x607|0x37|0xc|0xb|0x10b|0xf|0x60b|0x3b|0x10f|0x60f|0x3f'
[AVFilterGraph @ 0x81e9c20] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
[graph 1 input from stream 0:1 @ 0x80fee60] Setting 'time_base' to value '1/48000'
[graph 1 input from stream 0:1 @ 0x80fee60] Setting 'sample_rate' to value '48000'
[graph 1 input from stream 0:1 @ 0x80fee60] Setting 'sample_fmt' to value 'fltp'
[graph 1 input from stream 0:1 @ 0x80fee60] Setting 'channel_layout' to value '0x60f'
[graph 1 input from stream 0:1 @ 0x80fee60] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
[audio format for output stream 0:2 @ 0x80ab820] Setting 'sample_fmts' to value 's16'
[audio format for output stream 0:2 @ 0x80ab820] Setting 'channel_layouts' to value '0x3'
[audio format for output stream 0:2 @ 0x80ab820] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:2'
[AVFilterGraph @ 0x80b3140] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
0.414214 0.000000 0.292893 0.000000 0.292893 0.000000
0.000000 0.414214 0.292893 0.000000 0.000000 0.292893
[auto-inserted resampler 0 @ 0x81a9ce0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
[mp4 @ 0x8181960] Could not find tag for codec subrip in stream #3, codec not currently supported in container
Output #0, mp4, to '/share/Multimedia/Videos/TV/<my_video_subfolder>/<my_video>.mp4':
Metadata:
encoder : Lavf56.25.101
Stream #0:0(eng), 0, 1/16000: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 16k tbn, 1k tbc (default)
Stream #0:1(eng), 0, 1/48000: Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
Metadata:
encoder : Lavc56.26.100 ac3
Stream #0:2(eng), 0, 1/48000: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s (default)
Metadata:
encoder : Lavc56.26.100 libfaac
Stream #0:3(eng), 0, 1/1000: Subtitle: subrip (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
Stream #0:1 -> #0:2 (ac3 (native) -> aac (libfaac))
Stream #0:2 -> #0:3 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
[AVIOContext @ 0x80b7e80] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x80bb8a0] Statistics: 592822 bytes read, 2 seeks
I've been successfully using your excellent scripts on an Intel based QNAP to effectively leverage ffmpeg to re-container MKV to MP4, transcode an AAC track for iOS support and place it first, then copy DTS audio track if it exists. At least I think that's what I've done. :)
This has been working well until today. This appears to be the specific cause of the ffmpeg failure.
Transcoder section of autoProcessMedia.cfg is as follows:
Here's the relevant SABNZBD logging: