FFMPEG 3.3.2 audio copy conversion question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FFMPEG 3.3.2 audio copy conversion question

Adam Gendron
Hello,

Not sure if this is the correct place to ask this, but I have a question about FFMPEGs workflow for copying and converting an audio stream in one operation:

What I'm trying to do is convert some "home video" from mkv to mp4. Video codec is from one mpeg2 stream to one h264 stream, this works fine. Audio codec is one AC3 192kpbs "Dolby Surround" stream. With the audio conversion, I'm trying to copy the original audio stream to the output, as well as convert that original audio stream to 2ch aac 128kpbs while retaining the "dolby surround" matrix encoding (OR just converting to 2ch aac 128kbps stereo) for compatibility (e.g. Windows Media Player on older PCs doesn't support AC3, as well as some older video players for portable media players). What I am getting when I attempt to map the original stream to 0:a:0 for the copied stream and 0:a:1 for the converted audio stream is "filtering and streamcopy cannot be used together". Now, I imagine that is because I am using the audio filter "aresample=matrix_encoding=dplii". Command Line:

for %%D in (*.mkv *.mp4) do ffmpeg -report -i "%%D" -filter_complex "[0:v]yadif=1:-1:1,fps=60000/1001;[0:a]aresample=matrix_encoding=dplii" -map 0:0 -c:v libx264 -preset veryslow -crf 21 -tune film -map 0:1 -c:a:0 copy -map 0:1 -c:a:1 aac -ac:a:1 2 -b:a:1 128k -cutoff:a:1 18000 -map 0:2 -c:s copy -movflags +faststart -threads 1 "%%~nD [480p x264].mp4"

for %%D in (*.mkv *.mp4) do ffmpeg -report -i "%%D" -map 0:0 -map 0:1 -map 0:1 -map 0:2 -c:v libx264 -preset veryslow -vf "yadif=1:-1:1,fps=60000/1001" -crf 21 -tune film -c:a:0 copy -c:a:1 aac -ac:a:1 2 -b:a:1 128k -cutoff:a:1 18000 -af:a:1 aresample=matrix_encoding_dplii -c:s copy -movflags +faststart -threads 1 "%%~nD [480p x264].mp4"

Thanks in advance.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG 3.3.2 audio copy conversion question

Gyan

On 10/12/2017 1:59 AM, Adam Gendron wrote:
>
> for %%D in (*.mkv *.mp4) do ffmpeg -report -i "%%D" -map 0:0 -map 0:1 -map 0:1 -map 0:2 -c:v libx264 -preset veryslow -vf "yadif=1:-1:1,fps=60000/1001" -crf 21 -tune film -c:a:0 copy -c:a:1 aac -ac:a:1 2 -b:a:1 128k -cutoff:a:1 18000 -af:a:1 aresample=matrix_encoding_dplii -c:s copy -movflags +faststart -threads 1 "%%~nD [480p x264].mp4"

Share the log for this command.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG 3.3.2 audio copy conversion question

Moritz Barsnick
In reply to this post by Adam Gendron
On Wed, Oct 11, 2017 at 20:29:22 +0000, Adam Gendron wrote:
> for %%D in (*.mkv *.mp4) do ffmpeg -report -i "%%D" -filter_complex "[0:v]yadif=1:-1:1,fps=60000/1001;[0:a]aresample=matrix_encoding=dplii" -map 0:0 -c:v libx264 -preset veryslow -crf 21 -tune film -map 0:1 -c:a:0 copy -map 0:1 -c:a:1 aac -ac:a:1 2 -b:a:1 128k -cutoff:a:1 18000 -map 0:2 -c:s copy -movflags +faststart -threads 1 "%%~nD [480p x264].mp4"

Let me quote the important thing:
> ... -map 0:0 ...  -map 0:1 -c:a:0 copy -map 0:1 -c:a:1 aac -ac:a:1 2 -b:a:1 128k ...

You need to map the outputs of the filter chains to specific "tagd",
and explicitly map these "tags" into the output file:

$ ... -filter_complex "[0:v]yadif=1:-1:1,fps=60000/1001[v];[0:a]aresample=matrix_encoding=dplii[a]" \
  ... -map "[v]" -map 0:a -c:a:0 copy -map "[a]" -c:a:1 aac -ac:a:1 2 -b:a:1 128k ...

(Your filter probably wouldn't even have been applied to your video,
thanks to your mishap, as you were also mapping the input 0:0 instead
of the filter's video output. And you were mixing 0:v, 0:a with 0:0 and
0:1, although you presumably meant the same thing - that's confusing.)

> for %%D in (*.mkv *.mp4) do ffmpeg -report -i "%%D" -map 0:0 -map 0:1 -map 0:1 -map 0:2 -c:v libx264 -preset veryslow -vf "yadif=1:-1:1,fps=60000/1001" -crf 21 -tune film -c:a:0 copy -c:a:1 aac -ac:a:1 2 -b:a:1 128k -cutoff:a:1 18000 -af:a:1 aresample=matrix_encoding_dplii -c:s copy -movflags +faststart -threads 1 "%%~nD [480p x264].mp4"

What's this now? Your input suddenly has two audio streams? And you
changed the order of parameters?

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".