audioffmpegcolorsgnuplotwaveform

FFMpeg Piped GNUPlot Audio Waveform, "Can't Change Waveform Color" (Windows)


I have spent a couple of days trying to change the default waveform color in the command line Gnuplot portion with no success. Here is the code that works perfectly it outputs a purple audio waveform on a transparent background. I want to be able to change the purple color to an RGB color (i.e. "#ff0000" format).

ffmpeg -y -i "Traveling Man.mp3" -ac 1 -filter:a aresample=8000 -map 0:a -c:a pcm_s16le -f data - | gnuplot -p -e "set terminal png size 1000,250; set output 'waveform.png'; unset key;  set term png transparent truecolor; unset tics; unset border; set lmargin 0; set rmargin 0; set tmargin 0; set bmargin 0; plot '-' binary filetype=bin format='%int16' endian=little array=1:0 with lines;"

enter image description here

I have tried adding:

set linetype 9 lc rgb '0000ff'; set linetype cycle 9;

to the command line in various places and it either throws an error or outputs purple on transparent.

This has to be something very simple, I just can't seem to get it because the documentation does not show any usefull command-line examples. Any ideas are welcome, thank you.


Solution

  • You can change the color for each plot by explicitly specifying it. For the 'lines' style like in your example, you can specify the line color by adding "lc rgb '#ff0000'" after "with lines". The modified plot command will look like this.

    plot '-' binary filetype=bin format='%int16' endian=little array=1:0 with lines lc rgb '#ff0000';
    

    You can get more detailed control over the style of each plot by typing the following help command at the gnuplot prompt.

    gnuplot> help plot with