diff --git a/ComChap.ps1 b/ComChap.ps1 index 7985f7a..8759afb 100644 --- a/ComChap.ps1 +++ b/ComChap.ps1 @@ -111,7 +111,7 @@ if ($hascommercials) { Add-Content -Path $metafile "END=$([int]($end * 1000))" Add-Content -Path $metafile "title=Chapter $i" } - try {& $ffmpegPath -hide_banner -loglevel error -nostdin -i $infile -i $metafile -c copy -map_metadata 1 -y $outfile} + try {& $ffmpegPath -hide_banner -loglevel error -nostdin -i $infile -i $metafile -c copy -map 0 -map_metadata 1 -y $outfile} catch {Write-Host "Error running ffmpeg: $infile"} } If (!(Test-Path $outfile)) { diff --git a/ComCut.ps1 b/ComCut.ps1 index af44c61..76396ce 100644 --- a/ComCut.ps1 +++ b/ComCut.ps1 @@ -96,7 +96,7 @@ foreach ($line in $lines) { $tempfiles += $chapterfile $concat += "|$chapterfile" $duration = [double]$end - [double]$start - & $ffmpegPath -hide_banner -loglevel error -nostdin -i $infile -ss $start -t $duration -c copy -y $chapterfile + & $ffmpegPath -hide_banner -loglevel error -nostdin -i $infile -ss $start -t $duration -c copy -y -map 0 $chapterfile $totalcutduration += $startnext - $end } $start = $startnext @@ -119,7 +119,7 @@ if ($hascommercials) { $tempfiles += $chapterfile $concat += "|$chapterfile" $duration = [double]$end - [double]$start - & $ffmpegPath -hide_banner -loglevel error -nostdin -i $infile -ss $start -t $duration -c copy -y $chapterfile + & $ffmpegPath -hide_banner -loglevel error -nostdin -i $infile -ss $start -t $duration -c copy -map 0 -y $chapterfile } & $ffmpegPath -hide_banner -loglevel error -nostdin -i $metafile -i ("concat:$($concat.Substring(1))") -c copy -map_metadata 0 -y $outfile } diff --git a/comchap b/comchap index 1d203b1..39ab51f 100755 --- a/comchap +++ b/comchap @@ -200,7 +200,7 @@ if $hascommercials ; then tempfile=`mktemp --suffix=."$outextension" "$outdir"/XXXXXXXX` echo Writing file to temporary file: "$tempfile" - if $ffmpegPath -loglevel error -hide_banner -nostdin -i "$infile" -i "$metafile" -map_metadata 1 -codec copy -y "$tempfile" 1>&3 2>&4; then + if $ffmpegPath -loglevel error -hide_banner -nostdin -i "$infile" -i "$metafile" -map 0 -map_metadata 1 -codec copy -y "$tempfile" 1>&3 2>&4; then mv -f "$tempfile" "$outfile" echo Saved to: "$outfile" else @@ -208,7 +208,7 @@ if $hascommercials ; then exitcode=-1 fi else - if $ffmpegPath -loglevel error -hide_banner -nostdin -i "$infile" -i "$metafile" -map_metadata 1 -codec copy -y "$outfile" 1>&3 2>&4; then + if $ffmpegPath -loglevel error -hide_banner -nostdin -i "$infile" -i "$metafile" -map 0 -map_metadata 1 -codec copy -y "$outfile" 1>&3 2>&4; then echo Saved to: "$outfile" else echo Error running ffmpeg: "$infile" 1>&3 2>&4 >&2 diff --git a/comcut b/comcut index f72c37f..19f19f9 100755 --- a/comcut +++ b/comcut @@ -181,7 +181,7 @@ do concat="$concat|$chapterfile" duration=`echo "$end" "$start" | awk '{printf "%f", $1 - $2}'` - $ffmpegPath -hide_banner -loglevel error -nostdin -i "$infile" -ss "$start" -t "$duration" -c copy -y "$chapterfile" + $ffmpegPath -hide_banner -loglevel error -nostdin -i "$infile" -ss "$start" -t "$duration" -c copy -map 0 -y "$chapterfile" totalcutduration=`echo "$totalcutduration" "$startnext" "$end" | awk '{print $1 + $2 - $3}'` @@ -216,7 +216,7 @@ if $hascommercials ; then concat="$concat|$chapterfile" duration=`echo "$end" "$start" | awk '{printf "%f", $1 - $2}'` - $ffmpegPath -hide_banner -loglevel error -nostdin -i "$infile" -ss "$start" -t "$duration" -c copy -y "$chapterfile" + $ffmpegPath -hide_banner -loglevel error -nostdin -i "$infile" -ss "$start" -t "$duration" -c copy -y -map 0 "$chapterfile" fi $ffmpegPath -hide_banner -loglevel error -nostdin -i "$metafile" -i "concat:${concat:1}" -c copy -map_metadata 0 -y "$outfile"