0

Tried running the code for encoding the batch videos from a list but from the list it seems to run only the first leave behind the rest.

The list mentioned in rip.txt

Data_science - [1x01] - Introduction.mkv
Data_science - [1x02] - What's Data Science.mkv
Data_science - [1x03] - Packages needed.mkv

The Code :

***#!/bin/bash

cd /mnt/d1/xsrc/

fn='/mnt/d1/xsrc/rip.txt'
n=1
while read line;
do
ffmpeg -v error -stats -i "$line" -map 0:2 -map_metadata -1 -map_chapters -1 -vn -an -dn -scodec copy -y /mnt/d1/src2/tmp/sub.ass ; ffmpeg -v error -stats -i "$line" -map 0:1 -map_metadata -1 -map_chapters -1 -b:a 96k -ar 48000 -vn -sn -dn -y /mnt/d1/src2/tmp/audio_jpn.m4a ; ffmpeg -v error -stats -i "$line" -strict -1 -map 0:0 -f yuv4mpegpipe -pix_fmt yuv444p12le -s 1280x720 -r 30 - | x265 - --y4m -p slow --bitrate 723 -t animation --output-depth 10 --pass 1 --bframes=8 --psy-rd=1.5 --psy-rdoq=2 --aq-mode=3 --aq-strength=0.8 --deblock=-1,-1 -o /mnt/d1/src2/tmp/video_und.h265 ; ffmpeg -v error -stats -i "$line" -strict -1 -map 0:0 -f yuv4mpegpipe -pix_fmt yuv444p12le -s 1280x720 -r 30 - | x265 - --y4m -p slow --bitrate 723 -t animation --output-depth 10 --pass 2 --bframes=8 --psy-rd=1.5 --psy-rdoq=2 --aq-mode=3 --aq-strength=0.8 --deblock=-1,-1 -o /mnt/d1/src2/tmp/video_und.h265 ; mp4box -add "/mnt/d1/src2/tmp/video_und.h265#video:lang=und" -new "/mnt/d1/src2/tmp/video0000_und.mp4" ; mkvmerge -o /mnt/d1/output/tmp/"$line" --disable-track-statistics-tags --language 0:jpn /mnt/d1/src2/tmp/audio_jpn.m4a --sub-charset 0:UTF-8 --language 0:eng /mnt/d1/src2/tmp/sub.ass /mnt/d1/src2/tmp/video0000_und.mp4 ; rm -rf /mnt/d1/src2/tmp/* ; n=$((n+1))
done < $fn***

Need help in resolving this.

naoki
  • 33
  • 5
  • 1
    `ffmpeg` reads from standard input, so it's stealing the rest of the video list; you need to either redirect its input, or pass the video list over something other than standard input. See ["Bash While loop read file by line exit on certain line"](https://stackoverflow.com/questions/65709042) and [BashFAQ #89: "I'm reading a file line by line and running ssh or ffmpeg, only the first line gets processed!"](http://mywiki.wooledge.org/BashFAQ/089) BTW, [shellcheck.net](https://www.shellcheck.net) would've spotted this problem. I recommend it! – Gordon Davisson Oct 26 '22 at 05:17

0 Answers0